Title: [113623] trunk/Source
Revision
113623
Author
[email protected]
Date
2012-04-09 14:40:43 -0700 (Mon, 09 Apr 2012)

Log Message

[chromium] CCLayerTreeHost / WebLayerTreeView should be single ownership, not RefCounted
https://bugs.webkit.org/show_bug.cgi?id=83413

Patch by James Robinson <[email protected]> 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):

Modified Paths

Diff

Modified: trunk/Source/Platform/ChangeLog (113622 => 113623)


--- trunk/Source/Platform/ChangeLog	2012-04-09 21:37:08 UTC (rev 113622)
+++ trunk/Source/Platform/ChangeLog	2012-04-09 21:40:43 UTC (rev 113623)
@@ -1,3 +1,17 @@
+2012-04-09  James Robinson  <[email protected]>
+
+        [chromium] CCLayerTreeHost / WebLayerTreeView should be single ownership, not RefCounted
+        https://bugs.webkit.org/show_bug.cgi?id=83413
+
+        Reviewed by Adrienne Walker.
+
+        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):
+
 2012-04-04  Adam Barth  <[email protected]>
 
         figure out how to export webcore symbols from webkit.dll properly

Modified: trunk/Source/Platform/chromium/public/WebLayerTreeView.h (113622 => 113623)


--- trunk/Source/Platform/chromium/public/WebLayerTreeView.h	2012-04-09 21:37:08 UTC (rev 113622)
+++ trunk/Source/Platform/chromium/public/WebLayerTreeView.h	2012-04-09 21:40:43 UTC (rev 113623)
@@ -27,10 +27,10 @@
 #define WebLayerTreeView_h
 
 #include "WebCommon.h"
-#include "WebPrivatePtr.h"
+#include "WebNonCopyable.h"
+#include "WebPrivateOwnPtr.h"
 
 namespace WebCore {
-class CCLayerTreeHost;
 struct CCSettings;
 }
 
@@ -38,11 +38,12 @@
 class WebGraphicsContext3D;
 class WebLayer;
 class WebLayerTreeViewClient;
+class WebLayerTreeViewImpl;
 struct WebPoint;
 struct WebRect;
 struct WebSize;
 
-class WebLayerTreeView {
+class WebLayerTreeView : public WebNonCopyable {
 public:
     struct Settings {
         Settings()
@@ -71,21 +72,12 @@
     };
 
     WebLayerTreeView() { }
-    WebLayerTreeView(const WebLayerTreeView& layer) { assign(layer); }
     ~WebLayerTreeView() { reset(); }
-    WebLayerTreeView& operator=(const WebLayerTreeView& layer)
-    {
-        assign(layer);
-        return *this;
-    }
 
     WEBKIT_EXPORT void reset();
-    WEBKIT_EXPORT void assign(const WebLayerTreeView&);
-    WEBKIT_EXPORT bool equals(const WebLayerTreeView&) const;
 
-    bool isNull() const { return m_private.isNull(); }
+    bool isNull() const;
 
-#define WEBLAYERTREEVIEW_HAS_INITIALIZE
     // Initialization and lifecycle --------------------------------------
 
     // Attempts to initialize this WebLayerTreeView with the given client, root layer, and settings.
@@ -169,19 +161,9 @@
     WEBKIT_EXPORT void loseCompositorContext(int numTimes);
 
 protected:
-    WebPrivatePtr<WebCore::CCLayerTreeHost> m_private;
+    WebPrivateOwnPtr<WebLayerTreeViewImpl> m_private;
 };
 
-inline bool operator==(const WebLayerTreeView& a, const WebLayerTreeView& b)
-{
-    return a.equals(b);
-}
-
-inline bool operator!=(const WebLayerTreeView& a, const WebLayerTreeView& b)
-{
-    return !(a == b);
-}
-
 } // namespace WebKit
 
 #endif // WebLayerTreeView_h

Modified: trunk/Source/WebCore/ChangeLog (113622 => 113623)


--- trunk/Source/WebCore/ChangeLog	2012-04-09 21:37:08 UTC (rev 113622)
+++ trunk/Source/WebCore/ChangeLog	2012-04-09 21:40:43 UTC (rev 113623)
@@ -1,3 +1,30 @@
+2012-04-09  James Robinson  <[email protected]>
+
+        [chromium] CCLayerTreeHost / WebLayerTreeView should be single ownership, not RefCounted
+        https://bugs.webkit.org/show_bug.cgi?id=83413
+
+        Reviewed by Adrienne Walker.
+
+        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):
+
 2012-04-09  Joshua Bell  <[email protected]>
 
         Unreviewed, rolling out r113473.

Modified: trunk/Source/WebCore/platform/graphics/chromium/LayerChromium.cpp (113622 => 113623)


--- trunk/Source/WebCore/platform/graphics/chromium/LayerChromium.cpp	2012-04-09 21:37:08 UTC (rev 113622)
+++ trunk/Source/WebCore/platform/graphics/chromium/LayerChromium.cpp	2012-04-09 21:40:43 UTC (rev 113623)
@@ -59,6 +59,7 @@
     : m_needsDisplay(false)
     , m_layerId(s_nextLayerId++)
     , m_parent(0)
+    , m_layerTreeHost(0)
     , m_layerAnimationController(CCLayerAnimationController::create(this))
     , m_scrollable(false)
     , m_shouldScrollOnMainThread(false)
@@ -294,7 +295,7 @@
         m_maskLayer->setLayerTreeHost(0);
     m_maskLayer = maskLayer;
     if (m_maskLayer) {
-        m_maskLayer->setLayerTreeHost(m_layerTreeHost.get());
+        m_maskLayer->setLayerTreeHost(m_layerTreeHost);
         m_maskLayer->setIsMask(true);
     }
     setNeedsCommit();
@@ -308,7 +309,7 @@
         m_replicaLayer->setLayerTreeHost(0);
     m_replicaLayer = layer;
     if (m_replicaLayer)
-        m_replicaLayer->setLayerTreeHost(m_layerTreeHost.get());
+        m_replicaLayer->setLayerTreeHost(m_layerTreeHost);
     setNeedsCommit();
 }
 

Modified: trunk/Source/WebCore/platform/graphics/chromium/LayerChromium.h (113622 => 113623)


--- trunk/Source/WebCore/platform/graphics/chromium/LayerChromium.h	2012-04-09 21:37:08 UTC (rev 113622)
+++ trunk/Source/WebCore/platform/graphics/chromium/LayerChromium.h	2012-04-09 21:40:43 UTC (rev 113623)
@@ -222,7 +222,7 @@
     // Returns true if any of the layer's descendants has content to draw.
     bool descendantDrawsContent();
 
-    CCLayerTreeHost* layerTreeHost() const { return m_layerTreeHost.get(); }
+    CCLayerTreeHost* layerTreeHost() const { return m_layerTreeHost; }
 
     // Reserve any textures needed for this layer.
     virtual void reserveTextures() { }
@@ -289,7 +289,10 @@
     Vector<RefPtr<LayerChromium> > m_children;
     LayerChromium* m_parent;
 
-    RefPtr<CCLayerTreeHost> m_layerTreeHost;
+    // LayerChromium instances have a weak pointer to their CCLayerTreeHost.
+    // This pointer value is nil when a LayerChromium is not in a tree and is
+    // updated via setLayerTreeHost() if a layer moves between trees.
+    CCLayerTreeHost* m_layerTreeHost;
 
     OwnPtr<CCLayerAnimationController> m_layerAnimationController;
 

Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp (113622 => 113623)


--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp	2012-04-09 21:37:08 UTC (rev 113622)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp	2012-04-09 21:40:43 UTC (rev 113623)
@@ -56,12 +56,12 @@
     return numLayerTreeInstances > 0;
 }
 
-PassRefPtr<CCLayerTreeHost> CCLayerTreeHost::create(CCLayerTreeHostClient* client, const CCSettings& settings)
+PassOwnPtr<CCLayerTreeHost> CCLayerTreeHost::create(CCLayerTreeHostClient* client, const CCSettings& settings)
 {
-    RefPtr<CCLayerTreeHost> layerTreeHost = adoptRef(new CCLayerTreeHost(client, settings));
+    OwnPtr<CCLayerTreeHost> layerTreeHost = adoptPtr(new CCLayerTreeHost(client, settings));
     if (!layerTreeHost->initialize())
-        return 0;
-    return layerTreeHost;
+        return nullptr;
+    return layerTreeHost.release();
 }
 
 CCLayerTreeHost::CCLayerTreeHost(CCLayerTreeHostClient* client, const CCSettings& settings)

Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h (113622 => 113623)


--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h	2012-04-09 21:37:08 UTC (rev 113622)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h	2012-04-09 21:40:43 UTC (rev 113623)
@@ -36,9 +36,9 @@
 
 #include <limits>
 #include <wtf/HashMap.h>
+#include <wtf/OwnPtr.h>
 #include <wtf/PassOwnPtr.h>
 #include <wtf/PassRefPtr.h>
-#include <wtf/RefCounted.h>
 
 namespace WebCore {
 
@@ -122,9 +122,10 @@
     int maxTextureSize;
 };
 
-class CCLayerTreeHost : public RefCounted<CCLayerTreeHost> {
+class CCLayerTreeHost {
+    WTF_MAKE_NONCOPYABLE(CCLayerTreeHost);
 public:
-    static PassRefPtr<CCLayerTreeHost> create(CCLayerTreeHostClient*, const CCSettings&);
+    static PassOwnPtr<CCLayerTreeHost> create(CCLayerTreeHostClient*, const CCSettings&);
     virtual ~CCLayerTreeHost();
 
     // Returns true if any CCLayerTreeHost is alive.

Modified: trunk/Source/WebKit/chromium/ChangeLog (113622 => 113623)


--- trunk/Source/WebKit/chromium/ChangeLog	2012-04-09 21:37:08 UTC (rev 113622)
+++ trunk/Source/WebKit/chromium/ChangeLog	2012-04-09 21:40:43 UTC (rev 113623)
@@ -1,3 +1,40 @@
+2012-04-09  James Robinson  <[email protected]>
+
+        [chromium] CCLayerTreeHost / WebLayerTreeView should be single ownership, not RefCounted
+        https://bugs.webkit.org/show_bug.cgi?id=83413
+
+        Reviewed by Adrienne Walker.
+
+        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):
+
 2012-04-09  Joshua Bell  <[email protected]>
 
         Unreviewed, rolling out r113473.

Modified: trunk/Source/WebKit/chromium/src/WebLayerTreeView.cpp (113622 => 113623)


--- trunk/Source/WebKit/chromium/src/WebLayerTreeView.cpp	2012-04-09 21:37:08 UTC (rev 113622)
+++ trunk/Source/WebKit/chromium/src/WebLayerTreeView.cpp	2012-04-09 21:40:43 UTC (rev 113623)
@@ -55,22 +55,18 @@
 
 void WebLayerTreeView::reset()
 {
-    m_private.reset();
+    m_private.reset(0);
 }
 
-void WebLayerTreeView::assign(const WebLayerTreeView& other)
+bool WebLayerTreeView::isNull() const
 {
-    m_private = other.m_private;
+    return !m_private.get();
 }
 
-bool WebLayerTreeView::equals(const WebLayerTreeView& n) const
-{
-    return (m_private.get() == n.m_private.get());
-}
-
 bool WebLayerTreeView::initialize(WebLayerTreeViewClient* client, const WebLayer& root, const WebLayerTreeView::Settings& settings)
 {
-    m_private = WebLayerTreeViewImpl::create(client, root, settings);
+    // We have to leak the pointer here into a WebPrivateOwnPtr. We free this object in reset().
+    m_private.reset(WebLayerTreeViewImpl::create(client, root, settings).leakPtr());
     return !isNull();
 }
 

Modified: trunk/Source/WebKit/chromium/src/WebLayerTreeViewImpl.cpp (113622 => 113623)


--- trunk/Source/WebKit/chromium/src/WebLayerTreeViewImpl.cpp	2012-04-09 21:37:08 UTC (rev 113622)
+++ trunk/Source/WebKit/chromium/src/WebLayerTreeViewImpl.cpp	2012-04-09 21:40:43 UTC (rev 113623)
@@ -41,13 +41,13 @@
 
 namespace WebKit {
 
-PassRefPtr<WebLayerTreeViewImpl> WebLayerTreeViewImpl::create(WebLayerTreeViewClient* client, const WebLayer& root, const WebLayerTreeView::Settings& settings)
+PassOwnPtr<WebLayerTreeViewImpl> WebLayerTreeViewImpl::create(WebLayerTreeViewClient* client, const WebLayer& root, const WebLayerTreeView::Settings& settings)
 {
-    RefPtr<WebLayerTreeViewImpl> host = adoptRef(new WebLayerTreeViewImpl(client, settings));
+    OwnPtr<WebLayerTreeViewImpl> host = adoptPtr(new WebLayerTreeViewImpl(client, settings));
     if (!host->initialize())
-        return 0;
+        return nullptr;
     host->setRootLayer(root);
-    return host;
+    return host.release();
 }
 
 WebLayerTreeViewImpl::WebLayerTreeViewImpl(WebLayerTreeViewClient* client, const WebLayerTreeView::Settings& settings) 
@@ -62,32 +62,26 @@
 
 void WebLayerTreeViewImpl::willBeginFrame()
 {
-    if (m_client)
-        m_client->willBeginFrame();
+    m_client->willBeginFrame();
 }
 
 void WebLayerTreeViewImpl::updateAnimations(double monotonicFrameBeginTime)
 {
-    if (m_client)
-        m_client->updateAnimations(monotonicFrameBeginTime);
+    m_client->updateAnimations(monotonicFrameBeginTime);
 }
 
 void WebLayerTreeViewImpl::layout()
 {
-    if (m_client)
-        m_client->layout();
+    m_client->layout();
 }
 
 void WebLayerTreeViewImpl::applyScrollAndScale(const WebCore::IntSize& scrollDelta, float pageScale)
 {
-    if (m_client)
-        m_client->applyScrollAndScale(WebSize(scrollDelta), pageScale);
+    m_client->applyScrollAndScale(WebSize(scrollDelta), pageScale);
 }
 
 PassRefPtr<GraphicsContext3D> WebLayerTreeViewImpl::createContext()
 {
-    if (!m_client)
-        return 0;
     OwnPtr<WebGraphicsContext3D> webContext = adoptPtr(m_client->createContext3D());
     if (!webContext)
         return 0;
@@ -97,32 +91,27 @@
 
 void WebLayerTreeViewImpl::didRecreateContext(bool success)
 {
-    if (m_client)
-        m_client->didRebindGraphicsContext(success);
+    m_client->didRebindGraphicsContext(success);
 }
 
 void WebLayerTreeViewImpl::didCommit()
 {
-    if (m_client)
-        m_client->didCommit();
+    m_client->didCommit();
 }
 
 void WebLayerTreeViewImpl::didCommitAndDrawFrame()
 {
-    if (m_client)
-        m_client->didCommitAndDrawFrame();
+    m_client->didCommitAndDrawFrame();
 }
 
 void WebLayerTreeViewImpl::didCompleteSwapBuffers()
 {
-    if (m_client)
-        m_client->didCompleteSwapBuffers();
+    m_client->didCompleteSwapBuffers();
 }
 
 void WebLayerTreeViewImpl::scheduleComposite()
 {
-    if (m_client)
-        m_client->scheduleComposite();
+    m_client->scheduleComposite();
 }
 
 } // namespace WebKit

Modified: trunk/Source/WebKit/chromium/src/WebLayerTreeViewImpl.h (113622 => 113623)


--- trunk/Source/WebKit/chromium/src/WebLayerTreeViewImpl.h	2012-04-09 21:37:08 UTC (rev 113622)
+++ trunk/Source/WebKit/chromium/src/WebLayerTreeViewImpl.h	2012-04-09 21:40:43 UTC (rev 113623)
@@ -28,7 +28,7 @@
 
 #include "platform/WebLayerTreeView.h"
 #include "cc/CCLayerTreeHost.h"
-#include <wtf/PassRefPtr.h>
+#include <wtf/PassOwnPtr.h>
 
 namespace WebKit {
 class WebLayer;
@@ -36,11 +36,9 @@
 
 class WebLayerTreeViewImpl : public WebCore::CCLayerTreeHost, public WebCore::CCLayerTreeHostClient {
 public:
-    static PassRefPtr<WebLayerTreeViewImpl> create(WebLayerTreeViewClient*, const WebLayer& root, const WebLayerTreeView::Settings&);
+    static PassOwnPtr<WebLayerTreeViewImpl> create(WebLayerTreeViewClient*, const WebLayer& root, const WebLayerTreeView::Settings&);
+    virtual ~WebLayerTreeViewImpl();
 
-private:
-    WebLayerTreeViewImpl(WebLayerTreeViewClient*, const WebLayerTreeView::Settings&);
-    virtual ~WebLayerTreeViewImpl();
     virtual void willBeginFrame();
     virtual void updateAnimations(double monotonicFrameBeginTime);
     virtual void layout();
@@ -54,6 +52,9 @@
     // Only used in the single threaded path.
     virtual void scheduleComposite();
 
+private:
+    WebLayerTreeViewImpl(WebLayerTreeViewClient*, const WebLayerTreeView::Settings&);
+
     WebLayerTreeViewClient* m_client;
 };
 

Modified: trunk/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp (113622 => 113623)


--- trunk/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp	2012-04-09 21:37:08 UTC (rev 113622)
+++ trunk/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp	2012-04-09 21:40:43 UTC (rev 113623)
@@ -132,13 +132,13 @@
 // Adapts CCLayerTreeHost for test. Injects MockLayerTreeHostImpl.
 class MockLayerTreeHost : public CCLayerTreeHost {
 public:
-    static PassRefPtr<MockLayerTreeHost> create(TestHooks* testHooks, CCLayerTreeHostClient* client, PassRefPtr<LayerChromium> rootLayer, const CCSettings& settings)
+    static PassOwnPtr<MockLayerTreeHost> create(TestHooks* testHooks, CCLayerTreeHostClient* client, PassRefPtr<LayerChromium> rootLayer, const CCSettings& settings)
     {
         // For these tests, we will enable threaded animations.
         CCSettings settingsCopy = settings;
         settingsCopy.threadedAnimationEnabled = true;
 
-        RefPtr<MockLayerTreeHost> layerTreeHost = adoptRef(new MockLayerTreeHost(testHooks, client, settingsCopy));
+        OwnPtr<MockLayerTreeHost> layerTreeHost = adoptPtr(new MockLayerTreeHost(testHooks, client, settingsCopy));
         bool success = layerTreeHost->initialize();
         EXPECT_TRUE(success);
         layerTreeHost->setRootLayer(rootLayer);
@@ -515,7 +515,7 @@
 
     CCSettings m_settings;
     OwnPtr<MockLayerTreeHostClient> m_client;
-    RefPtr<CCLayerTreeHost> m_layerTreeHost;
+    OwnPtr<CCLayerTreeHost> m_layerTreeHost;
 
 private:
     bool m_beginning;

Modified: trunk/Source/WebKit/chromium/tests/Canvas2DLayerChromiumTest.cpp (113622 => 113623)


--- trunk/Source/WebKit/chromium/tests/Canvas2DLayerChromiumTest.cpp	2012-04-09 21:37:08 UTC (rev 113622)
+++ trunk/Source/WebKit/chromium/tests/Canvas2DLayerChromiumTest.cpp	2012-04-09 21:40:43 UTC (rev 113623)
@@ -56,9 +56,9 @@
 
 class FakeCCLayerTreeHost : public CCLayerTreeHost {
 public:
-    static PassRefPtr<FakeCCLayerTreeHost> create()
+    static PassOwnPtr<FakeCCLayerTreeHost> create()
     {
-        RefPtr<FakeCCLayerTreeHost> host = adoptRef(new FakeCCLayerTreeHost);
+        OwnPtr<FakeCCLayerTreeHost> host = adoptPtr(new FakeCCLayerTreeHost);
         host->initialize();
         return host.release();
     }
@@ -111,7 +111,7 @@
            thread = adoptPtr(webKitPlatformSupport()->createThread("Canvas2DLayerChromiumTest"));
         WebCompositor::initialize(thread.get());
 
-        RefPtr<FakeCCLayerTreeHost> layerTreeHost = FakeCCLayerTreeHost::create();
+        OwnPtr<FakeCCLayerTreeHost> layerTreeHost = FakeCCLayerTreeHost::create();
         // Force an update, so that we get a valid TextureManager.
         layerTreeHost->updateLayers();
 

Modified: trunk/Source/WebKit/chromium/tests/LayerChromiumTest.cpp (113622 => 113623)


--- trunk/Source/WebKit/chromium/tests/LayerChromiumTest.cpp	2012-04-09 21:37:08 UTC (rev 113622)
+++ trunk/Source/WebKit/chromium/tests/LayerChromiumTest.cpp	2012-04-09 21:40:43 UTC (rev 113623)
@@ -78,7 +78,7 @@
     {
         // Initialize without threading support.
         WebKit::WebCompositor::initialize(0);
-        m_layerTreeHost = adoptRef(new MockCCLayerTreeHost);
+        m_layerTreeHost = adoptPtr(new MockCCLayerTreeHost);
     }
 
     virtual void TearDown()
@@ -146,7 +146,7 @@
         verifyTestTreeInitialState();
     }
 
-    RefPtr<MockCCLayerTreeHost> m_layerTreeHost;
+    OwnPtr<MockCCLayerTreeHost> m_layerTreeHost;
     RefPtr<LayerChromium> m_parent, m_child1, m_child2, m_child3, m_grandChild1, m_grandChild2, m_grandChild3;
 };
 
@@ -601,9 +601,9 @@
 
 class FakeCCLayerTreeHost : public CCLayerTreeHost {
 public:
-    static PassRefPtr<FakeCCLayerTreeHost> create()
+    static PassOwnPtr<FakeCCLayerTreeHost> create()
     {
-        RefPtr<FakeCCLayerTreeHost> host = adoptRef(new FakeCCLayerTreeHost);
+        OwnPtr<FakeCCLayerTreeHost> host = adoptPtr(new FakeCCLayerTreeHost);
         // The initialize call will fail, since our client doesn't provide a valid GraphicsContext3D, but it doesn't matter in the tests that use this fake so ignore the return value.
         host->initialize();
         return host.release();
@@ -650,7 +650,7 @@
 
     assertLayerTreeHostMatchesForSubtree(parent.get(), 0);
 
-    RefPtr<FakeCCLayerTreeHost> layerTreeHost = FakeCCLayerTreeHost::create();
+    OwnPtr<FakeCCLayerTreeHost> layerTreeHost = FakeCCLayerTreeHost::create();
     // Setting the root layer should set the host pointer for all layers in the tree.
     layerTreeHost->setRootLayer(parent.get());
 
@@ -669,7 +669,7 @@
 {
     WebKit::WebCompositor::initialize(0);
     RefPtr<LayerChromium> parent = LayerChromium::create();
-    RefPtr<FakeCCLayerTreeHost> layerTreeHost = FakeCCLayerTreeHost::create();
+    OwnPtr<FakeCCLayerTreeHost> layerTreeHost = FakeCCLayerTreeHost::create();
 
     layerTreeHost->setRootLayer(parent.get());
 
@@ -711,14 +711,14 @@
     child->setReplicaLayer(replica.get());
     replica->setMaskLayer(mask.get());
 
-    RefPtr<FakeCCLayerTreeHost> firstLayerTreeHost = FakeCCLayerTreeHost::create();
+    OwnPtr<FakeCCLayerTreeHost> firstLayerTreeHost = FakeCCLayerTreeHost::create();
     firstLayerTreeHost->setRootLayer(parent.get());
 
     assertLayerTreeHostMatchesForSubtree(parent.get(), firstLayerTreeHost.get());
 
     // Now re-root the tree to a new host (simulating what we do on a context lost event).
     // This should update the host pointers for all layers in the tree.
-    RefPtr<FakeCCLayerTreeHost> secondLayerTreeHost = FakeCCLayerTreeHost::create();
+    OwnPtr<FakeCCLayerTreeHost> secondLayerTreeHost = FakeCCLayerTreeHost::create();
     secondLayerTreeHost->setRootLayer(parent.get());
 
     assertLayerTreeHostMatchesForSubtree(parent.get(), secondLayerTreeHost.get());
@@ -743,13 +743,13 @@
     secondChild->addChild(secondGrandChild);
     firstParent->addChild(secondChild);
 
-    RefPtr<FakeCCLayerTreeHost> firstLayerTreeHost = FakeCCLayerTreeHost::create();
+    OwnPtr<FakeCCLayerTreeHost> firstLayerTreeHost = FakeCCLayerTreeHost::create();
     firstLayerTreeHost->setRootLayer(firstParent.get());
 
     assertLayerTreeHostMatchesForSubtree(firstParent.get(), firstLayerTreeHost.get());
 
     // Now reparent the subtree starting at secondChild to a layer in a different tree.
-    RefPtr<FakeCCLayerTreeHost> secondLayerTreeHost = FakeCCLayerTreeHost::create();
+    OwnPtr<FakeCCLayerTreeHost> secondLayerTreeHost = FakeCCLayerTreeHost::create();
     secondLayerTreeHost->setRootLayer(secondParent.get());
 
     secondParent->addChild(secondChild);
@@ -782,7 +782,7 @@
     mask->addChild(maskChild);
     replica->addChild(replicaChild);
 
-    RefPtr<FakeCCLayerTreeHost> layerTreeHost = FakeCCLayerTreeHost::create();
+    OwnPtr<FakeCCLayerTreeHost> layerTreeHost = FakeCCLayerTreeHost::create();
     layerTreeHost->setRootLayer(parent.get());
 
     assertLayerTreeHostMatchesForSubtree(parent.get(), layerTreeHost.get());

Modified: trunk/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp (113622 => 113623)


--- trunk/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp	2012-04-09 21:37:08 UTC (rev 113622)
+++ trunk/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp	2012-04-09 21:40:43 UTC (rev 113623)
@@ -821,7 +821,7 @@
     // Initialize without threading support.
     WebKit::WebCompositor::initialize(0);
     FakeCCLayerTreeHostClient fakeCCLayerTreeHostClient;
-    RefPtr<CCLayerTreeHost> ccLayerTreeHost = CCLayerTreeHost::create(&fakeCCLayerTreeHostClient, CCSettings());
+    OwnPtr<CCLayerTreeHost> ccLayerTreeHost = CCLayerTreeHost::create(&fakeCCLayerTreeHostClient, CCSettings());
 
     // Create two 300 x 300 tiled layers.
     IntSize contentBounds(300, 300);
@@ -901,7 +901,7 @@
     // Initialize without threading support.
     WebKit::WebCompositor::initialize(0);
     FakeCCLayerTreeHostClient fakeCCLayerTreeHostClient;
-    RefPtr<CCLayerTreeHost> ccLayerTreeHost = CCLayerTreeHost::create(&fakeCCLayerTreeHostClient, settings);
+    OwnPtr<CCLayerTreeHost> ccLayerTreeHost = CCLayerTreeHost::create(&fakeCCLayerTreeHostClient, settings);
 
     // Create one 500 x 300 tiled layer.
     IntSize contentBounds(300, 200);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to