[chromium] CCLayerTreeHost / WebLayerTreeView should be single ownership, not RefCounted
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 9 Apr 2012 21:40:43 +0000 (21:40 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 9 Apr 2012 21:40:43 +0000 (21:40 +0000)
commitb5c73bc6fd3226429d13ffe338688244c71c260d
tree8c4b69e58a28386cd64066b55b41792f27f1b3fe
parente802fde8cd397eea90e68d880d132f69f055ba27
[chromium] CCLayerTreeHost / WebLayerTreeView should be single ownership, not RefCounted
https://bugs.webkit.org/show_bug.cgi?id=83413

Patch by James Robinson <jamesr@chromium.org> on 2012-04-09
Reviewed by Adrienne Walker.

Source/Platform:

This makes WebLayerTreeView noncopyable to better match the underlying semantics. There is no code currently
that attempts to copy WebLayerTreeView instances.

* chromium/public/WebLayerTreeView.h:
(WebKit):
(WebLayerTreeView):

Source/WebCore:

CCLayerTreeHost always has a single logical owner, typically a WebLayerTreeView via either WebViewImpl or the
public API. It is currently refcounted for historical reasons but this isn't necessary and adds confusion.
CCLayerTreeHost instances and pointers are carefully managed currently to avoid leaks. In particular, while
LayerChromium instances hold RefPtr<CCLayerTreeHost>s, whenever we want to destroy a CCLayerTreeHost we
proactively clear out these references inside setRootLayer() to break the cycle.

Refactor covered by existing unit and layout tests.

* platform/graphics/chromium/LayerChromium.cpp:
(WebCore::LayerChromium::LayerChromium):
(WebCore::LayerChromium::setMaskLayer):
(WebCore::LayerChromium::setReplicaLayer):
* platform/graphics/chromium/LayerChromium.h:
(WebCore::LayerChromium::layerTreeHost):
(LayerChromium):
* platform/graphics/chromium/cc/CCLayerTreeHost.cpp:
(WebCore::CCLayerTreeHost::create):
* platform/graphics/chromium/cc/CCLayerTreeHost.h:
(CCLayerTreeHost):

Source/WebKit/chromium:

Updates tests and implementation for RefPtr->OwnPtr switch. One nice benefit is that since WebLayerTreeView is
explicitly owned by the user of the API we can safely rely on them managing the lifetime of the client and thus
don't have to null check the client all the time.

* src/WebLayerTreeView.cpp:
(WebKit::WebLayerTreeView::reset):
(WebKit::WebLayerTreeView::isNull):
(WebKit::WebLayerTreeView::initialize):
* src/WebLayerTreeViewImpl.cpp:
(WebKit::WebLayerTreeViewImpl::create):
(WebKit::WebLayerTreeViewImpl::willBeginFrame):
(WebKit::WebLayerTreeViewImpl::updateAnimations):
(WebKit::WebLayerTreeViewImpl::layout):
(WebKit::WebLayerTreeViewImpl::applyScrollAndScale):
(WebKit::WebLayerTreeViewImpl::createContext):
(WebKit::WebLayerTreeViewImpl::didRecreateContext):
(WebKit::WebLayerTreeViewImpl::didCommit):
(WebKit::WebLayerTreeViewImpl::didCommitAndDrawFrame):
(WebKit::WebLayerTreeViewImpl::didCompleteSwapBuffers):
(WebKit::WebLayerTreeViewImpl::scheduleComposite):
* src/WebLayerTreeViewImpl.h:
(WebLayerTreeViewImpl):
* tests/CCLayerTreeHostTest.cpp:
(WTF::MockLayerTreeHost::create):
(CCLayerTreeHostTest):
* tests/Canvas2DLayerChromiumTest.cpp:
* tests/LayerChromiumTest.cpp:
* tests/TiledLayerChromiumTest.cpp:
(WTF::TEST):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@113623 268f45cc-cd09-0410-ab3c-d52691b4dbfc
15 files changed:
Source/Platform/ChangeLog
Source/Platform/chromium/public/WebLayerTreeView.h
Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/chromium/LayerChromium.cpp
Source/WebCore/platform/graphics/chromium/LayerChromium.h
Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp
Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/src/WebLayerTreeView.cpp
Source/WebKit/chromium/src/WebLayerTreeViewImpl.cpp
Source/WebKit/chromium/src/WebLayerTreeViewImpl.h
Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp
Source/WebKit/chromium/tests/Canvas2DLayerChromiumTest.cpp
Source/WebKit/chromium/tests/LayerChromiumTest.cpp
Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp