Changeset 108886 in webkit


Ignore:
Timestamp:
Feb 24, 2012 8:09:52 PM (12 years ago)
Author:
jamesr@google.com
Message:

[chromium] Replace RefPtr with OwnPtr for CCLayerImpl tree structure
https://bugs.webkit.org/show_bug.cgi?id=78404

Patch by Tien-Ren Chen <trchen@chromium.org> on 2012-02-24
Reviewed by James Robinson.

Source/WebCore:

No new tests. Updated existing test to reflect changes.

  • platform/graphics/chromium/CanvasLayerChromium.cpp:

(WebCore::CanvasLayerChromium::createCCLayerImpl):

  • platform/graphics/chromium/CanvasLayerChromium.h:

(CanvasLayerChromium):

  • platform/graphics/chromium/LayerChromium.cpp:

(WebCore::LayerChromium::createCCLayerImpl):

  • platform/graphics/chromium/LayerChromium.h:

(LayerChromium):

  • platform/graphics/chromium/PluginLayerChromium.cpp:

(WebCore::PluginLayerChromium::createCCLayerImpl):

  • platform/graphics/chromium/PluginLayerChromium.h:

(PluginLayerChromium):

  • platform/graphics/chromium/SolidColorLayerChromium.cpp:

(WebCore::SolidColorLayerChromium::createCCLayerImpl):

  • platform/graphics/chromium/SolidColorLayerChromium.h:

(SolidColorLayerChromium):

  • platform/graphics/chromium/TiledLayerChromium.cpp:

(WebCore::TiledLayerChromium::createCCLayerImpl):

  • platform/graphics/chromium/TiledLayerChromium.h:

(TiledLayerChromium):

  • platform/graphics/chromium/TreeSynchronizer.cpp:

(WebCore::TreeSynchronizer::synchronizeTrees):
(WebCore::TreeSynchronizer::collectExistingCCLayerImplRecursive):
(WebCore):
(WebCore::TreeSynchronizer::reuseOrCreateCCLayerImpl):
(WebCore::TreeSynchronizer::synchronizeTreeRecursive):

  • platform/graphics/chromium/TreeSynchronizer.h:

(TreeSynchronizer):

  • platform/graphics/chromium/VideoLayerChromium.cpp:

(WebCore::VideoLayerChromium::createCCLayerImpl):

  • platform/graphics/chromium/VideoLayerChromium.h:

(VideoLayerChromium):

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

(WebCore::CCCanvasLayerImpl::create):

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

(WebCore::CCDamageTracker::updateDamageTrackingState):
(WebCore::CCDamageTracker::trackDamageFromActiveLayers):

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

(CCDamageTracker):

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

(WebCore::CCLayerImpl::CCLayerImpl):
(WebCore::CCLayerImpl::addChild):
(WebCore::sortLayers):
(WebCore::CCLayerImpl::setMaskLayer):
(WebCore::CCLayerImpl::setReplicaLayer):

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

(WebCore::CCLayerImpl::create):
(WebCore::CCLayerImpl::children):
(CCLayerImpl):
(WebCore):

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

(WebCore):
(WebCore::CCLayerIteratorActions::BackToFront::begin):
(WebCore::CCLayerIteratorActions::BackToFront::end):
(WebCore::CCLayerIteratorActions::BackToFront::next):
(WebCore::CCLayerIteratorActions::FrontToBack::begin):
(WebCore::CCLayerIteratorActions::FrontToBack::end):
(WebCore::CCLayerIteratorActions::FrontToBack::next):
(WebCore::CCLayerIteratorActions::FrontToBack::goToHighestInSubtree):

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

(WebCore):
(CCLayerIterator):
(WebCore::CCLayerIterator::begin):
(WebCore::CCLayerIterator::end):
(WebCore::CCLayerIterator::targetRenderSurfaceLayer):
(WebCore::CCLayerIterator::CCLayerIterator):
(WebCore::CCLayerIterator::getRawPtr):
(WebCore::CCLayerIterator::currentLayer):
(WebCore::CCLayerIterator::targetRenderSurfaceChildren):
(BackToFront):
(FrontToBack):

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

(WebCore::CCLayerSorter::createGraphNodes):

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

(CCLayerSorter):

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

(WebCore::CCLayerTreeHost::finishCommitOnImplThread):
(WebCore::CCLayerTreeHost::didBecomeInvisibleOnImplThread):
(WebCore::CCLayerTreeHost::reserveTextures):
(WebCore::CCLayerTreeHost::paintLayerContents):
(WebCore::CCLayerTreeHost::updateCompositorResources):

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

(WebCore):
(WebCore::calculateDrawTransformsAndVisibilityInternal):
(WebCore::walkLayersAndCalculateVisibleLayerRects):
(WebCore::CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility):

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

(CCLayerTreeHostCommon):

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

(WebCore::CCLayerTreeHostImpl::CCLayerTreeHostImpl):
(WebCore::CCLayerTreeHostImpl::trackDamageForAllSurfaces):
(WebCore::CCLayerTreeHostImpl::calculateRenderPasses):
(WebCore::CCLayerTreeHostImpl::drawLayers):
(WebCore::CCLayerTreeHostImpl::setRootLayer):

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

(CCLayerTreeHostImpl):
(WebCore::CCLayerTreeHostImpl::releaseRootLayer):
(WebCore::CCLayerTreeHostImpl::scrollLayer):

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

(WebCore::CCPluginLayerImpl::create):

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

(WebCore::CCRenderSurface::layerList):
(CCRenderSurface):

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

(WebCore::CCSolidColorLayerImpl::create):

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

(WebCore::CCTiledLayerImpl::create):

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

(WebCore::CCVideoLayerImpl::create):

Source/WebKit/chromium:

  • tests/CCDamageTrackerTest.cpp:

(WebKitTests::executeCalculateDrawTransformsAndVisibility):
(WebKitTests::emulateDrawingOneFrame):
(WebKitTests::createTestTreeWithOneSurface):
(WebKitTests::createTestTreeWithTwoSurfaces):
(WebKitTests::createAndSetUpTestTreeWithOneSurface):
(WebKitTests::createAndSetUpTestTreeWithTwoSurfaces):
(WebKitTests::TEST_F):

  • tests/CCLayerImplTest.cpp:

(WebCore::TEST):

  • tests/CCLayerIteratorTest.cpp:
  • tests/CCLayerSorterTest.cpp:

(WebCore::TEST):

  • tests/CCLayerTreeHostCommonTest.cpp:

(WebCore::TEST):

  • tests/CCLayerTreeHostImplTest.cpp:

(WebKit::CCLayerTreeHostImplTest::setupScrollAndContentsLayers):
(WebKit::TEST_F):
(WebKit::DidDrawCheckLayer::create):
(WebKit::BlendStateCheckLayer::create):

  • tests/CCRenderSurfaceTest.cpp:

(WebCore::TEST):

  • tests/CCSolidColorLayerImplTest.cpp:

(CCLayerTestCommon::TEST):

  • tests/CCTiledLayerImplTest.cpp:

(CCLayerTestCommon::createLayer):
(CCLayerTestCommon::TEST):
(CCLayerTestCommon::getQuads):

  • tests/Canvas2DLayerChromiumTest.cpp:

(WebCore::Canvas2DLayerChromiumTest::fullLifecycleTest):

  • tests/TiledLayerChromiumTest.cpp:

(WTF::TEST):

  • tests/TreeSynchronizerTest.cpp:

(WebKitTests::MockCCLayerImpl::create):
(WebKitTests::MockLayerChromium::createCCLayerImpl):
(WebKitTests::expectTreesAreIdentical):
(WebKitTests::TEST):

Location:
trunk/Source
Files:
47 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r108885 r108886  
     12012-02-24  Tien-Ren Chen  <trchen@chromium.org>
     2
     3        [chromium] Replace RefPtr with OwnPtr for CCLayerImpl tree structure
     4        https://bugs.webkit.org/show_bug.cgi?id=78404
     5
     6        Reviewed by James Robinson.
     7
     8        No new tests. Updated existing test to reflect changes.
     9
     10        * platform/graphics/chromium/CanvasLayerChromium.cpp:
     11        (WebCore::CanvasLayerChromium::createCCLayerImpl):
     12        * platform/graphics/chromium/CanvasLayerChromium.h:
     13        (CanvasLayerChromium):
     14        * platform/graphics/chromium/LayerChromium.cpp:
     15        (WebCore::LayerChromium::createCCLayerImpl):
     16        * platform/graphics/chromium/LayerChromium.h:
     17        (LayerChromium):
     18        * platform/graphics/chromium/PluginLayerChromium.cpp:
     19        (WebCore::PluginLayerChromium::createCCLayerImpl):
     20        * platform/graphics/chromium/PluginLayerChromium.h:
     21        (PluginLayerChromium):
     22        * platform/graphics/chromium/SolidColorLayerChromium.cpp:
     23        (WebCore::SolidColorLayerChromium::createCCLayerImpl):
     24        * platform/graphics/chromium/SolidColorLayerChromium.h:
     25        (SolidColorLayerChromium):
     26        * platform/graphics/chromium/TiledLayerChromium.cpp:
     27        (WebCore::TiledLayerChromium::createCCLayerImpl):
     28        * platform/graphics/chromium/TiledLayerChromium.h:
     29        (TiledLayerChromium):
     30        * platform/graphics/chromium/TreeSynchronizer.cpp:
     31        (WebCore::TreeSynchronizer::synchronizeTrees):
     32        (WebCore::TreeSynchronizer::collectExistingCCLayerImplRecursive):
     33        (WebCore):
     34        (WebCore::TreeSynchronizer::reuseOrCreateCCLayerImpl):
     35        (WebCore::TreeSynchronizer::synchronizeTreeRecursive):
     36        * platform/graphics/chromium/TreeSynchronizer.h:
     37        (TreeSynchronizer):
     38        * platform/graphics/chromium/VideoLayerChromium.cpp:
     39        (WebCore::VideoLayerChromium::createCCLayerImpl):
     40        * platform/graphics/chromium/VideoLayerChromium.h:
     41        (VideoLayerChromium):
     42        * platform/graphics/chromium/cc/CCCanvasLayerImpl.h:
     43        (WebCore::CCCanvasLayerImpl::create):
     44        * platform/graphics/chromium/cc/CCDamageTracker.cpp:
     45        (WebCore::CCDamageTracker::updateDamageTrackingState):
     46        (WebCore::CCDamageTracker::trackDamageFromActiveLayers):
     47        * platform/graphics/chromium/cc/CCDamageTracker.h:
     48        (CCDamageTracker):
     49        * platform/graphics/chromium/cc/CCLayerImpl.cpp:
     50        (WebCore::CCLayerImpl::CCLayerImpl):
     51        (WebCore::CCLayerImpl::addChild):
     52        (WebCore::sortLayers):
     53        (WebCore::CCLayerImpl::setMaskLayer):
     54        (WebCore::CCLayerImpl::setReplicaLayer):
     55        * platform/graphics/chromium/cc/CCLayerImpl.h:
     56        (WebCore::CCLayerImpl::create):
     57        (WebCore::CCLayerImpl::children):
     58        (CCLayerImpl):
     59        (WebCore):
     60        * platform/graphics/chromium/cc/CCLayerIterator.cpp:
     61        (WebCore):
     62        (WebCore::CCLayerIteratorActions::BackToFront::begin):
     63        (WebCore::CCLayerIteratorActions::BackToFront::end):
     64        (WebCore::CCLayerIteratorActions::BackToFront::next):
     65        (WebCore::CCLayerIteratorActions::FrontToBack::begin):
     66        (WebCore::CCLayerIteratorActions::FrontToBack::end):
     67        (WebCore::CCLayerIteratorActions::FrontToBack::next):
     68        (WebCore::CCLayerIteratorActions::FrontToBack::goToHighestInSubtree):
     69        * platform/graphics/chromium/cc/CCLayerIterator.h:
     70        (WebCore):
     71        (CCLayerIterator):
     72        (WebCore::CCLayerIterator::begin):
     73        (WebCore::CCLayerIterator::end):
     74        (WebCore::CCLayerIterator::targetRenderSurfaceLayer):
     75        (WebCore::CCLayerIterator::CCLayerIterator):
     76        (WebCore::CCLayerIterator::getRawPtr):
     77        (WebCore::CCLayerIterator::currentLayer):
     78        (WebCore::CCLayerIterator::targetRenderSurfaceChildren):
     79        (BackToFront):
     80        (FrontToBack):
     81        * platform/graphics/chromium/cc/CCLayerSorter.cpp:
     82        (WebCore::CCLayerSorter::createGraphNodes):
     83        * platform/graphics/chromium/cc/CCLayerSorter.h:
     84        (CCLayerSorter):
     85        * platform/graphics/chromium/cc/CCLayerTreeHost.cpp:
     86        (WebCore::CCLayerTreeHost::finishCommitOnImplThread):
     87        (WebCore::CCLayerTreeHost::didBecomeInvisibleOnImplThread):
     88        (WebCore::CCLayerTreeHost::reserveTextures):
     89        (WebCore::CCLayerTreeHost::paintLayerContents):
     90        (WebCore::CCLayerTreeHost::updateCompositorResources):
     91        * platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp:
     92        (WebCore):
     93        (WebCore::calculateDrawTransformsAndVisibilityInternal):
     94        (WebCore::walkLayersAndCalculateVisibleLayerRects):
     95        (WebCore::CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility):
     96        * platform/graphics/chromium/cc/CCLayerTreeHostCommon.h:
     97        (CCLayerTreeHostCommon):
     98        * platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp:
     99        (WebCore::CCLayerTreeHostImpl::CCLayerTreeHostImpl):
     100        (WebCore::CCLayerTreeHostImpl::trackDamageForAllSurfaces):
     101        (WebCore::CCLayerTreeHostImpl::calculateRenderPasses):
     102        (WebCore::CCLayerTreeHostImpl::drawLayers):
     103        (WebCore::CCLayerTreeHostImpl::setRootLayer):
     104        * platform/graphics/chromium/cc/CCLayerTreeHostImpl.h:
     105        (CCLayerTreeHostImpl):
     106        (WebCore::CCLayerTreeHostImpl::releaseRootLayer):
     107        (WebCore::CCLayerTreeHostImpl::scrollLayer):
     108        * platform/graphics/chromium/cc/CCPluginLayerImpl.h:
     109        (WebCore::CCPluginLayerImpl::create):
     110        * platform/graphics/chromium/cc/CCRenderSurface.h:
     111        (WebCore::CCRenderSurface::layerList):
     112        (CCRenderSurface):
     113        * platform/graphics/chromium/cc/CCSolidColorLayerImpl.h:
     114        (WebCore::CCSolidColorLayerImpl::create):
     115        * platform/graphics/chromium/cc/CCTiledLayerImpl.h:
     116        (WebCore::CCTiledLayerImpl::create):
     117        * platform/graphics/chromium/cc/CCVideoLayerImpl.h:
     118        (WebCore::CCVideoLayerImpl::create):
     119
    11202012-02-24  Andreas Kling  <awesomekling@apple.com>
    2121
  • trunk/Source/WebCore/platform/graphics/chromium/CanvasLayerChromium.cpp

    r105460 r108886  
    4646}
    4747
    48 PassRefPtr<CCLayerImpl> CanvasLayerChromium::createCCLayerImpl()
     48PassOwnPtr<CCLayerImpl> CanvasLayerChromium::createCCLayerImpl()
    4949{
    5050    return CCCanvasLayerImpl::create(m_layerId);
  • trunk/Source/WebCore/platform/graphics/chromium/CanvasLayerChromium.h

    r105460 r108886  
    4242class CanvasLayerChromium : public LayerChromium {
    4343public:
    44     virtual PassRefPtr<CCLayerImpl> createCCLayerImpl();
     44    virtual PassOwnPtr<CCLayerImpl> createCCLayerImpl();
    4545
    4646protected:
  • trunk/Source/WebCore/platform/graphics/chromium/LayerChromium.cpp

    r108880 r108886  
    528528}
    529529
    530 PassRefPtr<CCLayerImpl> LayerChromium::createCCLayerImpl()
     530PassOwnPtr<CCLayerImpl> LayerChromium::createCCLayerImpl()
    531531{
    532532    return CCLayerImpl::create(m_layerId);
  • trunk/Source/WebCore/platform/graphics/chromium/LayerChromium.h

    r108880 r108886  
    4545
    4646#include <wtf/OwnPtr.h>
     47#include <wtf/PassOwnPtr.h>
    4748#include <wtf/PassRefPtr.h>
    4849#include <wtf/RefCounted.h>
     
    257258
    258259    // Constructs a CCLayerImpl of the correct runtime type for this LayerChromium type.
    259     virtual PassRefPtr<CCLayerImpl> createCCLayerImpl();
     260    virtual PassOwnPtr<CCLayerImpl> createCCLayerImpl();
    260261    int m_layerId;
    261262
  • trunk/Source/WebCore/platform/graphics/chromium/PluginLayerChromium.cpp

    r105460 r108886  
    6464}
    6565
    66 PassRefPtr<CCLayerImpl> PluginLayerChromium::createCCLayerImpl()
     66PassOwnPtr<CCLayerImpl> PluginLayerChromium::createCCLayerImpl()
    6767{
    6868    return CCPluginLayerImpl::create(m_layerId);
  • trunk/Source/WebCore/platform/graphics/chromium/PluginLayerChromium.h

    r105460 r108886  
    4040    virtual void updateCompositorResources(GraphicsContext3D*, CCTextureUpdater&);
    4141
    42     virtual PassRefPtr<CCLayerImpl> createCCLayerImpl();
     42    virtual PassOwnPtr<CCLayerImpl> createCCLayerImpl();
    4343
    4444    // Code path for plugins which supply their own texture ID.
  • trunk/Source/WebCore/platform/graphics/chromium/SolidColorLayerChromium.cpp

    r105634 r108886  
    3434namespace WebCore {
    3535
    36 PassRefPtr<CCLayerImpl> SolidColorLayerChromium::createCCLayerImpl()
     36PassOwnPtr<CCLayerImpl> SolidColorLayerChromium::createCCLayerImpl()
    3737{
    3838    return CCSolidColorLayerImpl::create(id());
  • trunk/Source/WebCore/platform/graphics/chromium/SolidColorLayerChromium.h

    r105634 r108886  
    3939class SolidColorLayerChromium : public LayerChromium {
    4040public:
    41     virtual PassRefPtr<CCLayerImpl> createCCLayerImpl();
     41    virtual PassOwnPtr<CCLayerImpl> createCCLayerImpl();
    4242    static PassRefPtr<SolidColorLayerChromium> create();
    4343
  • trunk/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.cpp

    r108431 r108886  
    9898}
    9999
    100 PassRefPtr<CCLayerImpl> TiledLayerChromium::createCCLayerImpl()
     100PassOwnPtr<CCLayerImpl> TiledLayerChromium::createCCLayerImpl()
    101101{
    102102    return CCTiledLayerImpl::create(id());
  • trunk/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.h

    r107177 r108886  
    103103
    104104private:
    105     virtual PassRefPtr<CCLayerImpl> createCCLayerImpl();
     105    virtual PassOwnPtr<CCLayerImpl> createCCLayerImpl();
    106106
    107107    void createTilerIfNeeded();
  • trunk/Source/WebCore/platform/graphics/chromium/TreeSynchronizer.cpp

    r95901 r108886  
    3434namespace WebCore {
    3535
    36 void TreeSynchronizer::addCCLayerImplsToMapRecursive(CCLayerImplMap& map, CCLayerImpl* ccLayerImpl)
     36PassOwnPtr<CCLayerImpl> TreeSynchronizer::synchronizeTrees(LayerChromium* layerChromiumRoot, PassOwnPtr<CCLayerImpl> oldCCLayerImplRoot)
    3737{
    38     map.set(ccLayerImpl->id(), ccLayerImpl);
     38    CCLayerImplMap map;
     39    collectExistingCCLayerImplRecursive(map, oldCCLayerImplRoot);
    3940
    40     const Vector<RefPtr<CCLayerImpl> >& children = ccLayerImpl->children();
    41     for (size_t i = 0; i < children.size(); ++i)
    42         addCCLayerImplsToMapRecursive(map, children[i].get());
    43 
    44     if (CCLayerImpl* maskLayer = ccLayerImpl->maskLayer())
    45         addCCLayerImplsToMapRecursive(map, maskLayer);
    46 
    47     if (CCLayerImpl* replicaLayer = ccLayerImpl->replicaLayer())
    48         addCCLayerImplsToMapRecursive(map, replicaLayer);
     41    return synchronizeTreeRecursive(map, layerChromiumRoot);
    4942}
    5043
    51 PassRefPtr<CCLayerImpl> TreeSynchronizer::synchronizeTreeRecursive(LayerChromium* layer, CCLayerImplMap& map)
     44void TreeSynchronizer::collectExistingCCLayerImplRecursive(CCLayerImplMap& map, PassOwnPtr<CCLayerImpl> popCCLayerImpl)
    5245{
    53     RefPtr<CCLayerImpl> ccLayerImpl;
    54     CCLayerImplMap::iterator it = map.find(layer->id());
    55     if (it != map.end()) {
    56         ccLayerImpl = it->second; // We already have an entry for this, we just need to reparent it.
    57         ccLayerImpl->clearChildList();
    58     } else {
    59         ccLayerImpl = layer->createCCLayerImpl();
    60         map.set(layer->id(), ccLayerImpl); // Add it to the map so other layers referencing this one can pick it up.
    61     }
     46    OwnPtr<CCLayerImpl> ccLayerImpl = popCCLayerImpl;
    6247
     48    if (!ccLayerImpl)
     49        return;
     50
     51    Vector<OwnPtr<CCLayerImpl> >& children = ccLayerImpl->m_children;
     52    for (size_t i = 0; i < children.size(); ++i)
     53        collectExistingCCLayerImplRecursive(map, children[i].release());
     54
     55    collectExistingCCLayerImplRecursive(map, ccLayerImpl->m_maskLayer.release());
     56    collectExistingCCLayerImplRecursive(map, ccLayerImpl->m_replicaLayer.release());
     57
     58    int id = ccLayerImpl->id();
     59    map.set(id, ccLayerImpl.release());
     60}
     61
     62PassOwnPtr<CCLayerImpl> TreeSynchronizer::reuseOrCreateCCLayerImpl(CCLayerImplMap& map, LayerChromium* layer)
     63{
     64    OwnPtr<CCLayerImpl> ccLayerImpl = map.take(layer->id());
     65
     66    if (!ccLayerImpl)
     67        return layer->createCCLayerImpl();
     68
     69    return ccLayerImpl.release();
     70}
     71
     72PassOwnPtr<CCLayerImpl> TreeSynchronizer::synchronizeTreeRecursive(CCLayerImplMap& map, LayerChromium* layer)
     73{
     74    if (!layer)
     75        return nullptr;
     76
     77    OwnPtr<CCLayerImpl> ccLayerImpl = reuseOrCreateCCLayerImpl(map, layer);
     78
     79    ccLayerImpl->clearChildList();
    6380    const Vector<RefPtr<LayerChromium> >& children = layer->children();
    6481    for (size_t i = 0; i < children.size(); ++i)
    65         ccLayerImpl->addChild(synchronizeTreeRecursive(children[i].get(), map));
     82        ccLayerImpl->addChild(synchronizeTreeRecursive(map, children[i].get()));
    6683
    67     if (LayerChromium* maskLayer = layer->maskLayer())
    68         ccLayerImpl->setMaskLayer(synchronizeTreeRecursive(maskLayer, map));
    69     else
    70         ccLayerImpl->setMaskLayer(0);
    71 
    72     if (LayerChromium* replicaLayer = layer->replicaLayer())
    73         ccLayerImpl->setReplicaLayer(synchronizeTreeRecursive(replicaLayer, map));
    74     else
    75         ccLayerImpl->setReplicaLayer(0);
     84    ccLayerImpl->setMaskLayer(synchronizeTreeRecursive(map, layer->maskLayer()));
     85    ccLayerImpl->setReplicaLayer(synchronizeTreeRecursive(map, layer->replicaLayer()));
    7686
    7787    layer->pushPropertiesTo(ccLayerImpl.get());
     
    7989}
    8090
    81 PassRefPtr<CCLayerImpl> TreeSynchronizer::synchronizeTrees(LayerChromium* layerChromiumRoot, PassRefPtr<CCLayerImpl> prpOldCCLayerImplRoot)
    82 {
    83     RefPtr<CCLayerImpl> oldCCLayerImplRoot = prpOldCCLayerImplRoot;
    84     // Build a map from layer IDs to CCLayerImpls so we can reuse layers from the old tree.
    85     CCLayerImplMap map;
    86     if (oldCCLayerImplRoot)
    87         addCCLayerImplsToMapRecursive(map, oldCCLayerImplRoot.get());
    88 
    89     // Recursively build the new layer tree.
    90     RefPtr<CCLayerImpl> newCCLayerImplRoot = synchronizeTreeRecursive(layerChromiumRoot, map);
    91 
    92     return newCCLayerImplRoot.release();
    93 }
    94 
    9591} // namespace WebCore
  • trunk/Source/WebCore/platform/graphics/chromium/TreeSynchronizer.h

    r95901 r108886  
    2929#include <wtf/HashMap.h>
    3030#include <wtf/Noncopyable.h>
    31 #include <wtf/PassRefPtr.h>
     31#include <wtf/OwnPtr.h>
     32#include <wtf/PassOwnPtr.h>
    3233
    3334namespace WebCore {
     
    4142    // Accepts a LayerChromium tree and returns a reference to a CCLayerImpl tree that duplicates the structure
    4243    // of the LayerChromium tree, reusing the CCLayerImpls in the tree provided by oldCCLayerImplRoot if possible.
    43     static PassRefPtr<CCLayerImpl> synchronizeTrees(LayerChromium* layerRoot, PassRefPtr<CCLayerImpl> oldCCLayerImplRoot);
     44    static PassOwnPtr<CCLayerImpl> synchronizeTrees(LayerChromium* layerRoot, PassOwnPtr<CCLayerImpl> oldCCLayerImplRoot);
    4445
    4546private:
    4647    TreeSynchronizer(); // Not instantiable.
    4748
    48     typedef HashMap<int, RefPtr<CCLayerImpl> > CCLayerImplMap;
     49    typedef HashMap<int, OwnPtr<CCLayerImpl> > CCLayerImplMap;
    4950
    5051    // Declared as static member functions so they can access functions on LayerChromium as a friend class.
    51     static void addCCLayerImplsToMapRecursive(CCLayerImplMap&, CCLayerImpl*);
    52     static PassRefPtr<CCLayerImpl> synchronizeTreeRecursive(LayerChromium*, CCLayerImplMap&);
     52    static PassOwnPtr<CCLayerImpl> reuseOrCreateCCLayerImpl(CCLayerImplMap&, LayerChromium*);
     53    static void collectExistingCCLayerImplRecursive(CCLayerImplMap&, PassOwnPtr<CCLayerImpl>);
     54    static PassOwnPtr<CCLayerImpl> synchronizeTreeRecursive(CCLayerImplMap&, LayerChromium*);
    5355};
    5456
  • trunk/Source/WebCore/platform/graphics/chromium/VideoLayerChromium.cpp

    r108703 r108886  
    5353}
    5454
    55 PassRefPtr<CCLayerImpl> VideoLayerChromium::createCCLayerImpl()
     55PassOwnPtr<CCLayerImpl> VideoLayerChromium::createCCLayerImpl()
    5656{
    5757    return CCVideoLayerImpl::create(m_layerId, m_provider);
  • trunk/Source/WebCore/platform/graphics/chromium/VideoLayerChromium.h

    r108703 r108886  
    4949    virtual ~VideoLayerChromium();
    5050
    51     virtual PassRefPtr<CCLayerImpl> createCCLayerImpl();
     51    virtual PassOwnPtr<CCLayerImpl> createCCLayerImpl();
    5252
    5353    void contentChanged();
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCCanvasLayerImpl.h

    r105529 r108886  
    3535class CCCanvasLayerImpl : public CCLayerImpl {
    3636public:
    37     static PassRefPtr<CCCanvasLayerImpl> create(int id)
     37    static PassOwnPtr<CCCanvasLayerImpl> create(int id)
    3838    {
    39         return adoptRef(new CCCanvasLayerImpl(id));
     39        return adoptPtr(new CCCanvasLayerImpl(id));
    4040    }
    4141    virtual ~CCCanvasLayerImpl();
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCDamageTracker.cpp

    r107130 r108886  
    5757}
    5858
    59 void CCDamageTracker::updateDamageTrackingState(const Vector<RefPtr<CCLayerImpl> >& layerList, int targetSurfaceLayerID, CCLayerImpl* targetSurfaceMaskLayer)
     59void CCDamageTracker::updateDamageTrackingState(const Vector<CCLayerImpl*>& layerList, int targetSurfaceLayerID, CCLayerImpl* targetSurfaceMaskLayer)
    6060{
    6161    //
     
    131131    // If the target surface already knows its entire region is damaged, we can return early.
    132132    // FIXME: this should go away, or will be cleaner, after refactoring into RenderPass/RenderSchedule.
    133     CCLayerImpl* layer = layerList[0].get();
     133    CCLayerImpl* layer = layerList[0];
    134134    CCRenderSurface* targetSurface = layer->targetRenderSurface();
    135135
     
    162162}
    163163
    164 FloatRect CCDamageTracker::trackDamageFromActiveLayers(const Vector<RefPtr<CCLayerImpl> >& layerList, int targetSurfaceLayerID)
     164FloatRect CCDamageTracker::trackDamageFromActiveLayers(const Vector<CCLayerImpl*>& layerList, int targetSurfaceLayerID)
    165165{
    166166    FloatRect damageRect = FloatRect();
    167167
    168168    for (unsigned layerIndex = 0; layerIndex < layerList.size(); ++layerIndex) {
    169         CCLayerImpl* layer = layerList[layerIndex].get();
     169        CCLayerImpl* layer = layerList[layerIndex];
    170170
    171171        if (CCLayerTreeHostCommon::renderSurfaceContributesToTarget<CCLayerImpl>(layer, targetSurfaceLayerID))
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCDamageTracker.h

    r107130 r108886  
    4545
    4646    void forceFullDamageNextUpdate() { m_forceFullDamageNextUpdate = true; }
    47     void updateDamageTrackingState(const Vector<RefPtr<CCLayerImpl> >& layerList, int targetSurfaceLayerID, CCLayerImpl* targetSurfaceMaskLayer);
     47    void updateDamageTrackingState(const Vector<CCLayerImpl*>& layerList, int targetSurfaceLayerID, CCLayerImpl* targetSurfaceMaskLayer);
    4848    const FloatRect& currentDamageRect() { return m_currentDamageRect; }
    4949
     
    5151    CCDamageTracker();
    5252
    53     FloatRect trackDamageFromActiveLayers(const Vector<RefPtr<CCLayerImpl> >& layerList, int targetSurfaceLayerID);
     53    FloatRect trackDamageFromActiveLayers(const Vector<CCLayerImpl*>& layerList, int targetSurfaceLayerID);
    5454    FloatRect trackDamageFromSurfaceMask(CCLayerImpl* targetSurfaceMaskLayer);
    5555    FloatRect trackDamageFromLeftoverRects();
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.cpp

    r108698 r108886  
    4343CCLayerImpl::CCLayerImpl(int id)
    4444    : m_parent(0)
     45    , m_maskLayerId(-1)
     46    , m_replicaLayerId(-1)
    4547    , m_layerId(id)
    4648    , m_anchorPoint(0.5, 0.5)
     
    7476}
    7577
    76 void CCLayerImpl::addChild(PassRefPtr<CCLayerImpl> child)
     78void CCLayerImpl::addChild(PassOwnPtr<CCLayerImpl> child)
    7779{
    7880    child->setParent(this);
     
    8486    if (!m_parent)
    8587        return;
    86     for (size_t i = 0; i < m_parent->m_children.size(); ++i) {
    87         if (m_parent->m_children[i].get() == this) {
    88             m_parent->m_children.remove(i);
    89             break;
     88
     89    CCLayerImpl* parent = m_parent;
     90    m_parent = 0;
     91
     92    for (size_t i = 0; i < parent->m_children.size(); ++i) {
     93        if (parent->m_children[i].get() == this) {
     94            parent->m_children.remove(i);
     95            return;
    9096        }
    9197    }
    92     m_parent = 0;
    9398}
    9499
     
    245250}
    246251
    247 void sortLayers(Vector<RefPtr<CCLayerImpl> >::iterator first, Vector<RefPtr<CCLayerImpl> >::iterator end, CCLayerSorter* layerSorter)
     252void sortLayers(Vector<CCLayerImpl*>::iterator first, Vector<CCLayerImpl*>::iterator end, CCLayerSorter* layerSorter)
    248253{
    249254    TRACE_EVENT("LayerRendererChromium::sortLayers", 0, 0);
     
    320325}
    321326
    322 void CCLayerImpl::setMaskLayer(PassRefPtr<CCLayerImpl> maskLayer)
    323 {
    324     if (m_maskLayer == maskLayer)
    325         return;
    326 
     327void CCLayerImpl::setMaskLayer(PassOwnPtr<CCLayerImpl> maskLayer)
     328{
    327329    m_maskLayer = maskLayer;
    328     noteLayerPropertyChangedForSubtree();
    329 }
    330 
    331 void CCLayerImpl::setReplicaLayer(PassRefPtr<CCLayerImpl> replicaLayer)
    332 {
    333     if (m_replicaLayer == replicaLayer)
    334         return;
    335 
     330
     331    int newLayerId = m_maskLayer ? m_maskLayer->id() : -1;
     332    if (newLayerId == m_maskLayerId)
     333        return;
     334
     335    m_maskLayerId = newLayerId;
     336    noteLayerPropertyChangedForSubtree();
     337}
     338
     339void CCLayerImpl::setReplicaLayer(PassOwnPtr<CCLayerImpl> replicaLayer)
     340{
    336341    m_replicaLayer = replicaLayer;
     342
     343    int newLayerId = m_replicaLayer ? m_replicaLayer->id() : -1;
     344    if (newLayerId == m_replicaLayerId)
     345        return;
     346
     347    m_replicaLayerId = newLayerId;
    337348    noteLayerPropertyChangedForSubtree();
    338349}
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.h

    r108698 r108886  
    4747class LayerRendererChromium;
    4848
    49 class CCLayerImpl : public RefCounted<CCLayerImpl>, public CCLayerAnimationControllerImplClient {
     49class CCLayerImpl : public CCLayerAnimationControllerImplClient {
    5050public:
    51     static PassRefPtr<CCLayerImpl> create(int id)
     51    static PassOwnPtr<CCLayerImpl> create(int id)
    5252    {
    53         return adoptRef(new CCLayerImpl(id));
     53        return adoptPtr(new CCLayerImpl(id));
    5454    }
    5555
     
    6666    // Tree structure.
    6767    CCLayerImpl* parent() const { return m_parent; }
    68     const Vector<RefPtr<CCLayerImpl> >& children() const { return m_children; }
    69     void addChild(PassRefPtr<CCLayerImpl>);
     68    const Vector<OwnPtr<CCLayerImpl> >& children() const { return m_children; }
     69    void addChild(PassOwnPtr<CCLayerImpl>);
    7070    void removeFromParent();
    7171    void removeAllChildren();
    7272
    73     void setMaskLayer(PassRefPtr<CCLayerImpl>);
     73    void setMaskLayer(PassOwnPtr<CCLayerImpl>);
    7474    CCLayerImpl* maskLayer() const { return m_maskLayer.get(); }
    7575
    76     void setReplicaLayer(PassRefPtr<CCLayerImpl>);
     76    void setReplicaLayer(PassOwnPtr<CCLayerImpl>);
    7777    CCLayerImpl* replicaLayer() const { return m_replicaLayer.get(); }
    7878
     
    237237    // Properties internal to CCLayerImpl
    238238    CCLayerImpl* m_parent;
    239     Vector<RefPtr<CCLayerImpl> > m_children;
    240     RefPtr<CCLayerImpl> m_maskLayer;
    241     RefPtr<CCLayerImpl> m_replicaLayer;
     239    Vector<OwnPtr<CCLayerImpl> > m_children;
     240    // m_maskLayer can be temporarily stolen during tree sync, we need this ID to confirm newly assigned layer is still the previous one
     241    int m_maskLayerId;
     242    OwnPtr<CCLayerImpl> m_maskLayer;
     243    int m_replicaLayerId; // ditto
     244    OwnPtr<CCLayerImpl> m_replicaLayer;
    242245    int m_layerId;
    243246
     
    325328};
    326329
    327 void sortLayers(Vector<RefPtr<CCLayerImpl> >::iterator first, Vector<RefPtr<CCLayerImpl> >::iterator end, CCLayerSorter*);
     330void sortLayers(Vector<CCLayerImpl*>::iterator first, Vector<CCLayerImpl*>::iterator end, CCLayerSorter*);
    328331
    329332}
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerIterator.cpp

    r108678 r108886  
    3636namespace WebCore {
    3737
    38 template <typename LayerType, typename RenderSurfaceType, typename ActionType>
    39 void CCLayerIteratorActions::BackToFront::begin(CCLayerIterator<LayerType, RenderSurfaceType, ActionType>& it)
     38template <typename LayerType, typename LayerList, typename RenderSurfaceType, typename ActionType>
     39void CCLayerIteratorActions::BackToFront::begin(CCLayerIterator<LayerType, LayerList, RenderSurfaceType, ActionType>& it)
    4040{
    4141    it.m_targetRenderSurfaceLayerIndex = 0;
     
    4545}
    4646
    47 template <typename LayerType, typename RenderSurfaceType, typename ActionType>
    48 void CCLayerIteratorActions::BackToFront::end(CCLayerIterator<LayerType, RenderSurfaceType, ActionType>& it)
     47template <typename LayerType, typename LayerList, typename RenderSurfaceType, typename ActionType>
     48void CCLayerIteratorActions::BackToFront::end(CCLayerIterator<LayerType, LayerList, RenderSurfaceType, ActionType>& it)
    4949{
    5050    it.m_targetRenderSurfaceLayerIndex = CCLayerIteratorValue::InvalidTargetRenderSurfaceLayerIndex;
     
    5252}
    5353
    54 template <typename LayerType, typename RenderSurfaceType, typename ActionType>
    55 void CCLayerIteratorActions::BackToFront::next(CCLayerIterator<LayerType, RenderSurfaceType, ActionType>& it)
     54template <typename LayerType, typename LayerList, typename RenderSurfaceType, typename ActionType>
     55void CCLayerIteratorActions::BackToFront::next(CCLayerIterator<LayerType, LayerList, RenderSurfaceType, ActionType>& it)
    5656{
    5757    // If the current layer has a RS, move to its layer list. Otherwise, visit the next layer in the current RS layer list.
     
    8686}
    8787
    88 template <typename LayerType, typename RenderSurfaceType, typename ActionType>
    89 void CCLayerIteratorActions::FrontToBack::begin(CCLayerIterator<LayerType, RenderSurfaceType, ActionType>& it)
     88template <typename LayerType, typename LayerList, typename RenderSurfaceType, typename ActionType>
     89void CCLayerIteratorActions::FrontToBack::begin(CCLayerIterator<LayerType, LayerList, RenderSurfaceType, ActionType>& it)
    9090{
    9191    it.m_targetRenderSurfaceLayerIndex = 0;
     
    9494}
    9595
    96 template <typename LayerType, typename RenderSurfaceType, typename ActionType>
    97 void CCLayerIteratorActions::FrontToBack::end(CCLayerIterator<LayerType, RenderSurfaceType, ActionType>& it)
     96template <typename LayerType, typename LayerList, typename RenderSurfaceType, typename ActionType>
     97void CCLayerIteratorActions::FrontToBack::end(CCLayerIterator<LayerType, LayerList, RenderSurfaceType, ActionType>& it)
    9898{
    9999    it.m_targetRenderSurfaceLayerIndex = CCLayerIteratorValue::InvalidTargetRenderSurfaceLayerIndex;
     
    101101}
    102102
    103 template <typename LayerType, typename RenderSurfaceType, typename ActionType>
    104 void CCLayerIteratorActions::FrontToBack::next(CCLayerIterator<LayerType, RenderSurfaceType, ActionType>& it)
     103template <typename LayerType, typename LayerList, typename RenderSurfaceType, typename ActionType>
     104void CCLayerIteratorActions::FrontToBack::next(CCLayerIterator<LayerType, LayerList, RenderSurfaceType, ActionType>& it)
    105105{
    106106    // Moves to the previous layer in the current RS layer list. Then we check if the
     
    129129}
    130130
    131 template <typename LayerType, typename RenderSurfaceType, typename ActionType>
    132 void CCLayerIteratorActions::FrontToBack::goToHighestInSubtree(CCLayerIterator<LayerType, RenderSurfaceType, ActionType>& it)
     131template <typename LayerType, typename LayerList, typename RenderSurfaceType, typename ActionType>
     132void CCLayerIteratorActions::FrontToBack::goToHighestInSubtree(CCLayerIterator<LayerType, LayerList, RenderSurfaceType, ActionType>& it)
    133133{
    134134    if (it.currentLayerRepresentsTargetRenderSurface())
     
    148148
    149149// Declare each of the above functions for LayerChromium and CCLayerImpl classes so that they are linked.
    150 template void CCLayerIteratorActions::BackToFront::begin(CCLayerIterator<LayerChromium, RenderSurfaceChromium, BackToFront> &);
    151 template void CCLayerIteratorActions::BackToFront::end(CCLayerIterator<LayerChromium, RenderSurfaceChromium, BackToFront>&);
    152 template void CCLayerIteratorActions::BackToFront::next(CCLayerIterator<LayerChromium, RenderSurfaceChromium, BackToFront>&);
     150template void CCLayerIteratorActions::BackToFront::begin(CCLayerIterator<LayerChromium, Vector<RefPtr<LayerChromium> >, RenderSurfaceChromium, BackToFront> &);
     151template void CCLayerIteratorActions::BackToFront::end(CCLayerIterator<LayerChromium, Vector<RefPtr<LayerChromium> >, RenderSurfaceChromium, BackToFront>&);
     152template void CCLayerIteratorActions::BackToFront::next(CCLayerIterator<LayerChromium, Vector<RefPtr<LayerChromium> >, RenderSurfaceChromium, BackToFront>&);
    153153
    154 template void CCLayerIteratorActions::BackToFront::begin(CCLayerIterator<CCLayerImpl, CCRenderSurface, BackToFront>&);
    155 template void CCLayerIteratorActions::BackToFront::end(CCLayerIterator<CCLayerImpl, CCRenderSurface, BackToFront>&);
    156 template void CCLayerIteratorActions::BackToFront::next(CCLayerIterator<CCLayerImpl, CCRenderSurface, BackToFront>&);
     154template void CCLayerIteratorActions::BackToFront::begin(CCLayerIterator<CCLayerImpl, Vector<CCLayerImpl*>, CCRenderSurface, BackToFront>&);
     155template void CCLayerIteratorActions::BackToFront::end(CCLayerIterator<CCLayerImpl, Vector<CCLayerImpl*>, CCRenderSurface, BackToFront>&);
     156template void CCLayerIteratorActions::BackToFront::next(CCLayerIterator<CCLayerImpl, Vector<CCLayerImpl*>, CCRenderSurface, BackToFront>&);
    157157
    158 template void CCLayerIteratorActions::FrontToBack::next(CCLayerIterator<LayerChromium, RenderSurfaceChromium, FrontToBack>&);
    159 template void CCLayerIteratorActions::FrontToBack::end(CCLayerIterator<LayerChromium, RenderSurfaceChromium, FrontToBack>&);
    160 template void CCLayerIteratorActions::FrontToBack::begin(CCLayerIterator<LayerChromium, RenderSurfaceChromium, FrontToBack>&);
    161 template void CCLayerIteratorActions::FrontToBack::goToHighestInSubtree(CCLayerIterator<LayerChromium, RenderSurfaceChromium, FrontToBack>&);
     158template void CCLayerIteratorActions::FrontToBack::next(CCLayerIterator<LayerChromium, Vector<RefPtr<LayerChromium> >, RenderSurfaceChromium, FrontToBack>&);
     159template void CCLayerIteratorActions::FrontToBack::end(CCLayerIterator<LayerChromium, Vector<RefPtr<LayerChromium> >, RenderSurfaceChromium, FrontToBack>&);
     160template void CCLayerIteratorActions::FrontToBack::begin(CCLayerIterator<LayerChromium, Vector<RefPtr<LayerChromium> >, RenderSurfaceChromium, FrontToBack>&);
     161template void CCLayerIteratorActions::FrontToBack::goToHighestInSubtree(CCLayerIterator<LayerChromium, Vector<RefPtr<LayerChromium> >, RenderSurfaceChromium, FrontToBack>&);
    162162
    163 template void CCLayerIteratorActions::FrontToBack::next(CCLayerIterator<CCLayerImpl, CCRenderSurface, FrontToBack>&);
    164 template void CCLayerIteratorActions::FrontToBack::end(CCLayerIterator<CCLayerImpl, CCRenderSurface, FrontToBack>&);
    165 template void CCLayerIteratorActions::FrontToBack::begin(CCLayerIterator<CCLayerImpl, CCRenderSurface, FrontToBack>&);
    166 template void CCLayerIteratorActions::FrontToBack::goToHighestInSubtree(CCLayerIterator<CCLayerImpl, CCRenderSurface, FrontToBack>&);
     163template void CCLayerIteratorActions::FrontToBack::next(CCLayerIterator<CCLayerImpl, Vector<CCLayerImpl*>, CCRenderSurface, FrontToBack>&);
     164template void CCLayerIteratorActions::FrontToBack::end(CCLayerIterator<CCLayerImpl, Vector<CCLayerImpl*>, CCRenderSurface, FrontToBack>&);
     165template void CCLayerIteratorActions::FrontToBack::begin(CCLayerIterator<CCLayerImpl, Vector<CCLayerImpl*>, CCRenderSurface, FrontToBack>&);
     166template void CCLayerIteratorActions::FrontToBack::goToHighestInSubtree(CCLayerIterator<CCLayerImpl, Vector<CCLayerImpl*>, CCRenderSurface, FrontToBack>&);
    167167
    168168} // namespace WebCore
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerIterator.h

    r108678 r108886  
    9393
    9494// An iterator class for walking over layers in the RenderSurface-Layer tree.
    95 template <typename LayerType, typename RenderSurfaceType, typename IteratorActionType>
     95template <typename LayerType, typename LayerList, typename RenderSurfaceType, typename IteratorActionType>
    9696class CCLayerIterator {
    97     typedef CCLayerIterator<LayerType, RenderSurfaceType, IteratorActionType> CCLayerIteratorType;
     97    typedef CCLayerIterator<LayerType, LayerList, RenderSurfaceType, IteratorActionType> CCLayerIteratorType;
    9898
    9999public:
    100100    CCLayerIterator() : m_renderSurfaceLayerList(0) { }
    101101
    102     static CCLayerIteratorType begin(const Vector<RefPtr<LayerType> >* renderSurfaceLayerList) { return CCLayerIteratorType(renderSurfaceLayerList, true); }
    103     static CCLayerIteratorType end(const Vector<RefPtr<LayerType> >* renderSurfaceLayerList) { return CCLayerIteratorType(renderSurfaceLayerList, false); }
     102    static CCLayerIteratorType begin(const LayerList* renderSurfaceLayerList) { return CCLayerIteratorType(renderSurfaceLayerList, true); }
     103    static CCLayerIteratorType end(const LayerList* renderSurfaceLayerList) { return CCLayerIteratorType(renderSurfaceLayerList, false); }
    104104
    105105    CCLayerIteratorType& operator++() { m_actions.next(*this); return *this; }
     
    118118    bool representsItself() const { return !representsTargetRenderSurface() && !representsContributingRenderSurface(); }
    119119
    120     LayerType* targetRenderSurfaceLayer() const { return (*m_renderSurfaceLayerList)[m_targetRenderSurfaceLayerIndex].get(); }
     120    LayerType* targetRenderSurfaceLayer() const { return getRawPtr((*m_renderSurfaceLayerList)[m_targetRenderSurfaceLayerIndex]); }
    121121
    122122private:
    123     CCLayerIterator(const Vector<RefPtr<LayerType> >* renderSurfaceLayerList, bool start)
     123    CCLayerIterator(const LayerList* renderSurfaceLayerList, bool start)
    124124        : m_renderSurfaceLayerList(renderSurfaceLayerList)
    125125    {
     
    130130    }
    131131
    132     inline LayerType* currentLayer() const { return currentLayerRepresentsTargetRenderSurface() ? targetRenderSurfaceLayer() : targetRenderSurfaceChildren()[m_currentLayerIndex].get(); }
     132    inline static LayerChromium* getRawPtr(const RefPtr<LayerChromium>& ptr) { return ptr.get(); }
     133    inline static CCLayerImpl* getRawPtr(CCLayerImpl* ptr) { return ptr; }
     134
     135    inline LayerType* currentLayer() const { return currentLayerRepresentsTargetRenderSurface() ? targetRenderSurfaceLayer() : getRawPtr(targetRenderSurfaceChildren()[m_currentLayerIndex]); }
    133136
    134137    inline bool currentLayerRepresentsContributingRenderSurface() const { return CCLayerTreeHostCommon::renderSurfaceContributesToTarget<LayerType>(currentLayer(), targetRenderSurfaceLayer()->id()); }
     
    136139
    137140    inline RenderSurfaceType* targetRenderSurface() const { return targetRenderSurfaceLayer()->renderSurface(); }
    138     inline const Vector<RefPtr<LayerType> >& targetRenderSurfaceChildren() const { return targetRenderSurface()->layerList(); }
     141    inline const LayerList& targetRenderSurfaceChildren() const { return targetRenderSurface()->layerList(); }
    139142
    140143    IteratorActionType m_actions;
    141     const Vector<RefPtr<LayerType> >* m_renderSurfaceLayerList;
     144    const LayerList* m_renderSurfaceLayerList;
    142145
    143146    // The iterator's current position.
     
    162165    class BackToFront {
    163166    public:
    164         template <typename LayerType, typename RenderSurfaceType, typename ActionType>
    165         void begin(CCLayerIterator<LayerType, RenderSurfaceType, ActionType>&);
    166 
    167         template <typename LayerType, typename RenderSurfaceType, typename ActionType>
    168         void end(CCLayerIterator<LayerType, RenderSurfaceType, ActionType>&);
    169 
    170         template <typename LayerType, typename RenderSurfaceType, typename ActionType>
    171         void next(CCLayerIterator<LayerType, RenderSurfaceType, ActionType>&);
     167        template <typename LayerType, typename LayerList, typename RenderSurfaceType, typename ActionType>
     168        void begin(CCLayerIterator<LayerType, LayerList, RenderSurfaceType, ActionType>&);
     169
     170        template <typename LayerType, typename LayerList, typename RenderSurfaceType, typename ActionType>
     171        void end(CCLayerIterator<LayerType, LayerList, RenderSurfaceType, ActionType>&);
     172
     173        template <typename LayerType, typename LayerList, typename RenderSurfaceType, typename ActionType>
     174        void next(CCLayerIterator<LayerType, LayerList, RenderSurfaceType, ActionType>&);
    172175
    173176    private:
     
    178181    class FrontToBack {
    179182    public:
    180         template <typename LayerType, typename RenderSurfaceType, typename ActionType>
    181         void begin(CCLayerIterator<LayerType, RenderSurfaceType, ActionType>&);
    182 
    183         template <typename LayerType, typename RenderSurfaceType, typename ActionType>
    184         void end(CCLayerIterator<LayerType, RenderSurfaceType, ActionType>&);
    185 
    186         template <typename LayerType, typename RenderSurfaceType, typename ActionType>
    187         void next(CCLayerIterator<LayerType, RenderSurfaceType, ActionType>&);
     183        template <typename LayerType, typename LayerList, typename RenderSurfaceType, typename ActionType>
     184        void begin(CCLayerIterator<LayerType, LayerList, RenderSurfaceType, ActionType>&);
     185
     186        template <typename LayerType, typename LayerList, typename RenderSurfaceType, typename ActionType>
     187        void end(CCLayerIterator<LayerType, LayerList, RenderSurfaceType, ActionType>&);
     188
     189        template <typename LayerType, typename LayerList, typename RenderSurfaceType, typename ActionType>
     190        void next(CCLayerIterator<LayerType, LayerList, RenderSurfaceType, ActionType>&);
    188191
    189192    private:
    190         template <typename LayerType, typename RenderSurfaceType, typename ActionType>
    191         void goToHighestInSubtree(CCLayerIterator<LayerType, RenderSurfaceType, ActionType>&);
     193        template <typename LayerType, typename LayerList, typename RenderSurfaceType, typename ActionType>
     194        void goToHighestInSubtree(CCLayerIterator<LayerType, LayerList, RenderSurfaceType, ActionType>&);
    192195    };
    193196};
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerSorter.cpp

    r104002 r108886  
    296296    float maxZ = -FLT_MAX;
    297297    for (LayerList::const_iterator it = first; it < last; it++) {
    298         m_nodes.append(GraphNode(it->get()));
     298        m_nodes.append(GraphNode(*it));
    299299        GraphNode& node = m_nodes.at(m_nodes.size() - 1);
    300300        CCRenderSurface* renderSurface = node.layer->renderSurface();
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerSorter.h

    r96337 r108886  
    4040    CCLayerSorter();
    4141
    42     typedef Vector<RefPtr<CCLayerImpl> > LayerList;
     42    typedef Vector<CCLayerImpl*> LayerList;
    4343
    4444    void sort(LayerList::iterator first, LayerList::iterator last);
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp

    r108880 r108886  
    170170    ASSERT(CCProxy::isImplThread());
    171171
    172     // Synchronize trees, if one exists at all...
    173     if (rootLayer()) {
    174         hostImpl->setRootLayer(TreeSynchronizer::synchronizeTrees(rootLayer(), hostImpl->rootLayer()));
    175         // We may have added an animation during the tree sync. This will cause hostImpl to visit its controllers.
     172    hostImpl->setRootLayer(TreeSynchronizer::synchronizeTrees(rootLayer(), hostImpl->releaseRootLayer()));
     173
     174    // We may have added an animation during the tree sync. This will cause hostImpl to visit its controllers.
     175    if (rootLayer())
    176176        hostImpl->setNeedsAnimateLayers();
    177     } else
    178         hostImpl->setRootLayer(0);
    179177
    180178    hostImpl->setSourceFrameNumber(frameNumber());
     
    338336    // push over the tree changes.
    339337    if (m_proxy->layerRendererCapabilities().contextHasCachedFrontBuffer) {
    340         hostImpl->setRootLayer(0);
    341         return;
    342     }
    343 
    344     if (rootLayer()) {
    345         hostImpl->setRootLayer(TreeSynchronizer::synchronizeTrees(rootLayer(), hostImpl->rootLayer()));
    346         // We may have added an animation during the tree sync. This will cause hostImpl to visit its controllers.
     338        hostImpl->setRootLayer(nullptr);
     339        return;
     340    }
     341
     342    hostImpl->setRootLayer(TreeSynchronizer::synchronizeTrees(rootLayer(), hostImpl->releaseRootLayer()));
     343
     344    // We may have added an animation during the tree sync. This will cause hostImpl to visit its controllers.
     345    if (rootLayer())
    347346        hostImpl->setNeedsAnimateLayers();
    348     } else
    349         hostImpl->setRootLayer(0);
    350347}
    351348
     
    441438{
    442439    // Use BackToFront since it's cheap and this isn't order-dependent.
    443     typedef CCLayerIterator<LayerChromium, RenderSurfaceChromium, CCLayerIteratorActions::BackToFront> CCLayerIteratorType;
     440    typedef CCLayerIterator<LayerChromium, Vector<RefPtr<LayerChromium> >, RenderSurfaceChromium, CCLayerIteratorActions::BackToFront> CCLayerIteratorType;
    444441
    445442    CCLayerIteratorType end = CCLayerIteratorType::end(&m_updateList);
     
    533530{
    534531    // Use FrontToBack to allow for testing occlusion and performing culling during the tree walk.
    535     typedef CCLayerIterator<LayerChromium, RenderSurfaceChromium, CCLayerIteratorActions::FrontToBack> CCLayerIteratorType;
     532    typedef CCLayerIterator<LayerChromium, Vector<RefPtr<LayerChromium> >, RenderSurfaceChromium, CCLayerIteratorActions::FrontToBack> CCLayerIteratorType;
    536533
    537534    // The stack holds occluded regions for subtrees in the RenderSurface-Layer tree, so that when we leave a subtree we may
     
    570567{
    571568    // Use BackToFront since it's cheap and this isn't order-dependent.
    572     typedef CCLayerIterator<LayerChromium, RenderSurfaceChromium, CCLayerIteratorActions::BackToFront> CCLayerIteratorType;
     569    typedef CCLayerIterator<LayerChromium, Vector<RefPtr<LayerChromium> >, RenderSurfaceChromium, CCLayerIteratorActions::BackToFront> CCLayerIteratorType;
    573570
    574571    CCLayerIteratorType end = CCLayerIteratorType::end(&m_updateList);
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp

    r108426 r108886  
    150150// Recursively walks the layer tree starting at the given node and computes all the
    151151// necessary transformations, clipRects, render surfaces, etc.
    152 template<typename LayerType, typename RenderSurfaceType, typename LayerSorter>
    153 static bool calculateDrawTransformsAndVisibilityInternal(LayerType* layer, LayerType* rootLayer, const TransformationMatrix& parentMatrix, const TransformationMatrix& fullHierarchyMatrix, RenderSurfaceType* nearestAncestorThatMovesPixels, Vector<RefPtr<LayerType> >& renderSurfaceLayerList, Vector<RefPtr<LayerType> >& layerList, LayerSorter* layerSorter, int maxTextureSize)
    154 {
    155     typedef Vector<RefPtr<LayerType> > LayerList;
    156 
     152template<typename LayerType, typename LayerList, typename RenderSurfaceType, typename LayerSorter>
     153static bool calculateDrawTransformsAndVisibilityInternal(LayerType* layer, LayerType* rootLayer, const TransformationMatrix& parentMatrix, const TransformationMatrix& fullHierarchyMatrix, RenderSurfaceType* nearestAncestorThatMovesPixels, LayerList& renderSurfaceLayerList, LayerList& layerList, LayerSorter* layerSorter, int maxTextureSize)
     154{
    157155    // This function computes the new matrix transformations recursively for this
    158156    // layer and all its descendants. It also computes the appropriate render surfaces.
     
    391389    for (size_t i = 0; i < layer->children().size(); ++i) {
    392390        LayerType* child = layer->children()[i].get();
    393         bool drawsContent = calculateDrawTransformsAndVisibilityInternal<LayerType, RenderSurfaceType, LayerSorter>(child, rootLayer, sublayerMatrix, nextHierarchyMatrix, nearestAncestorThatMovesPixels, renderSurfaceLayerList, descendants, layerSorter, maxTextureSize);
     391        bool drawsContent = calculateDrawTransformsAndVisibilityInternal<LayerType, LayerList, RenderSurfaceType, LayerSorter>(child, rootLayer, sublayerMatrix, nextHierarchyMatrix, nearestAncestorThatMovesPixels, renderSurfaceLayerList, descendants, layerSorter, maxTextureSize);
    394392
    395393        if (drawsContent) {
     
    496494// tree pass, revise calculateVisibleLayerRect() so that this can be done in a single
    497495// pass inside calculateDrawTransformsAndVisibilityInternal<>().
    498 template<typename LayerType, typename RenderSurfaceType>
    499 static void walkLayersAndCalculateVisibleLayerRects(const Vector<RefPtr<LayerType> >& renderSurfaceLayerList)
     496template<typename LayerType, typename LayerList, typename RenderSurfaceType>
     497static void walkLayersAndCalculateVisibleLayerRects(const LayerList& renderSurfaceLayerList)
    500498{
    501499    // Use BackToFront since it's cheap and this isn't order-dependent.
    502     typedef CCLayerIterator<LayerType, RenderSurfaceType, CCLayerIteratorActions::BackToFront> CCLayerIteratorType;
     500    typedef CCLayerIterator<LayerType, LayerList, RenderSurfaceType, CCLayerIteratorActions::BackToFront> CCLayerIteratorType;
    503501
    504502    CCLayerIteratorType end = CCLayerIteratorType::end(&renderSurfaceLayerList);
     
    513511void CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(LayerChromium* layer, LayerChromium* rootLayer, const TransformationMatrix& parentMatrix, const TransformationMatrix& fullHierarchyMatrix, Vector<RefPtr<LayerChromium> >& renderSurfaceLayerList, Vector<RefPtr<LayerChromium> >& layerList, int maxTextureSize)
    514512{
    515     WebCore::calculateDrawTransformsAndVisibilityInternal<LayerChromium, RenderSurfaceChromium, void*>(layer, rootLayer, parentMatrix, fullHierarchyMatrix, 0, renderSurfaceLayerList, layerList, 0, maxTextureSize);
    516     walkLayersAndCalculateVisibleLayerRects<LayerChromium, RenderSurfaceChromium>(renderSurfaceLayerList);
    517 }
    518 
    519 void CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(CCLayerImpl* layer, CCLayerImpl* rootLayer, const TransformationMatrix& parentMatrix, const TransformationMatrix& fullHierarchyMatrix, Vector<RefPtr<CCLayerImpl> >& renderSurfaceLayerList, Vector<RefPtr<CCLayerImpl> >& layerList, CCLayerSorter* layerSorter, int maxTextureSize)
    520 {
    521     calculateDrawTransformsAndVisibilityInternal<CCLayerImpl, CCRenderSurface, CCLayerSorter>(layer, rootLayer, parentMatrix, fullHierarchyMatrix, 0, renderSurfaceLayerList, layerList, layerSorter, maxTextureSize);
    522     walkLayersAndCalculateVisibleLayerRects<CCLayerImpl, CCRenderSurface>(renderSurfaceLayerList);
     513    WebCore::calculateDrawTransformsAndVisibilityInternal<LayerChromium, Vector<RefPtr<LayerChromium> >, RenderSurfaceChromium, void>(layer, rootLayer, parentMatrix, fullHierarchyMatrix, 0, renderSurfaceLayerList, layerList, 0, maxTextureSize);
     514    walkLayersAndCalculateVisibleLayerRects<LayerChromium, Vector<RefPtr<LayerChromium> >, RenderSurfaceChromium>(renderSurfaceLayerList);
     515}
     516
     517void CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(CCLayerImpl* layer, CCLayerImpl* rootLayer, const TransformationMatrix& parentMatrix, const TransformationMatrix& fullHierarchyMatrix, Vector<CCLayerImpl*>& renderSurfaceLayerList, Vector<CCLayerImpl*>& layerList, CCLayerSorter* layerSorter, int maxTextureSize)
     518{
     519    calculateDrawTransformsAndVisibilityInternal<CCLayerImpl, Vector<CCLayerImpl*>, CCRenderSurface, CCLayerSorter>(layer, rootLayer, parentMatrix, fullHierarchyMatrix, 0, renderSurfaceLayerList, layerList, layerSorter, maxTextureSize);
     520    walkLayersAndCalculateVisibleLayerRects<CCLayerImpl, Vector<CCLayerImpl*>, CCRenderSurface>(renderSurfaceLayerList);
    523521}
    524522
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostCommon.h

    r101318 r108886  
    4444
    4545    static void calculateDrawTransformsAndVisibility(LayerChromium*, LayerChromium* rootLayer, const TransformationMatrix& parentMatrix, const TransformationMatrix& fullHierarchyMatrix, Vector<RefPtr<LayerChromium> >& renderSurfaceLayerList, Vector<RefPtr<LayerChromium> >& layerList, int maxTextureSize);
    46     static void calculateDrawTransformsAndVisibility(CCLayerImpl*, CCLayerImpl* rootLayer, const TransformationMatrix& parentMatrix, const TransformationMatrix& fullHierarchyMatrix, Vector<RefPtr<CCLayerImpl> >& renderSurfaceLayerList, Vector<RefPtr<CCLayerImpl> >& layerList, CCLayerSorter*, int maxTextureSize);
     46    static void calculateDrawTransformsAndVisibility(CCLayerImpl*, CCLayerImpl* rootLayer, const TransformationMatrix& parentMatrix, const TransformationMatrix& fullHierarchyMatrix, Vector<CCLayerImpl*>& renderSurfaceLayerList, Vector<CCLayerImpl*>& layerList, CCLayerSorter*, int maxTextureSize);
    4747
    4848    template<typename LayerType> static bool renderSurfaceContributesToTarget(LayerType*, int targetSurfaceLayerID);
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp

    r108764 r108886  
    5151    , m_sourceFrameNumber(-1)
    5252    , m_frameNumber(0)
     53    , m_scrollLayerImpl(0)
    5354    , m_settings(settings)
    5455    , m_visible(true)
     
    135136
    136137    for (int surfaceIndex = renderSurfaceLayerList.size() - 1; surfaceIndex >= 0 ; --surfaceIndex) {
    137         CCLayerImpl* renderSurfaceLayer = renderSurfaceLayerList[surfaceIndex].get();
     138        CCLayerImpl* renderSurfaceLayer = renderSurfaceLayerList[surfaceIndex];
    138139        CCRenderSurface* renderSurface = renderSurfaceLayer->renderSurface();
    139140        ASSERT(renderSurface);
     
    199200
    200201    for (int surfaceIndex = renderSurfaceLayerList.size() - 1; surfaceIndex >= 0 ; --surfaceIndex) {
    201         CCLayerImpl* renderSurfaceLayer = renderSurfaceLayerList[surfaceIndex].get();
     202        CCLayerImpl* renderSurfaceLayer = renderSurfaceLayerList[surfaceIndex];
    202203        CCRenderSurface* renderSurface = renderSurfaceLayer->renderSurface();
    203204
     
    211212        const CCLayerList& layerList = renderSurface->layerList();
    212213        for (unsigned layerIndex = 0; layerIndex < layerList.size(); ++layerIndex) {
    213             CCLayerImpl* layer = layerList[layerIndex].get();
     214            CCLayerImpl* layer = layerList[layerIndex];
    214215            if (layer->visibleLayerRect().isEmpty())
    215216                continue;
     
    295296        m_layerRenderer->drawRenderPass(passes[i].get());
    296297
    297     typedef CCLayerIterator<CCLayerImpl, CCRenderSurface, CCLayerIteratorActions::BackToFront> CCLayerIteratorType;
     298    typedef CCLayerIterator<CCLayerImpl, Vector<CCLayerImpl*>, CCRenderSurface, CCLayerIteratorActions::BackToFront> CCLayerIteratorType;
    298299
    299300    CCLayerIteratorType end = CCLayerIteratorType::end(&renderSurfaceLayerList);
     
    364365}
    365366
    366 void CCLayerTreeHostImpl::setRootLayer(PassRefPtr<CCLayerImpl> layer)
     367void CCLayerTreeHostImpl::setRootLayer(PassOwnPtr<CCLayerImpl> layer)
    367368{
    368369    m_rootLayerImpl = layer;
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.h

    r108698 r108886  
    9595
    9696    CCLayerImpl* rootLayer() const { return m_rootLayerImpl.get(); }
    97     void setRootLayer(PassRefPtr<CCLayerImpl>);
     97    void setRootLayer(PassOwnPtr<CCLayerImpl>);
     98    PassOwnPtr<CCLayerImpl> releaseRootLayer() { return m_rootLayerImpl.release(); }
    9899
    99     CCLayerImpl* scrollLayer() const { return m_scrollLayerImpl.get(); }
     100    CCLayerImpl* scrollLayer() const { return m_scrollLayerImpl; }
    100101
    101102    bool visible() const { return m_visible; }
     
    137138
    138139private:
    139     typedef Vector<RefPtr<CCLayerImpl> > CCLayerList;
     140    typedef Vector<CCLayerImpl*> CCLayerList;
    140141
    141142    void computeDoubleTapZoomDeltas(CCScrollAndScaleSet* scrollInfo);
     
    154155
    155156    OwnPtr<LayerRendererChromium> m_layerRenderer;
    156     RefPtr<CCLayerImpl> m_rootLayerImpl;
    157     RefPtr<CCLayerImpl> m_scrollLayerImpl;
     157    OwnPtr<CCLayerImpl> m_rootLayerImpl;
     158    CCLayerImpl* m_scrollLayerImpl;
    158159    CCSettings m_settings;
    159160    IntSize m_viewportSize;
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCPluginLayerImpl.h

    r106607 r108886  
    3636class CCPluginLayerImpl : public CCLayerImpl {
    3737public:
    38     static PassRefPtr<CCPluginLayerImpl> create(int id)
     38    static PassOwnPtr<CCPluginLayerImpl> create(int id)
    3939    {
    40         return adoptRef(new CCPluginLayerImpl(id));
     40        return adoptPtr(new CCPluginLayerImpl(id));
    4141    }
    4242    virtual ~CCPluginLayerImpl();
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurface.h

    r108013 r108886  
    9696
    9797    void clearLayerList() { m_layerList.clear(); }
    98     Vector<RefPtr<CCLayerImpl> >& layerList() { return m_layerList; }
     98    Vector<CCLayerImpl*>& layerList() { return m_layerList; }
    9999
    100100    void setMaskLayer(CCLayerImpl* maskLayer) { m_maskLayer = maskLayer; }
     
    134134    FilterOperations m_filters;
    135135    IntRect m_clipRect;
    136     Vector<RefPtr<CCLayerImpl> > m_layerList;
     136    Vector<CCLayerImpl*> m_layerList;
    137137
    138138    // The nearest ancestor target surface that will contain the contents of this surface, and that is going
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCSolidColorLayerImpl.h

    r105634 r108886  
    3636class CCSolidColorLayerImpl : public CCLayerImpl {
    3737public:
    38     static PassRefPtr<CCSolidColorLayerImpl> create(int id)
     38    static PassOwnPtr<CCSolidColorLayerImpl> create(int id)
    3939    {
    40         return adoptRef(new CCSolidColorLayerImpl(id));
     40        return adoptPtr(new CCSolidColorLayerImpl(id));
    4141    }
    4242    virtual ~CCSolidColorLayerImpl();
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCTiledLayerImpl.h

    r106300 r108886  
    3838class CCTiledLayerImpl : public CCLayerImpl {
    3939public:
    40     static PassRefPtr<CCTiledLayerImpl> create(int id)
     40    static PassOwnPtr<CCTiledLayerImpl> create(int id)
    4141    {
    42         return adoptRef(new CCTiledLayerImpl(id));
     42        return adoptPtr(new CCTiledLayerImpl(id));
    4343    }
    4444    virtual ~CCTiledLayerImpl();
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.h

    r108675 r108886  
    4444                       , public VideoFrameProvider::Client {
    4545public:
    46     static PassRefPtr<CCVideoLayerImpl> create(int id, VideoFrameProvider* provider)
     46    static PassOwnPtr<CCVideoLayerImpl> create(int id, VideoFrameProvider* provider)
    4747    {
    48         return adoptRef(new CCVideoLayerImpl(id, provider));
     48        return adoptPtr(new CCVideoLayerImpl(id, provider));
    4949    }
    5050    virtual ~CCVideoLayerImpl();
  • trunk/Source/WebKit/chromium/ChangeLog

    r108883 r108886  
     12012-02-24  Tien-Ren Chen  <trchen@chromium.org>
     2
     3        [chromium] Replace RefPtr with OwnPtr for CCLayerImpl tree structure
     4        https://bugs.webkit.org/show_bug.cgi?id=78404
     5
     6        Reviewed by James Robinson.
     7
     8        * tests/CCDamageTrackerTest.cpp:
     9        (WebKitTests::executeCalculateDrawTransformsAndVisibility):
     10        (WebKitTests::emulateDrawingOneFrame):
     11        (WebKitTests::createTestTreeWithOneSurface):
     12        (WebKitTests::createTestTreeWithTwoSurfaces):
     13        (WebKitTests::createAndSetUpTestTreeWithOneSurface):
     14        (WebKitTests::createAndSetUpTestTreeWithTwoSurfaces):
     15        (WebKitTests::TEST_F):
     16        * tests/CCLayerImplTest.cpp:
     17        (WebCore::TEST):
     18        * tests/CCLayerIteratorTest.cpp:
     19        * tests/CCLayerSorterTest.cpp:
     20        (WebCore::TEST):
     21        * tests/CCLayerTreeHostCommonTest.cpp:
     22        (WebCore::TEST):
     23        * tests/CCLayerTreeHostImplTest.cpp:
     24        (WebKit::CCLayerTreeHostImplTest::setupScrollAndContentsLayers):
     25        (WebKit::TEST_F):
     26        (WebKit::DidDrawCheckLayer::create):
     27        (WebKit::BlendStateCheckLayer::create):
     28        * tests/CCRenderSurfaceTest.cpp:
     29        (WebCore::TEST):
     30        * tests/CCSolidColorLayerImplTest.cpp:
     31        (CCLayerTestCommon::TEST):
     32        * tests/CCTiledLayerImplTest.cpp:
     33        (CCLayerTestCommon::createLayer):
     34        (CCLayerTestCommon::TEST):
     35        (CCLayerTestCommon::getQuads):
     36        * tests/Canvas2DLayerChromiumTest.cpp:
     37        (WebCore::Canvas2DLayerChromiumTest::fullLifecycleTest):
     38        * tests/TiledLayerChromiumTest.cpp:
     39        (WTF::TEST):
     40        * tests/TreeSynchronizerTest.cpp:
     41        (WebKitTests::MockCCLayerImpl::create):
     42        (WebKitTests::MockLayerChromium::createCCLayerImpl):
     43        (WebKitTests::expectTreesAreIdentical):
     44        (WebKitTests::TEST):
     45
    1462012-02-08  James Robinson  <jamesr@chromium.org>
    247
  • trunk/Source/WebKit/chromium/tests/CCDamageTrackerTest.cpp

    r107130 r108886  
    4040namespace {
    4141
    42 void executeCalculateDrawTransformsAndVisibility(CCLayerImpl* root, Vector<RefPtr<CCLayerImpl> >& renderSurfaceLayerList)
     42void executeCalculateDrawTransformsAndVisibility(CCLayerImpl* root, Vector<CCLayerImpl*>& renderSurfaceLayerList)
    4343{
    4444    CCLayerSorter layerSorter;
    4545    TransformationMatrix identityMatrix;
    46     Vector<RefPtr<CCLayerImpl> > dummyLayerList;
     46    Vector<CCLayerImpl*> dummyLayerList;
    4747    int dummyMaxTextureSize = 512;
    4848
     
    6565    //   3. resetting all updateRects and propertyChanged flags for all layers and surfaces.
    6666
    67     Vector<RefPtr<CCLayerImpl> > renderSurfaceLayerList;
     67    Vector<CCLayerImpl*> renderSurfaceLayerList;
    6868    executeCalculateDrawTransformsAndVisibility(root, renderSurfaceLayerList);
    6969
     
    7777}
    7878
    79 PassRefPtr<CCLayerImpl> createTestTreeWithOneSurface()
    80 {
    81     RefPtr<CCLayerImpl> root = CCLayerImpl::create(1);
    82     RefPtr<CCLayerImpl> child = CCLayerImpl::create(2);
     79PassOwnPtr<CCLayerImpl> createTestTreeWithOneSurface()
     80{
     81    OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1);
     82    OwnPtr<CCLayerImpl> child = CCLayerImpl::create(2);
    8383
    8484    root->setPosition(FloatPoint::zero());
     
    9393    child->setBounds(IntSize(30, 30));
    9494    child->setDrawsContent(true);
    95     root->addChild(child);
     95    root->addChild(child.release());
    9696
    9797    return root.release();
    9898}
    9999
    100 PassRefPtr<CCLayerImpl> createTestTreeWithTwoSurfaces()
     100PassOwnPtr<CCLayerImpl> createTestTreeWithTwoSurfaces()
    101101{
    102102    // This test tree has two render surfaces: one for the root, and one for
     
    104104    // children of its own.
    105105
    106     RefPtr<CCLayerImpl> root = CCLayerImpl::create(1);
    107     RefPtr<CCLayerImpl> child1 = CCLayerImpl::create(2);
    108     RefPtr<CCLayerImpl> child2 = CCLayerImpl::create(3);
    109     RefPtr<CCLayerImpl> grandChild1 = CCLayerImpl::create(4);
    110     RefPtr<CCLayerImpl> grandChild2 = CCLayerImpl::create(5);
     106    OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1);
     107    OwnPtr<CCLayerImpl> child1 = CCLayerImpl::create(2);
     108    OwnPtr<CCLayerImpl> child2 = CCLayerImpl::create(3);
     109    OwnPtr<CCLayerImpl> grandChild1 = CCLayerImpl::create(4);
     110    OwnPtr<CCLayerImpl> grandChild2 = CCLayerImpl::create(5);
    111111
    112112    root->setPosition(FloatPoint::zero());
     
    138138    grandChild2->setDrawsContent(true);
    139139
    140     child1->addChild(grandChild1);
    141     child1->addChild(grandChild2);
    142     root->addChild(child1);
    143     root->addChild(child2);
     140    child1->addChild(grandChild1.release());
     141    child1->addChild(grandChild2.release());
     142    root->addChild(child1.release());
     143    root->addChild(child2.release());
    144144
    145145    return root.release();
    146146}
    147147
    148 PassRefPtr<CCLayerImpl> createAndSetUpTestTreeWithOneSurface()
    149 {
    150     RefPtr<CCLayerImpl> root = createTestTreeWithOneSurface();
     148PassOwnPtr<CCLayerImpl> createAndSetUpTestTreeWithOneSurface()
     149{
     150    OwnPtr<CCLayerImpl> root = createTestTreeWithOneSurface();
    151151
    152152    // Setup includes going past the first frame which always damages everything, so
     
    157157}
    158158
    159 PassRefPtr<CCLayerImpl> createAndSetUpTestTreeWithTwoSurfaces()
    160 {
    161     RefPtr<CCLayerImpl> root = createTestTreeWithTwoSurfaces();
     159PassOwnPtr<CCLayerImpl> createAndSetUpTestTreeWithTwoSurfaces()
     160{
     161    OwnPtr<CCLayerImpl> root = createTestTreeWithTwoSurfaces();
    162162
    163163    // Setup includes going past the first frame which always damages everything, so
     
    179179    // surfaces and layer lists.
    180180
    181     RefPtr<CCLayerImpl> root = createAndSetUpTestTreeWithOneSurface();
     181    OwnPtr<CCLayerImpl> root = createAndSetUpTestTreeWithOneSurface();
    182182
    183183    EXPECT_EQ(static_cast<size_t>(2), root->renderSurface()->layerList().size());
     
    194194    // surfaces and layer lists.
    195195
    196     RefPtr<CCLayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces();
    197 
    198     RefPtr<CCLayerImpl> child1 = root->children()[0];
    199     RefPtr<CCLayerImpl> child2 = root->children()[1];
     196    OwnPtr<CCLayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces();
     197
     198    CCLayerImpl* child1 = root->children()[0].get();
     199    CCLayerImpl* child2 = root->children()[1].get();
    200200    FloatRect childDamageRect = child1->renderSurface()->damageTracker()->currentDamageRect();
    201201    FloatRect rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
     
    213213TEST_F(CCDamageTrackerTest, verifyDamageForUpdateRects)
    214214{
    215     RefPtr<CCLayerImpl> root = createAndSetUpTestTreeWithOneSurface();
    216     RefPtr<CCLayerImpl> child = root->children()[0];
     215    OwnPtr<CCLayerImpl> root = createAndSetUpTestTreeWithOneSurface();
     216    CCLayerImpl* child = root->children()[0].get();
    217217
    218218    // CASE 1: Setting the update rect should cause the corresponding damage to the surface.
     
    244244TEST_F(CCDamageTrackerTest, verifyDamageForPropertyChanges)
    245245{
    246     RefPtr<CCLayerImpl> root = createAndSetUpTestTreeWithOneSurface();
    247     RefPtr<CCLayerImpl> child = root->children()[0];
     246    OwnPtr<CCLayerImpl> root = createAndSetUpTestTreeWithOneSurface();
     247    CCLayerImpl* child = root->children()[0].get();
    248248
    249249    // CASE 1: The layer's property changed flag takes priority over update rect.
     
    285285    // transformed layer.
    286286
    287     RefPtr<CCLayerImpl> root = createAndSetUpTestTreeWithOneSurface();
    288     RefPtr<CCLayerImpl> child = root->children()[0];
     287    OwnPtr<CCLayerImpl> root = createAndSetUpTestTreeWithOneSurface();
     288    CCLayerImpl* child = root->children()[0].get();
    289289
    290290    TransformationMatrix rotation;
     
    318318TEST_F(CCDamageTrackerTest, verifyDamageForAddingAndRemovingLayer)
    319319{
    320     RefPtr<CCLayerImpl> root = createAndSetUpTestTreeWithOneSurface();
    321     RefPtr<CCLayerImpl> child1 = root->children()[0];
    322 
    323     RefPtr<CCLayerImpl> child2 = CCLayerImpl::create(3);
    324     child2->setPosition(FloatPoint(400, 380));
    325     child2->setAnchorPoint(FloatPoint::zero());
    326     child2->setBounds(IntSize(6, 8));
    327     child2->setDrawsContent(true);
     320    OwnPtr<CCLayerImpl> root = createAndSetUpTestTreeWithOneSurface();
     321    CCLayerImpl* child1 = root->children()[0].get();
     322
     323    {
     324        OwnPtr<CCLayerImpl> child2 = CCLayerImpl::create(3);
     325        child2->setPosition(FloatPoint(400, 380));
     326        child2->setAnchorPoint(FloatPoint::zero());
     327        child2->setBounds(IntSize(6, 8));
     328        child2->setDrawsContent(true);
     329        root->addChild(child2.release());
     330    }
    328331
    329332    // CASE 1: Adding a new layer should cause the appropriate damage.
    330333    //
    331     root->addChild(child2);
    332334    emulateDrawingOneFrame(root.get());
    333335
     
    354356TEST_F(CCDamageTrackerTest, verifyDamageForMultipleLayers)
    355357{
    356     RefPtr<CCLayerImpl> root = createAndSetUpTestTreeWithOneSurface();
    357     RefPtr<CCLayerImpl> child1 = root->children()[0];
    358 
    359     RefPtr<CCLayerImpl> child2 = CCLayerImpl::create(3);
    360     child2->setPosition(FloatPoint(400, 380));
    361     child2->setAnchorPoint(FloatPoint::zero());
    362     child2->setBounds(IntSize(6, 8));
    363     child2->setDrawsContent(true);
    364     root->addChild(child2);
     358    OwnPtr<CCLayerImpl> root = createAndSetUpTestTreeWithOneSurface();
     359    CCLayerImpl* child1 = root->children()[0].get();
     360
     361    {
     362        OwnPtr<CCLayerImpl> child2 = CCLayerImpl::create(3);
     363        child2->setPosition(FloatPoint(400, 380));
     364        child2->setAnchorPoint(FloatPoint::zero());
     365        child2->setBounds(IntSize(6, 8));
     366        child2->setDrawsContent(true);
     367        root->addChild(child2.release());
     368    }
     369    CCLayerImpl* child2 = root->children()[1].get();
    365370
    366371    // In this test we don't want the above tree manipulation to be considered part of the same frame.
     
    379384TEST_F(CCDamageTrackerTest, verifyDamageForNestedSurfaces)
    380385{
    381     RefPtr<CCLayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces();
    382     RefPtr<CCLayerImpl> child1 = root->children()[0];
    383     RefPtr<CCLayerImpl> child2 = root->children()[1];
    384     RefPtr<CCLayerImpl> grandChild1 = root->children()[0]->children()[0];
     386    OwnPtr<CCLayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces();
     387    CCLayerImpl* child1 = root->children()[0].get();
     388    CCLayerImpl* child2 = root->children()[1].get();
     389    CCLayerImpl* grandChild1 = root->children()[0]->children()[0].get();
    385390    FloatRect childDamageRect;
    386391    FloatRect rootDamageRect;
     
    416421    // surface should be marked dirty.
    417422
    418     RefPtr<CCLayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces();
    419     RefPtr<CCLayerImpl> child1 = root->children()[0];
    420     RefPtr<CCLayerImpl> grandChild1 = root->children()[0]->children()[0];
     423    OwnPtr<CCLayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces();
     424    CCLayerImpl* child1 = root->children()[0].get();
     425    CCLayerImpl* grandChild1 = root->children()[0]->children()[0].get();
    421426    FloatRect childDamageRect;
    422427    FloatRect rootDamageRect;
     
    448453    //        root surface would be damaged appropriately.
    449454
    450     RefPtr<CCLayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces();
    451     RefPtr<CCLayerImpl> child1 = root->children()[0];
    452     RefPtr<CCLayerImpl> grandChild1 = root->children()[0]->children()[0];
     455    OwnPtr<CCLayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces();
     456    CCLayerImpl* child1 = root->children()[0].get();
    453457    FloatRect childDamageRect;
    454458    FloatRect rootDamageRect;
     
    470474TEST_F(CCDamageTrackerTest, verifyDamageForAddingAndRemovingRenderSurfaces)
    471475{
    472     RefPtr<CCLayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces();
    473     RefPtr<CCLayerImpl> child1 = root->children()[0];
     476    OwnPtr<CCLayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces();
     477    CCLayerImpl* child1 = root->children()[0].get();
    474478    FloatRect childDamageRect;
    475479    FloatRect rootDamageRect;
     
    511515TEST_F(CCDamageTrackerTest, verifyNoDamageWhenNothingChanged)
    512516{
    513     RefPtr<CCLayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces();
    514     RefPtr<CCLayerImpl> child1 = root->children()[0];
     517    OwnPtr<CCLayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces();
     518    CCLayerImpl* child1 = root->children()[0].get();
    515519    FloatRect childDamageRect;
    516520    FloatRect rootDamageRect;
     
    535539TEST_F(CCDamageTrackerTest, verifyNoDamageForUpdateRectThatDoesNotDrawContent)
    536540{
    537     RefPtr<CCLayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces();
    538     RefPtr<CCLayerImpl> child1 = root->children()[0];
     541    OwnPtr<CCLayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces();
     542    CCLayerImpl* child1 = root->children()[0].get();
    539543    FloatRect childDamageRect;
    540544    FloatRect rootDamageRect;
     
    552556TEST_F(CCDamageTrackerTest, verifyDamageForReplica)
    553557{
    554     RefPtr<CCLayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces();
    555     RefPtr<CCLayerImpl> child1 = root->children()[0];
    556     RefPtr<CCLayerImpl> grandChild1 = child1->children()[0];
    557     RefPtr<CCLayerImpl> grandChild2 = child1->children()[1];
     558    OwnPtr<CCLayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces();
     559    CCLayerImpl* child1 = root->children()[0].get();
     560    CCLayerImpl* grandChild1 = child1->children()[0].get();
     561    CCLayerImpl* grandChild2 = child1->children()[1].get();
    558562
    559563    // Damage on a surface that has a reflection should cause the target surface to
     
    564568    // contentBounds of the surface.
    565569    grandChild2->setPosition(FloatPoint(180, 180));
    566     RefPtr<CCLayerImpl> grandChild3 = CCLayerImpl::create(6);
    567     grandChild3->setPosition(FloatPoint(240, 240));
    568     grandChild3->setAnchorPoint(FloatPoint::zero());
    569     grandChild3->setBounds(IntSize(10, 10));
    570     grandChild3->setDrawsContent(true);
     570    {
     571        OwnPtr<CCLayerImpl> grandChild3 = CCLayerImpl::create(6);
     572        grandChild3->setPosition(FloatPoint(240, 240));
     573        grandChild3->setAnchorPoint(FloatPoint::zero());
     574        grandChild3->setBounds(IntSize(10, 10));
     575        grandChild3->setDrawsContent(true);
     576        child1->addChild(grandChild3.release());
     577    }
    571578    child1->setOpacity(0.5);
    572     child1->addChild(grandChild3);
    573579    emulateDrawingOneFrame(root.get());
    574580
    575581    // CASE 1: adding a reflection about the left edge of grandChild1.
    576582    //
    577     RefPtr<CCLayerImpl> grandChild1Replica = CCLayerImpl::create(7);
    578     grandChild1Replica->setPosition(FloatPoint::zero());
    579     grandChild1Replica->setAnchorPoint(FloatPoint::zero());
    580     TransformationMatrix reflection;
    581     reflection.scale3d(-1.0, 1.0, 1.0);
    582     grandChild1Replica->setTransform(reflection);
    583     grandChild1->setReplicaLayer(grandChild1Replica);
     583    {
     584        OwnPtr<CCLayerImpl> grandChild1Replica = CCLayerImpl::create(7);
     585        grandChild1Replica->setPosition(FloatPoint::zero());
     586        grandChild1Replica->setAnchorPoint(FloatPoint::zero());
     587        TransformationMatrix reflection;
     588        reflection.scale3d(-1.0, 1.0, 1.0);
     589        grandChild1Replica->setTransform(reflection);
     590        grandChild1->setReplicaLayer(grandChild1Replica.release());
     591    }
    584592    emulateDrawingOneFrame(root.get());
    585593
     
    615623    // CASE 3: removing the reflection should cause the entire region including reflection
    616624    //         to damage the target surface.
    617     grandChild1->setReplicaLayer(0);
     625    grandChild1->setReplicaLayer(nullptr);
    618626    emulateDrawingOneFrame(root.get());
    619627    ASSERT_EQ(oldContentRect.width(), child1->renderSurface()->contentRect().width());
     
    630638TEST_F(CCDamageTrackerTest, verifyDamageForMask)
    631639{
    632     RefPtr<CCLayerImpl> root = createAndSetUpTestTreeWithOneSurface();
    633     RefPtr<CCLayerImpl> child = root->children()[0];
     640    OwnPtr<CCLayerImpl> root = createAndSetUpTestTreeWithOneSurface();
     641    CCLayerImpl* child = root->children()[0].get();
    634642
    635643    // In the current implementation of the damage tracker, changes to mask layers should
     
    637645
    638646    // Set up the mask layer.
    639     RefPtr<CCLayerImpl> maskLayer = CCLayerImpl::create(3);
    640     maskLayer->setPosition(child->position());
    641     maskLayer->setAnchorPoint(FloatPoint::zero());
    642     maskLayer->setBounds(child->bounds());
    643     child->setMaskLayer(maskLayer);
     647    {
     648        OwnPtr<CCLayerImpl> maskLayer = CCLayerImpl::create(3);
     649        maskLayer->setPosition(child->position());
     650        maskLayer->setAnchorPoint(FloatPoint::zero());
     651        maskLayer->setBounds(child->bounds());
     652        child->setMaskLayer(maskLayer.release());
     653    }
     654    CCLayerImpl* maskLayer = child->maskLayer();
    644655
    645656    // Add opacity and a grandChild so that the render surface persists even after we remove the mask.
    646657    child->setOpacity(0.5);
    647     RefPtr<CCLayerImpl> grandChild = CCLayerImpl::create(4);
    648     grandChild->setPosition(FloatPoint(2.0, 2.0));
    649     grandChild->setAnchorPoint(FloatPoint::zero());
    650     grandChild->setBounds(IntSize(2, 2));
    651     grandChild->setDrawsContent(true);
    652     child->addChild(grandChild);
     658    {
     659        OwnPtr<CCLayerImpl> grandChild = CCLayerImpl::create(4);
     660        grandChild->setPosition(FloatPoint(2.0, 2.0));
     661        grandChild->setAnchorPoint(FloatPoint::zero());
     662        grandChild->setBounds(IntSize(2, 2));
     663        grandChild->setDrawsContent(true);
     664        child->addChild(grandChild.release());
     665    }
    653666    emulateDrawingOneFrame(root.get());
    654667
     
    686699
    687700    // Then test mask removal.
    688     child->setMaskLayer(0);
     701    child->setMaskLayer(nullptr);
    689702    ASSERT_TRUE(child->layerPropertyChanged());
    690703    emulateDrawingOneFrame(root.get());
     
    699712TEST_F(CCDamageTrackerTest, verifyDamageForReplicaMask)
    700713{
    701     RefPtr<CCLayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces();
    702     RefPtr<CCLayerImpl> child1 = root->children()[0];
    703     RefPtr<CCLayerImpl> grandChild1 = child1->children()[0];
     714    OwnPtr<CCLayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces();
     715    CCLayerImpl* child1 = root->children()[0].get();
     716    CCLayerImpl* grandChild1 = child1->children()[0].get();
    704717
    705718    // Changes to a replica's mask should not damage the original surface, because it is
     
    707720
    708721    // Create a reflection about the left edge of grandChild1.
    709     RefPtr<CCLayerImpl> grandChild1Replica = CCLayerImpl::create(6);
    710     grandChild1Replica->setPosition(FloatPoint::zero());
    711     grandChild1Replica->setAnchorPoint(FloatPoint::zero());
    712     TransformationMatrix reflection;
    713     reflection.scale3d(-1.0, 1.0, 1.0);
    714     grandChild1Replica->setTransform(reflection);
    715     grandChild1->setReplicaLayer(grandChild1Replica);
     722    {
     723        OwnPtr<CCLayerImpl> grandChild1Replica = CCLayerImpl::create(6);
     724        grandChild1Replica->setPosition(FloatPoint::zero());
     725        grandChild1Replica->setAnchorPoint(FloatPoint::zero());
     726        TransformationMatrix reflection;
     727        reflection.scale3d(-1.0, 1.0, 1.0);
     728        grandChild1Replica->setTransform(reflection);
     729        grandChild1->setReplicaLayer(grandChild1Replica.release());
     730    }
     731    CCLayerImpl* grandChild1Replica = grandChild1->replicaLayer();
    716732
    717733    // Set up the mask layer on the replica layer
    718     RefPtr<CCLayerImpl> replicaMaskLayer = CCLayerImpl::create(7);
    719     replicaMaskLayer->setPosition(FloatPoint::zero());
    720     replicaMaskLayer->setAnchorPoint(FloatPoint::zero());
    721     replicaMaskLayer->setBounds(grandChild1->bounds());
    722     grandChild1Replica->setMaskLayer(replicaMaskLayer);
     734    {
     735        OwnPtr<CCLayerImpl> replicaMaskLayer = CCLayerImpl::create(7);
     736        replicaMaskLayer->setPosition(FloatPoint::zero());
     737        replicaMaskLayer->setAnchorPoint(FloatPoint::zero());
     738        replicaMaskLayer->setBounds(grandChild1->bounds());
     739        grandChild1Replica->setMaskLayer(replicaMaskLayer.release());
     740    }
     741    CCLayerImpl* replicaMaskLayer = grandChild1Replica->maskLayer();
    723742
    724743    emulateDrawingOneFrame(root.get());
     
    739758    // CASE 2: removing the replica mask damages only the reflected region on the target surface.
    740759    //
    741     grandChild1Replica->setMaskLayer(0);
     760    grandChild1Replica->setMaskLayer(nullptr);
    742761    emulateDrawingOneFrame(root.get());
    743762
     
    751770TEST_F(CCDamageTrackerTest, verifyDamageWhenReset)
    752771{
    753     RefPtr<CCLayerImpl> root = createAndSetUpTestTreeWithOneSurface();
    754     RefPtr<CCLayerImpl> child = root->children()[0];
     772    OwnPtr<CCLayerImpl> root = createAndSetUpTestTreeWithOneSurface();
     773    CCLayerImpl* child = root->children()[0].get();
    755774
    756775    // Case 1: This test ensures that when the tracker is forced to have full damage, that
  • trunk/Source/WebKit/chromium/tests/CCLayerImplTest.cpp

    r107763 r108886  
    6666
    6767    // Create a simple CCLayerImpl tree:
    68     RefPtr<CCLayerImpl> root = CCLayerImpl::create(1);
    69     RefPtr<CCLayerImpl> child = CCLayerImpl::create(2);
    70     RefPtr<CCLayerImpl> grandChild = CCLayerImpl::create(3);
    71     root->addChild(child);
    72     child->addChild(grandChild);
    73 
    74     RefPtr<CCLayerImpl> dummyMask = CCLayerImpl::create(4);
    75     RefPtr<CCLayerImpl> dummyReplica = CCLayerImpl::create(5);
     68    OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1);
     69    root->addChild(CCLayerImpl::create(2));
     70    CCLayerImpl* child = root->children()[0].get();
     71    child->addChild(CCLayerImpl::create(3));
     72    CCLayerImpl* grandChild = child->children()[0].get();
    7673
    7774    // Adding children is an internal operation and should not mark layers as changed.
     
    9693    EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->setAnchorPointZ(arbitraryNumber));
    9794    EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->setFilters(arbitraryFilters));
    98     EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->setMaskLayer(dummyMask));
     95    EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->setMaskLayer(CCLayerImpl::create(4)));
    9996    EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->setMasksToBounds(true));
    10097    EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->setOpaque(true));
    10198    EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->setOpacity(arbitraryNumber));
    102     EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->setReplicaLayer(dummyReplica));
     99    EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->setReplicaLayer(CCLayerImpl::create(5)));
    103100    EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->setPosition(arbitraryFloatPoint));
    104101    EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->setPreserves3D(true));
     
    135132    EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->setAnchorPoint(arbitraryFloatPoint));
    136133    EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->setAnchorPointZ(arbitraryNumber));
    137     EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->setMaskLayer(dummyMask));
    138134    EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->setMasksToBounds(true));
    139     EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->setReplicaLayer(dummyReplica));
    140135    EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->setPosition(arbitraryFloatPoint));
    141136    EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->setPreserves3D(true));
  • trunk/Source/WebKit/chromium/tests/CCLayerIteratorTest.cpp

    r105460 r108886  
    6868    EXPECT_EQ(itself, layer->m_countRepresentingItself);
    6969
    70 typedef CCLayerIterator<LayerChromium, RenderSurfaceChromium, CCLayerIteratorActions::FrontToBack> FrontToBack;
    71 typedef CCLayerIterator<LayerChromium, RenderSurfaceChromium, CCLayerIteratorActions::BackToFront> BackToFront;
     70typedef CCLayerIterator<LayerChromium, Vector<RefPtr<LayerChromium> >, RenderSurfaceChromium, CCLayerIteratorActions::FrontToBack> FrontToBack;
     71typedef CCLayerIterator<LayerChromium, Vector<RefPtr<LayerChromium> >, RenderSurfaceChromium, CCLayerIteratorActions::BackToFront> BackToFront;
    7272
    7373void resetCounts(Vector<RefPtr<LayerChromium> >& renderSurfaceLayerList)
     
    138138    Vector<RefPtr<LayerChromium> > renderSurfaceLayerList;
    139139    Vector<RefPtr<LayerChromium> > layerList;
    140     renderSurfaceLayerList.append(rootLayer);
     140    renderSurfaceLayerList.append(rootLayer.get());
    141141    CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(rootLayer.get(), rootLayer.get(),
    142142                                                                TransformationMatrix(), TransformationMatrix(),
     
    185185    Vector<RefPtr<LayerChromium> > renderSurfaceLayerList;
    186186    Vector<RefPtr<LayerChromium> > layerList;
    187     renderSurfaceLayerList.append(rootLayer);
     187    renderSurfaceLayerList.append(rootLayer.get());
    188188    CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(rootLayer.get(), rootLayer.get(),
    189189                                                                TransformationMatrix(), TransformationMatrix(),
     
    244244    Vector<RefPtr<LayerChromium> > renderSurfaceLayerList;
    245245    Vector<RefPtr<LayerChromium> > layerList;
    246     renderSurfaceLayerList.append(rootLayer);
     246    renderSurfaceLayerList.append(rootLayer.get());
    247247    CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(rootLayer.get(), rootLayer.get(),
    248248                                                                TransformationMatrix(), TransformationMatrix(),
  • trunk/Source/WebKit/chromium/tests/CCLayerSorterTest.cpp

    r104002 r108886  
    175175    //    - 3 and 4 should be re-sorted so they are in front of 1, 2, and 5.
    176176
    177     RefPtr<CCLayerImpl> layer1 = CCLayerImpl::create(1);
    178     RefPtr<CCLayerImpl> layer2 = CCLayerImpl::create(2);
    179     RefPtr<CCLayerImpl> layer3 = CCLayerImpl::create(3);
    180     RefPtr<CCLayerImpl> layer4 = CCLayerImpl::create(4);
    181     RefPtr<CCLayerImpl> layer5 = CCLayerImpl::create(5);
     177    OwnPtr<CCLayerImpl> layer1 = CCLayerImpl::create(1);
     178    OwnPtr<CCLayerImpl> layer2 = CCLayerImpl::create(2);
     179    OwnPtr<CCLayerImpl> layer3 = CCLayerImpl::create(3);
     180    OwnPtr<CCLayerImpl> layer4 = CCLayerImpl::create(4);
     181    OwnPtr<CCLayerImpl> layer5 = CCLayerImpl::create(5);
    182182
    183183    TransformationMatrix BehindMatrix;
     
    206206    layer5->setDrawsContent(true);
    207207
    208     Vector<RefPtr<CCLayerImpl> > layerList;
    209     layerList.append(layer1);
    210     layerList.append(layer2);
    211     layerList.append(layer3);
    212     layerList.append(layer4);
    213     layerList.append(layer5);
     208    Vector<CCLayerImpl*> layerList;
     209    layerList.append(layer1.get());
     210    layerList.append(layer2.get());
     211    layerList.append(layer3.get());
     212    layerList.append(layer4.get());
     213    layerList.append(layer5.get());
    214214
    215215    ASSERT_EQ(static_cast<size_t>(5), layerList.size());
  • trunk/Source/WebKit/chromium/tests/CCLayerTreeHostCommonTest.cpp

    r108521 r108886  
    574574    // FIXME: when we fix this "root-layer special case" behavior in CCLayerTreeHost, we will have to fix it here, too.
    575575    parent->setClipRect(IntRect(IntPoint::zero(), parent->bounds()));
    576     renderSurfaceLayerList.append(parent);
     576    renderSurfaceLayerList.append(parent.get());
    577577
    578578    CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize);
  • trunk/Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp

    r108833 r108886  
    7979    void setupScrollAndContentsLayers(const IntSize& contentSize)
    8080    {
    81         RefPtr<CCLayerImpl> root = CCLayerImpl::create(0);
     81        OwnPtr<CCLayerImpl> root = CCLayerImpl::create(0);
    8282        root->setScrollable(true);
    8383        root->setScrollPosition(IntPoint(0, 0));
    8484        root->setMaxScrollPosition(contentSize);
    85         RefPtr<CCLayerImpl> contents = CCLayerImpl::create(1);
     85        OwnPtr<CCLayerImpl> contents = CCLayerImpl::create(1);
    8686        contents->setDrawsContent(true);
    8787        contents->setBounds(contentSize);
    8888        contents->setContentBounds(contentSize);
    89         root->addChild(contents);
    90         m_hostImpl->setRootLayer(root);
     89        root->addChild(contents.release());
     90        m_hostImpl->setRootLayer(root.release());
    9191    }
    9292
     
    113113TEST_F(CCLayerTreeHostImplTest, scrollDeltaTreeButNoChanges)
    114114{
    115     RefPtr<CCLayerImpl> root = CCLayerImpl::create(0);
    116     root->addChild(CCLayerImpl::create(1));
    117     root->addChild(CCLayerImpl::create(2));
    118     root->children()[1]->addChild(CCLayerImpl::create(3));
    119     root->children()[1]->addChild(CCLayerImpl::create(4));
    120     root->children()[1]->children()[0]->addChild(CCLayerImpl::create(5));
    121     m_hostImpl->setRootLayer(root);
    122 
    123     expectClearedScrollDeltasRecursive(root.get());
     115    {
     116        OwnPtr<CCLayerImpl> root = CCLayerImpl::create(0);
     117        root->addChild(CCLayerImpl::create(1));
     118        root->addChild(CCLayerImpl::create(2));
     119        root->children()[1]->addChild(CCLayerImpl::create(3));
     120        root->children()[1]->addChild(CCLayerImpl::create(4));
     121        root->children()[1]->children()[0]->addChild(CCLayerImpl::create(5));
     122        m_hostImpl->setRootLayer(root.release());
     123    }
     124    CCLayerImpl* root = m_hostImpl->rootLayer();
     125
     126    expectClearedScrollDeltasRecursive(root);
    124127
    125128    OwnPtr<CCScrollAndScaleSet> scrollInfo;
     
    127130    scrollInfo = m_hostImpl->processScrollDeltas();
    128131    ASSERT_EQ(scrollInfo->scrolls.size(), 0u);
    129     expectClearedScrollDeltasRecursive(root.get());
     132    expectClearedScrollDeltasRecursive(root);
    130133
    131134    scrollInfo = m_hostImpl->processScrollDeltas();
    132135    ASSERT_EQ(scrollInfo->scrolls.size(), 0u);
    133     expectClearedScrollDeltasRecursive(root.get());
     136    expectClearedScrollDeltasRecursive(root);
    134137}
    135138
     
    138141    IntPoint scrollPosition(20, 30);
    139142    IntSize scrollDelta(11, -15);
    140     RefPtr<CCLayerImpl> root = CCLayerImpl::create(10);
    141     root->setScrollPosition(scrollPosition);
    142     root->setScrollable(true);
    143     root->setMaxScrollPosition(IntSize(100, 100));
    144     root->scrollBy(scrollDelta);
    145     m_hostImpl->setRootLayer(root);
     143    {
     144        OwnPtr<CCLayerImpl> root = CCLayerImpl::create(10);
     145        root->setScrollPosition(scrollPosition);
     146        root->setScrollable(true);
     147        root->setMaxScrollPosition(IntSize(100, 100));
     148        root->scrollBy(scrollDelta);
     149        m_hostImpl->setRootLayer(root.release());
     150    }
     151    CCLayerImpl* root = m_hostImpl->rootLayer();
    146152
    147153    OwnPtr<CCScrollAndScaleSet> scrollInfo;
     
    166172TEST_F(CCLayerTreeHostImplTest, scrollRootCallsCommitAndRedraw)
    167173{
    168     RefPtr<CCLayerImpl> root = CCLayerImpl::create(0);
    169     root->setScrollable(true);
    170     root->setScrollPosition(IntPoint(0, 0));
    171     root->setMaxScrollPosition(IntSize(100, 100));
    172     m_hostImpl->setRootLayer(root);
     174    {
     175        OwnPtr<CCLayerImpl> root = CCLayerImpl::create(0);
     176        root->setScrollable(true);
     177        root->setScrollPosition(IntPoint(0, 0));
     178        root->setMaxScrollPosition(IntSize(100, 100));
     179        m_hostImpl->setRootLayer(root.release());
     180    }
     181
    173182    EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(0, 0), CCInputHandlerClient::Wheel), CCInputHandlerClient::ScrollStarted);
    174183    m_hostImpl->scrollBy(IntSize(0, 10));
     
    180189TEST_F(CCLayerTreeHostImplTest, wheelEventHandlers)
    181190{
    182     RefPtr<CCLayerImpl> root = CCLayerImpl::create(0);
    183     root->setScrollable(true);
    184     root->setScrollPosition(IntPoint(0, 0));
    185     root->setMaxScrollPosition(IntSize(100, 100));
    186     m_hostImpl->setRootLayer(root);
     191    {
     192        OwnPtr<CCLayerImpl> root = CCLayerImpl::create(0);
     193        root->setScrollable(true);
     194        root->setScrollPosition(IntPoint(0, 0));
     195        root->setMaxScrollPosition(IntSize(100, 100));
     196        m_hostImpl->setRootLayer(root.release());
     197    }
     198    CCLayerImpl* root = m_hostImpl->rootLayer();
     199
    187200    root->setHaveWheelEventHandlers(true);
    188201    // With registered event handlers, wheel scrolls have to go to the main thread.
     
    322335class DidDrawCheckLayer : public CCLayerImpl {
    323336public:
    324     static PassRefPtr<DidDrawCheckLayer> create(int id) { return adoptRef(new DidDrawCheckLayer(id)); }
     337    static PassOwnPtr<DidDrawCheckLayer> create(int id) { return adoptPtr(new DidDrawCheckLayer(id)); }
    325338
    326339    virtual void didDraw()
     
    360373    m_hostImpl->setViewportSize(IntSize(0, 0));
    361374
    362     RefPtr<DidDrawCheckLayer> root = DidDrawCheckLayer::create(0);
    363     m_hostImpl->setRootLayer(root);
     375    m_hostImpl->setRootLayer(DidDrawCheckLayer::create(0));
     376    DidDrawCheckLayer* root = static_cast<DidDrawCheckLayer*>(m_hostImpl->rootLayer());
    364377
    365378    EXPECT_FALSE(root->willDrawCalled());
     
    393406    m_hostImpl->setViewportSize(IntSize(10, 10));
    394407
    395     RefPtr<DidDrawCheckLayer> root = DidDrawCheckLayer::create(0);
    396     m_hostImpl->setRootLayer(root);
    397 
    398     RefPtr<DidDrawCheckLayer> layer1 = DidDrawCheckLayer::create(1);
    399     root->addChild(layer1);
    400 
    401     RefPtr<DidDrawCheckLayer> layer2 = DidDrawCheckLayer::create(2);
    402     layer1->addChild(layer2);
     408    m_hostImpl->setRootLayer(DidDrawCheckLayer::create(0));
     409    DidDrawCheckLayer* root = static_cast<DidDrawCheckLayer*>(m_hostImpl->rootLayer());
     410
     411    root->addChild(DidDrawCheckLayer::create(1));
     412    DidDrawCheckLayer* layer1 = static_cast<DidDrawCheckLayer*>(root->children()[0].get());
     413
     414    layer1->addChild(DidDrawCheckLayer::create(2));
     415    DidDrawCheckLayer* layer2 = static_cast<DidDrawCheckLayer*>(layer1->children()[0].get());
    403416
    404417    layer1->setOpacity(0.3);
     
    443456class BlendStateCheckLayer : public CCLayerImpl {
    444457public:
    445     static PassRefPtr<BlendStateCheckLayer> create(int id) { return adoptRef(new BlendStateCheckLayer(id)); }
     458    static PassOwnPtr<BlendStateCheckLayer> create(int id) { return adoptPtr(new BlendStateCheckLayer(id)); }
    446459
    447460    virtual void appendQuads(CCQuadList& quadList, const CCSharedQuadState* sharedQuadState)
     
    492505    m_hostImpl->setViewportSize(IntSize(10, 10));
    493506
    494     RefPtr<CCLayerImpl> root = CCLayerImpl::create(0);
    495     root->setAnchorPoint(FloatPoint(0, 0));
    496     root->setBounds(IntSize(10, 10));
    497     root->setDrawsContent(false);
    498     m_hostImpl->setRootLayer(root);
    499 
    500     RefPtr<BlendStateCheckLayer> layer1 = BlendStateCheckLayer::create(1);
    501     root->addChild(layer1);
     507    {
     508        OwnPtr<CCLayerImpl> root = CCLayerImpl::create(0);
     509        root->setAnchorPoint(FloatPoint(0, 0));
     510        root->setBounds(IntSize(10, 10));
     511        root->setDrawsContent(false);
     512        m_hostImpl->setRootLayer(root.release());
     513    }
     514    CCLayerImpl* root = m_hostImpl->rootLayer();
     515
     516    root->addChild(BlendStateCheckLayer::create(1));
     517    BlendStateCheckLayer* layer1 = static_cast<BlendStateCheckLayer*>(root->children()[0].get());
    502518
    503519    // Opaque layer, drawn without blending.
     
    538554    EXPECT_TRUE(layer1->quadsAppended());
    539555
    540     RefPtr<BlendStateCheckLayer> layer2 = BlendStateCheckLayer::create(2);
    541     layer1->addChild(layer2);
     556    layer1->addChild(BlendStateCheckLayer::create(2));
     557    BlendStateCheckLayer* layer2 = static_cast<BlendStateCheckLayer*>(layer1->children()[0].get());
    542558
    543559    // 2 opaque layers, drawn without blending.
     
    657673    m_hostImpl->setViewportSize(IntSize(10, 10));
    658674
    659     RefPtr<CCLayerImpl> root = adoptRef(new FakeDrawableCCLayerImpl(1));
     675    CCLayerImpl* root = new FakeDrawableCCLayerImpl(1);
    660676    root->setAnchorPoint(FloatPoint(0, 0));
    661677    root->setBounds(IntSize(10, 10));
    662678    root->setDrawsContent(true);
    663     m_hostImpl->setRootLayer(root);
     679    m_hostImpl->setRootLayer(adoptPtr(root));
    664680    EXPECT_FALSE(reshapeTracker->reshapeCalled());
    665681
     
    704720    layerTreeHostImpl->setViewportSize(IntSize(500, 500));
    705721
    706     RefPtr<CCLayerImpl> root = adoptRef(new FakeDrawableCCLayerImpl(1));
    707     RefPtr<CCLayerImpl> child = adoptRef(new FakeDrawableCCLayerImpl(2));
     722    CCLayerImpl* root = new FakeDrawableCCLayerImpl(1);
     723    CCLayerImpl* child = new FakeDrawableCCLayerImpl(2);
    708724    child->setPosition(FloatPoint(12, 13));
    709725    child->setAnchorPoint(FloatPoint(0, 0));
     
    713729    root->setBounds(IntSize(500, 500));
    714730    root->setDrawsContent(true);
    715     root->addChild(child);
    716     layerTreeHostImpl->setRootLayer(root);
     731    root->addChild(adoptPtr(child));
     732    layerTreeHostImpl->setRootLayer(adoptPtr(root));
    717733
    718734    // First frame, the entire screen should get swapped.
  • trunk/Source/WebKit/chromium/tests/CCRenderSurfaceTest.cpp

    r101318 r108886  
    5555    DebugScopedSetImplThread setImplThread;
    5656
    57     RefPtr<CCLayerImpl> owningLayer = CCLayerImpl::create(0);
     57    OwnPtr<CCLayerImpl> owningLayer = CCLayerImpl::create(0);
    5858    owningLayer->createRenderSurface();
    5959    ASSERT_TRUE(owningLayer->renderSurface());
     
    7575    EXECUTE_AND_VERIFY_SURFACE_DID_NOT_CHANGE(renderSurface->setContentRect(testRect));
    7676
    77     RefPtr<CCLayerImpl> dummyMask = CCLayerImpl::create(1);
     77    OwnPtr<CCLayerImpl> dummyMask = CCLayerImpl::create(1);
    7878    TransformationMatrix dummyMatrix;
    7979    dummyMatrix.translate(1.0, 2.0);
  • trunk/Source/WebKit/chromium/tests/CCSolidColorLayerImplTest.cpp

    r105634 r108886  
    4747    IntRect visibleLayerRect = IntRect(IntPoint(), layerSize);
    4848
    49     RefPtr<CCSolidColorLayerImpl> layer = CCSolidColorLayerImpl::create(0);
     49    OwnPtr<CCSolidColorLayerImpl> layer = CCSolidColorLayerImpl::create(0);
    5050    layer->setVisibleLayerRect(visibleLayerRect);
    5151    layer->setBounds(layerSize);
     
    6767    IntRect visibleLayerRect = IntRect(IntPoint(), layerSize);
    6868
    69     RefPtr<CCSolidColorLayerImpl> layer = CCSolidColorLayerImpl::create(0);
     69    OwnPtr<CCSolidColorLayerImpl> layer = CCSolidColorLayerImpl::create(0);
    7070    layer->setVisibleLayerRect(visibleLayerRect);
    7171    layer->setBounds(layerSize);
  • trunk/Source/WebKit/chromium/tests/CCTiledLayerImplTest.cpp

    r106300 r108886  
    4040// Create a default tiled layer with textures for all tiles and a default
    4141// visibility of the entire layer size.
    42 static PassRefPtr<CCTiledLayerImpl> createLayer(const IntSize& tileSize, const IntSize& layerSize, CCLayerTilingData::BorderTexelOption borderTexels)
    43 {
    44     RefPtr<CCTiledLayerImpl> layer = CCTiledLayerImpl::create(0);
     42static PassOwnPtr<CCTiledLayerImpl> createLayer(const IntSize& tileSize, const IntSize& layerSize, CCLayerTilingData::BorderTexelOption borderTexels)
     43{
     44    OwnPtr<CCTiledLayerImpl> layer = CCTiledLayerImpl::create(0);
    4545    OwnPtr<CCLayerTilingData> tiler = CCLayerTilingData::create(tileSize, borderTexels);
    4646    tiler->setBounds(layerSize);
     
    6969    // Verify default layer does creates quads
    7070    {
    71         RefPtr<CCTiledLayerImpl> layer = createLayer(tileSize, layerSize, CCLayerTilingData::NoBorderTexels);
     71        OwnPtr<CCTiledLayerImpl> layer = createLayer(tileSize, layerSize, CCLayerTilingData::NoBorderTexels);
    7272        CCQuadList quads;
    7373        OwnPtr<CCSharedQuadState> sharedQuadState = layer->createSharedQuadState();
     
    7979    // Layer with empty visible layer rect produces no quads
    8080    {
    81         RefPtr<CCTiledLayerImpl> layer = createLayer(tileSize, layerSize, CCLayerTilingData::NoBorderTexels);
     81        OwnPtr<CCTiledLayerImpl> layer = createLayer(tileSize, layerSize, CCLayerTilingData::NoBorderTexels);
    8282        layer->setVisibleLayerRect(IntRect());
    8383
     
    9090    // Layer with non-intersecting visible layer rect produces no quads
    9191    {
    92         RefPtr<CCTiledLayerImpl> layer = createLayer(tileSize, layerSize, CCLayerTilingData::NoBorderTexels);
     92        OwnPtr<CCTiledLayerImpl> layer = createLayer(tileSize, layerSize, CCLayerTilingData::NoBorderTexels);
    9393
    9494        IntRect outsideBounds(IntPoint(-100, -100), IntSize(50, 50));
     
    103103    // Layer with skips draw produces no quads
    104104    {
    105         RefPtr<CCTiledLayerImpl> layer = createLayer(tileSize, layerSize, CCLayerTilingData::NoBorderTexels);
     105        OwnPtr<CCTiledLayerImpl> layer = createLayer(tileSize, layerSize, CCLayerTilingData::NoBorderTexels);
    106106        layer->setSkipsDraw(true);
    107107
     
    122122    const IntSize layerSize(tileSize.width() * numTilesX, tileSize.height() * numTilesY);
    123123
    124     RefPtr<CCTiledLayerImpl> layer = createLayer(tileSize, layerSize, CCLayerTilingData::NoBorderTexels);
     124    OwnPtr<CCTiledLayerImpl> layer = createLayer(tileSize, layerSize, CCLayerTilingData::NoBorderTexels);
    125125    OwnPtr<CCSharedQuadState> sharedQuadState = layer->createSharedQuadState();
    126126
     
    151151static PassOwnPtr<CCSharedQuadState> getQuads(CCQuadList& quads, IntSize tileSize, const IntSize& layerSize, CCLayerTilingData::BorderTexelOption borderTexelOption, const IntRect& visibleLayerRect)
    152152{
    153     RefPtr<CCTiledLayerImpl> layer = createLayer(tileSize, layerSize, borderTexelOption);
     153    OwnPtr<CCTiledLayerImpl> layer = createLayer(tileSize, layerSize, borderTexelOption);
    154154    layer->setVisibleLayerRect(visibleLayerRect);
    155155    layer->setBounds(layerSize);
     
    261261    const unsigned numTiles = numTilesX * numTilesY;
    262262    const IntSize layerSize(tileSize.width() * numTilesX, tileSize.height() * numTilesY);
    263     RefPtr<CCTiledLayerImpl> layer = createLayer(tileSize, layerSize, CCLayerTilingData::NoBorderTexels);
     263    OwnPtr<CCTiledLayerImpl> layer = createLayer(tileSize, layerSize, CCLayerTilingData::NoBorderTexels);
    264264    layer->setBackgroundColor(Color::gray);
    265265    layer->setBackgroundCoversViewport(true);
  • trunk/Source/WebKit/chromium/tests/Canvas2DLayerChromiumTest.cpp

    r108706 r108886  
    140140            DebugScopedSetImplThread scopedImplThread;
    141141
    142             RefPtr<CCLayerImpl> layerImpl = canvas->createCCLayerImpl();
     142            OwnPtr<CCLayerImpl> layerImpl = canvas->createCCLayerImpl();
    143143            EXPECT_EQ(0u, static_cast<CCCanvasLayerImpl*>(layerImpl.get())->textureId());
    144144
  • trunk/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp

    r108431 r108886  
    232232    RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get()));
    233233    DebugScopedSetImplThread implThread;
    234     RefPtr<FakeCCTiledLayerImpl> layerImpl = adoptRef(new FakeCCTiledLayerImpl(0));
     234    OwnPtr<FakeCCTiledLayerImpl> layerImpl = adoptPtr(new FakeCCTiledLayerImpl(0));
    235235
    236236    FakeTextureAllocator textureAllocator;
     
    267267    RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get()));
    268268    DebugScopedSetImplThread implThread;
    269     RefPtr<FakeCCTiledLayerImpl> layerImpl = adoptRef(new FakeCCTiledLayerImpl(0));
     269    OwnPtr<FakeCCTiledLayerImpl> layerImpl = adoptPtr(new FakeCCTiledLayerImpl(0));
    270270
    271271    FakeTextureAllocator textureAllocator;
     
    333333    RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get()));
    334334    DebugScopedSetImplThread implThread;
    335     RefPtr<FakeCCTiledLayerImpl> layerImpl = adoptRef(new FakeCCTiledLayerImpl(0));
     335    OwnPtr<FakeCCTiledLayerImpl> layerImpl = adoptPtr(new FakeCCTiledLayerImpl(0));
    336336
    337337    FakeTextureAllocator textureAllocator;
     
    369369    RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get()));
    370370    DebugScopedSetImplThread implThread;
    371     RefPtr<FakeCCTiledLayerImpl> layerImpl = adoptRef(new FakeCCTiledLayerImpl(0));
     371    OwnPtr<FakeCCTiledLayerImpl> layerImpl = adoptPtr(new FakeCCTiledLayerImpl(0));
    372372
    373373    FakeTextureAllocator textureAllocator;
     
    449449    RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get()));
    450450    DebugScopedSetImplThread implThread;
    451     RefPtr<FakeCCTiledLayerImpl> layerImpl = adoptRef(new FakeCCTiledLayerImpl(0));
     451    OwnPtr<FakeCCTiledLayerImpl> layerImpl = adoptPtr(new FakeCCTiledLayerImpl(0));
    452452
    453453    FakeTextureAllocator textureAllocator;
  • trunk/Source/WebKit/chromium/tests/TreeSynchronizerTest.cpp

    r108581 r108886  
    4242class MockCCLayerImpl : public CCLayerImpl {
    4343public:
    44     static PassRefPtr<MockCCLayerImpl> create(int layerId)
    45     {
    46         return adoptRef(new MockCCLayerImpl(layerId));
     44    static PassOwnPtr<MockCCLayerImpl> create(int layerId)
     45    {
     46        return adoptPtr(new MockCCLayerImpl(layerId));
    4747    }
    4848    virtual ~MockCCLayerImpl()
     
    7373    virtual ~MockLayerChromium() { }
    7474
    75     virtual PassRefPtr<CCLayerImpl> createCCLayerImpl()
     75    virtual PassOwnPtr<CCLayerImpl> createCCLayerImpl()
    7676    {
    7777        return MockCCLayerImpl::create(m_layerId);
     
    135135
    136136    const Vector<RefPtr<LayerChromium> >& layerChildren = layer->children();
    137     const Vector<RefPtr<CCLayerImpl> >& ccLayerChildren = ccLayer->children();
     137    const Vector<OwnPtr<CCLayerImpl> >& ccLayerChildren = ccLayer->children();
    138138
    139139    ASSERT_EQ(layerChildren.size(), ccLayerChildren.size());
     
    151151    layerTreeRoot->addChild(LayerChromium::create());
    152152
    153     RefPtr<CCLayerImpl> ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), 0);
     153    OwnPtr<CCLayerImpl> ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), nullptr);
    154154
    155155    expectTreesAreIdentical(layerTreeRoot.get(), ccLayerTreeRoot.get());
     
    166166    layerTreeRoot->addChild(MockLayerChromium::create(&ccLayerDestructionList));
    167167
    168     RefPtr<CCLayerImpl> ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), 0);
     168    OwnPtr<CCLayerImpl> ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), nullptr);
    169169    expectTreesAreIdentical(layerTreeRoot.get(), ccLayerTreeRoot.get());
    170170
     
    200200    layerTreeRoot->children()[1]->setBounds(secondChildBounds);
    201201
    202     RefPtr<CCLayerImpl> ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), 0);
     202    OwnPtr<CCLayerImpl> ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), nullptr);
    203203    expectTreesAreIdentical(layerTreeRoot.get(), ccLayerTreeRoot.get());
    204204
     
    237237    RefPtr<LayerChromium> layerD = layerB->children()[1].get();
    238238
    239     RefPtr<CCLayerImpl> ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), 0);
     239    OwnPtr<CCLayerImpl> ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), nullptr);
    240240    expectTreesAreIdentical(layerTreeRoot.get(), ccLayerTreeRoot.get());
    241241
     
    275275    int oldTreeSecondChildLayerId = oldLayerTreeRoot->children()[1]->id();
    276276
    277     RefPtr<CCLayerImpl> ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(oldLayerTreeRoot.get(), 0);
     277    OwnPtr<CCLayerImpl> ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(oldLayerTreeRoot.get(), nullptr);
    278278    expectTreesAreIdentical(oldLayerTreeRoot.get(), ccLayerTreeRoot.get());
    279279
     
    315315    layerTreeRoot->children()[2]->setReplicaLayer(replicaLayerWithMask.get());
    316316
    317     RefPtr<CCLayerImpl> ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), 0);
     317    OwnPtr<CCLayerImpl> ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), nullptr);
    318318
    319319    expectTreesAreIdentical(layerTreeRoot.get(), ccLayerTreeRoot.get());
     
    321321    // Remove the mask layer.
    322322    layerTreeRoot->children()[0]->setMaskLayer(0);
    323     ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), ccLayerTreeRoot.get());
     323    ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), ccLayerTreeRoot.release());
    324324    expectTreesAreIdentical(layerTreeRoot.get(), ccLayerTreeRoot.get());
    325325
    326326    // Remove the replica layer.
    327327    layerTreeRoot->children()[1]->setReplicaLayer(0);
    328     ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), ccLayerTreeRoot.get());
     328    ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), ccLayerTreeRoot.release());
    329329    expectTreesAreIdentical(layerTreeRoot.get(), ccLayerTreeRoot.get());
    330330
    331331    // Remove the replica mask.
    332332    replicaLayerWithMask->setMaskLayer(0);
    333     ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), ccLayerTreeRoot.get());
     333    ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), ccLayerTreeRoot.release());
    334334    expectTreesAreIdentical(layerTreeRoot.get(), ccLayerTreeRoot.get());
    335335}
     
    344344    EXPECT_FALSE(static_cast<FakeLayerAnimationController*>(layerTreeRoot->layerAnimationController())->synchronizedAnimations());
    345345
    346     RefPtr<CCLayerImpl> ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), 0);
    347     ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), ccLayerTreeRoot.get());
     346    OwnPtr<CCLayerImpl> ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), nullptr);
     347    ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), ccLayerTreeRoot.release());
    348348
    349349    EXPECT_TRUE(static_cast<FakeLayerAnimationController*>(layerTreeRoot->layerAnimationController())->synchronizedAnimations());
Note: See TracChangeset for help on using the changeset viewer.