Changeset 126198 in webkit


Ignore:
Timestamp:
Aug 21, 2012 3:35:41 PM (12 years ago)
Author:
jamesr@google.com
Message:

[chromium] Should be able to destroy a CCLayerTreeHost without manually setting the root layer
https://bugs.webkit.org/show_bug.cgi?id=94631

Reviewed by Adrienne Walker.

Source/WebCore:

In the depths of time when dinosaurs roamed the earth, LayerChromium and CCLayerTreeHost were both reference
counted and there was a cycle between the root LayerChromium and CCLayerTreeHost. This required all users of
CCLayerTreeHost to manually break the cycle by calling setRootLayer(0) before dropping their reference to the
host. Nowadays, CCLayerTreeHost has a single owner and LayerChromiums only have a weak pointer to their host
so we should just do this cleanup ourselves instead of imposing it on callers.

Unit test added to LayerChromiumTest.cpp

  • platform/graphics/chromium/cc/CCLayerTreeHost.cpp:

(WebCore::CCLayerTreeHost::~CCLayerTreeHost):

Source/WebKit/chromium:

Tests that destroying a CCLayerTreeHost that still points to a non-null root doesn't crash.

  • tests/LayerChromiumTest.cpp:
Location:
trunk/Source
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r126196 r126198  
     12012-08-21  James Robinson  <jamesr@chromium.org>
     2
     3        [chromium] Should be able to destroy a CCLayerTreeHost without manually setting the root layer
     4        https://bugs.webkit.org/show_bug.cgi?id=94631
     5
     6        Reviewed by Adrienne Walker.
     7
     8        In the depths of time when dinosaurs roamed the earth, LayerChromium and CCLayerTreeHost were both reference
     9        counted and there was a cycle between the root LayerChromium and CCLayerTreeHost. This required all users of
     10        CCLayerTreeHost to manually break the cycle by calling setRootLayer(0) before dropping their reference to the
     11        host. Nowadays, CCLayerTreeHost has a single owner and LayerChromiums only have a weak pointer to their host
     12        so we should just do this cleanup ourselves instead of imposing it on callers.
     13
     14        Unit test added to LayerChromiumTest.cpp
     15
     16        * platform/graphics/chromium/cc/CCLayerTreeHost.cpp:
     17        (WebCore::CCLayerTreeHost::~CCLayerTreeHost):
     18
    1192012-08-21  Ulan Degenbaev  <ulan@chromium.org>
    220
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp

    r126046 r126198  
    114114CCLayerTreeHost::~CCLayerTreeHost()
    115115{
     116    if (m_rootLayer)
     117        m_rootLayer->setLayerTreeHost(0);
    116118    ASSERT(CCProxy::isMainThread());
    117119    TRACE_EVENT0("cc", "CCLayerTreeHost::~CCLayerTreeHost");
  • trunk/Source/WebKit/chromium/ChangeLog

    r126174 r126198  
     12012-08-21  James Robinson  <jamesr@chromium.org>
     2
     3        [chromium] Should be able to destroy a CCLayerTreeHost without manually setting the root layer
     4        https://bugs.webkit.org/show_bug.cgi?id=94631
     5
     6        Reviewed by Adrienne Walker.
     7
     8        Tests that destroying a CCLayerTreeHost that still points to a non-null root doesn't crash.
     9
     10        * tests/LayerChromiumTest.cpp:
     11
    1122012-08-21  James Robinson  <jamesr@chromium.org>
    213
  • trunk/Source/WebKit/chromium/tests/LayerChromiumTest.cpp

    r125932 r126198  
    804804}
    805805
     806TEST(LayerChromiumLayerTreeHostTest, destroyHostWithNonNullRootLayer)
     807{
     808    WebKit::WebCompositor::initialize(0);
     809    RefPtr<LayerChromium> root = LayerChromium::create();
     810    RefPtr<LayerChromium> child = LayerChromium::create();
     811    root->addChild(child);
     812    OwnPtr<FakeCCLayerTreeHost> layerTreeHost(FakeCCLayerTreeHost::create());
     813    layerTreeHost->setRootLayer(root);
     814    layerTreeHost.clear();
     815    WebKit::WebCompositor::shutdown();
     816}
     817
    806818class MockLayerChromium : public LayerChromium {
    807819public:
Note: See TracChangeset for help on using the changeset viewer.