Changeset 120858 in webkit


Ignore:
Timestamp:
Jun 20, 2012 1:48:07 PM (12 years ago)
Author:
jamesr@google.com
Message:

[chromium] Separate LayerRenderer initialization from updateLayers
https://bugs.webkit.org/show_bug.cgi?id=89525

Reviewed by Adrienne Walker.

Source/WebCore:

This adds an explicit call to initialize the layer renderer of a given CCLayerTreeHost instead of having it be
implicit in updateLayers(). This way the proxies can control the initialization sequence more closely and do
useful work between the two calls.

Refactor, no change in behavior. Covered by existing tests.

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

(WebCore::CCLayerTreeHost::compositeAndReadback):
(WebCore::CCLayerTreeHost::initializeLayerRendererIfNeeded):
(WebCore):
(WebCore::CCLayerTreeHost::updateLayers):

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

(CCLayerTreeHost):

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

(WebCore::CCSingleThreadProxy::commitAndComposite):

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

(WebCore::CCThreadProxy::compositeAndReadback):
(WebCore::CCThreadProxy::beginFrame):

Source/WebKit/chromium:

Update tests to call initializeLayerRendererIfNeeded() before calling updateLayers() to reflect what the proxies
do.

  • tests/CCLayerTreeHostTest.cpp:

(WTF::CCLayerTreeHostTestLayerOcclusion::beginTest):
(WTF::CCLayerTreeHostTestLayerOcclusionWithFilters::beginTest):
(WTF::CCLayerTreeHostTestManySurfaces::beginTest):

  • tests/TiledLayerChromiumTest.cpp:
Location:
trunk/Source
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r120855 r120858  
     12012-06-19  James Robinson  <jamesr@chromium.org>
     2
     3        [chromium] Separate LayerRenderer initialization from updateLayers
     4        https://bugs.webkit.org/show_bug.cgi?id=89525
     5
     6        Reviewed by Adrienne Walker.
     7
     8        This adds an explicit call to initialize the layer renderer of a given CCLayerTreeHost instead of having it be
     9        implicit in updateLayers(). This way the proxies can control the initialization sequence more closely and do
     10        useful work between the two calls.
     11
     12        Refactor, no change in behavior. Covered by existing tests.
     13
     14        * platform/graphics/chromium/cc/CCLayerTreeHost.cpp:
     15        (WebCore::CCLayerTreeHost::compositeAndReadback):
     16        (WebCore::CCLayerTreeHost::initializeLayerRendererIfNeeded):
     17        (WebCore):
     18        (WebCore::CCLayerTreeHost::updateLayers):
     19        * platform/graphics/chromium/cc/CCLayerTreeHost.h:
     20        (CCLayerTreeHost):
     21        * platform/graphics/chromium/cc/CCSingleThreadProxy.cpp:
     22        (WebCore::CCSingleThreadProxy::commitAndComposite):
     23        * platform/graphics/chromium/cc/CCThreadProxy.cpp:
     24        (WebCore::CCThreadProxy::compositeAndReadback):
     25        (WebCore::CCThreadProxy::beginFrame):
     26
    1272012-06-20  Yong Li  <yoli@rim.com>
    228
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp

    r120820 r120858  
    301301bool CCLayerTreeHost::compositeAndReadback(void *pixels, const IntRect& rect)
    302302{
    303     if (!m_layerRendererInitialized) {
    304         initializeLayerRenderer();
    305         if (!m_layerRendererInitialized)
    306             return false;
    307     }
    308     if (m_contextLost) {
    309         if (recreateContext() != RecreateSucceeded)
    310             return false;
    311     }
    312303    m_triggerIdlePaints = false;
    313304    bool ret = m_proxy->compositeAndReadback(pixels, rect);
     
    468459}
    469460
    470 bool CCLayerTreeHost::updateLayers(CCTextureUpdater& updater)
     461bool CCLayerTreeHost::initializeLayerRendererIfNeeded()
    471462{
    472463    if (!m_layerRendererInitialized) {
     
    480471            return false;
    481472    }
    482 
     473    return true;
     474}
     475
     476
     477void CCLayerTreeHost::updateLayers(CCTextureUpdater& updater)
     478{
     479    ASSERT(m_layerRendererInitialized);
    483480    // The visible state and memory allocation are set independently and in
    484481    // arbitrary order, so do not change the memory allocation used for the
     
    493490
    494491    if (!rootLayer())
    495         return true;
     492        return;
    496493
    497494    if (viewportSize().isEmpty())
    498         return true;
     495        return;
    499496
    500497    updateLayers(rootLayer(), updater);
    501     return true;
    502498}
    503499
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h

    r120820 r120858  
    171171    virtual void acquireLayerTextures();
    172172    // Returns false if we should abort this frame due to initialization failure.
    173     bool updateLayers(CCTextureUpdater&);
     173    bool initializeLayerRendererIfNeeded();
     174    void updateLayers(CCTextureUpdater&);
    174175
    175176    CCLayerTreeHostClient* client() { return m_client; }
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.cpp

    r120820 r120858  
    346346    ASSERT(CCProxy::isMainThread());
    347347
     348    if (!m_layerTreeHost->initializeLayerRendererIfNeeded())
     349        return false;
     350
    348351    CCTextureUpdater updater;
    349 
    350     if (!m_layerTreeHost->updateLayers(updater))
    351         return false;
     352    m_layerTreeHost->updateLayers(updater);
    352353
    353354    m_layerTreeHost->willCommit();
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp

    r120820 r120858  
    105105    ASSERT(m_layerTreeHost);
    106106
    107     if (!m_layerRendererInitialized) {
     107    if (!m_layerTreeHost->initializeLayerRendererIfNeeded()) {
    108108        TRACE_EVENT("compositeAndReadback_EarlyOut_LR_Uninitialized", this, 0);
    109109        return false;
     
    511511    m_forcedCommitRequested = false;
    512512
    513     if (!m_layerTreeHost->updateLayers(*request->updater))
    514         return;
     513    if (!m_layerTreeHost->initializeLayerRendererIfNeeded())
     514        return;
     515
     516    m_layerTreeHost->updateLayers(*request->updater);
    515517
    516518    // Once single buffered layers are committed, they cannot be modified until
  • trunk/Source/WebKit/chromium/ChangeLog

    r120847 r120858  
     12012-06-19  James Robinson  <jamesr@chromium.org>
     2
     3        [chromium] Separate LayerRenderer initialization from updateLayers
     4        https://bugs.webkit.org/show_bug.cgi?id=89525
     5
     6        Reviewed by Adrienne Walker.
     7
     8        Update tests to call initializeLayerRendererIfNeeded() before calling updateLayers() to reflect what the proxies
     9        do.
     10
     11        * tests/CCLayerTreeHostTest.cpp:
     12        (WTF::CCLayerTreeHostTestLayerOcclusion::beginTest):
     13        (WTF::CCLayerTreeHostTestLayerOcclusionWithFilters::beginTest):
     14        (WTF::CCLayerTreeHostTestManySurfaces::beginTest):
     15        * tests/TiledLayerChromiumTest.cpp:
     16
    1172012-06-20  Christopher Cameron  <ccameron@chromium.org>
    218
  • trunk/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp

    r120820 r120858  
    17331733        m_layerTreeHost->setRootLayer(rootLayer);
    17341734        m_layerTreeHost->setViewportSize(rootLayer->bounds());
     1735        ASSERT_TRUE(m_layerTreeHost->initializeLayerRendererIfNeeded());
    17351736        CCTextureUpdater updater;
    17361737        m_layerTreeHost->updateLayers(updater);
     
    19401941        m_layerTreeHost->setRootLayer(rootLayer);
    19411942        m_layerTreeHost->setViewportSize(rootLayer->bounds());
     1943        ASSERT_TRUE(m_layerTreeHost->initializeLayerRendererIfNeeded());
    19421944        CCTextureUpdater updater;
    19431945        m_layerTreeHost->updateLayers(updater);
     
    20282030        m_layerTreeHost->setRootLayer(layers[0].get());
    20292031        m_layerTreeHost->setViewportSize(layers[0]->bounds());
     2032        ASSERT_TRUE(m_layerTreeHost->initializeLayerRendererIfNeeded());
    20302033        CCTextureUpdater updater;
    20312034        m_layerTreeHost->updateLayers(updater);
  • trunk/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp

    r120820 r120858  
    800800    FakeCCLayerTreeHostClient fakeCCLayerTreeHostClient;
    801801    OwnPtr<CCLayerTreeHost> ccLayerTreeHost = CCLayerTreeHost::create(&fakeCCLayerTreeHostClient, CCLayerTreeSettings());
     802    ASSERT_TRUE(ccLayerTreeHost->initializeLayerRendererIfNeeded());
    802803
    803804    // Create two 300 x 300 tiled layers.
     
    883884    FakeCCLayerTreeHostClient fakeCCLayerTreeHostClient;
    884885    OwnPtr<CCLayerTreeHost> ccLayerTreeHost = CCLayerTreeHost::create(&fakeCCLayerTreeHostClient, settings);
     886    ASSERT_TRUE(ccLayerTreeHost->initializeLayerRendererIfNeeded());
    885887
    886888    // Create one 500 x 300 tiled layer.
Note: See TracChangeset for help on using the changeset viewer.