[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