summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cc/CCDamageTracker.cpp4
-rw-r--r--cc/CCDamageTracker.h5
-rw-r--r--cc/CCDamageTrackerTest.cpp4
-rw-r--r--cc/CCDebugRectHistory.cpp10
-rw-r--r--cc/CCDebugRectHistory.h9
-rw-r--r--cc/CCHeadsUpDisplayTest.cpp9
-rw-r--r--cc/CCLayerImpl.cpp2
-rw-r--r--cc/CCLayerImpl.h2
-rw-r--r--cc/CCLayerIterator.cpp37
-rw-r--r--cc/CCLayerIterator.h8
-rw-r--r--cc/CCLayerIteratorTest.cpp69
-rw-r--r--cc/CCLayerSorter.h3
-rw-r--r--cc/CCLayerSorterTest.cpp12
-rw-r--r--cc/CCLayerTreeHost.cpp8
-rw-r--r--cc/CCLayerTreeHost.h10
-rw-r--r--cc/CCLayerTreeHostCommon.cpp46
-rw-r--r--cc/CCLayerTreeHostCommon.h16
-rw-r--r--cc/CCLayerTreeHostCommonTest.cpp375
-rw-r--r--cc/CCLayerTreeHostImpl.cpp6
-rw-r--r--cc/CCLayerTreeHostImpl.h2
-rw-r--r--cc/CCLayerTreeHostTest.cpp114
-rw-r--r--cc/CCOcclusionTrackerTest.cpp46
-rw-r--r--cc/CCQuadCullerTest.cpp12
-rw-r--r--cc/CCRenderSurface.cpp4
-rw-r--r--cc/CCRenderSurface.h6
-rw-r--r--cc/CCThreadedTest.cpp5
-rw-r--r--cc/CCThreadedTest.h2
-rw-r--r--cc/ContentLayerChromium.cpp4
-rw-r--r--cc/ContentLayerChromium.h6
-rw-r--r--cc/DelegatedRendererLayerChromium.cpp4
-rw-r--r--cc/DelegatedRendererLayerChromium.h6
-rw-r--r--cc/HeadsUpDisplayLayerChromium.cpp4
-rw-r--r--cc/HeadsUpDisplayLayerChromium.h5
-rw-r--r--cc/IOSurfaceLayerChromium.cpp4
-rw-r--r--cc/IOSurfaceLayerChromium.h4
-rw-r--r--cc/ImageLayerChromium.cpp4
-rw-r--r--cc/ImageLayerChromium.h4
-rw-r--r--cc/LayerChromium.cpp34
-rw-r--r--cc/LayerChromium.h32
-rw-r--r--cc/LayerChromiumTest.cpp149
-rw-r--r--cc/RenderSurfaceChromium.h7
-rw-r--r--cc/ScrollbarLayerChromium.cpp4
-rw-r--r--cc/ScrollbarLayerChromium.h5
-rw-r--r--cc/ScrollbarLayerChromiumTest.cpp18
-rw-r--r--cc/SolidColorLayerChromium.cpp4
-rw-r--r--cc/SolidColorLayerChromium.h8
-rw-r--r--cc/TextureLayerChromium.cpp4
-rw-r--r--cc/TextureLayerChromium.h4
-rw-r--r--cc/TextureLayerChromiumTest.cpp8
-rw-r--r--cc/TiledLayerChromium.h3
-rw-r--r--cc/TiledLayerChromiumTest.cpp81
-rw-r--r--cc/TreeSynchronizer.cpp5
-rw-r--r--cc/TreeSynchronizerTest.cpp46
-rw-r--r--cc/VideoLayerChromium.cpp4
-rw-r--r--cc/VideoLayerChromium.h5
-rw-r--r--cc/test/CCTiledLayerTestCommon.cpp6
-rw-r--r--cc/test/CCTiledLayerTestCommon.h5
-rw-r--r--webkit/compositor_bindings/WebExternalTextureLayerImpl.cpp4
-rw-r--r--webkit/compositor_bindings/WebLayerImpl.cpp2
-rw-r--r--webkit/compositor_bindings/WebLayerImpl.h7
-rw-r--r--webkit/compositor_bindings/WebLayerTreeViewImpl.cpp2
61 files changed, 688 insertions, 630 deletions
diff --git a/cc/CCDamageTracker.cpp b/cc/CCDamageTracker.cpp
index b98c8a1..80c1eb2 100644
--- a/cc/CCDamageTracker.cpp
+++ b/cc/CCDamageTracker.cpp
@@ -53,7 +53,7 @@ static inline void expandDamageRectInsideRectWithFilters(FloatRect& damageRect,
damageRect.unite(expandedDamageRect);
}
-void CCDamageTracker::updateDamageTrackingState(const Vector<CCLayerImpl*>& layerList, int targetSurfaceLayerID, bool targetSurfacePropertyChangedOnlyFromDescendant, const IntRect& targetSurfaceContentRect, CCLayerImpl* targetSurfaceMaskLayer, const WebKit::WebFilterOperations& filters)
+void CCDamageTracker::updateDamageTrackingState(const std::vector<CCLayerImpl*>& layerList, int targetSurfaceLayerID, bool targetSurfacePropertyChangedOnlyFromDescendant, const IntRect& targetSurfaceContentRect, CCLayerImpl* targetSurfaceMaskLayer, const WebKit::WebFilterOperations& filters)
{
//
// This function computes the "damage rect" of a target surface, and updates the state
@@ -165,7 +165,7 @@ void CCDamageTracker::saveRectForNextFrame(int layerID, const FloatRect& targetS
m_nextRectHistory->set(layerID, targetSpaceRect);
}
-FloatRect CCDamageTracker::trackDamageFromActiveLayers(const Vector<CCLayerImpl*>& layerList, int targetSurfaceLayerID)
+FloatRect CCDamageTracker::trackDamageFromActiveLayers(const std::vector<CCLayerImpl*>& layerList, int targetSurfaceLayerID)
{
FloatRect damageRect = FloatRect();
diff --git a/cc/CCDamageTracker.h b/cc/CCDamageTracker.h
index 015b6c8..c7550a2 100644
--- a/cc/CCDamageTracker.h
+++ b/cc/CCDamageTracker.h
@@ -7,6 +7,7 @@
#include "base/memory/scoped_ptr.h"
#include "FloatRect.h"
+#include <vector>
#include <wtf/HashMap.h>
#include <wtf/Vector.h>
@@ -28,14 +29,14 @@ public:
void didDrawDamagedArea() { m_currentDamageRect = FloatRect(); }
void forceFullDamageNextUpdate() { m_forceFullDamageNextUpdate = true; }
- void updateDamageTrackingState(const Vector<CCLayerImpl*>& layerList, int targetSurfaceLayerID, bool targetSurfacePropertyChangedOnlyFromDescendant, const IntRect& targetSurfaceContentRect, CCLayerImpl* targetSurfaceMaskLayer, const WebKit::WebFilterOperations&);
+ void updateDamageTrackingState(const std::vector<CCLayerImpl*>& layerList, int targetSurfaceLayerID, bool targetSurfacePropertyChangedOnlyFromDescendant, const IntRect& targetSurfaceContentRect, CCLayerImpl* targetSurfaceMaskLayer, const WebKit::WebFilterOperations&);
const FloatRect& currentDamageRect() { return m_currentDamageRect; }
private:
CCDamageTracker();
- FloatRect trackDamageFromActiveLayers(const Vector<CCLayerImpl*>& layerList, int targetSurfaceLayerID);
+ FloatRect trackDamageFromActiveLayers(const std::vector<CCLayerImpl*>& layerList, int targetSurfaceLayerID);
FloatRect trackDamageFromSurfaceMask(CCLayerImpl* targetSurfaceMaskLayer);
FloatRect trackDamageFromLeftoverRects();
diff --git a/cc/CCDamageTrackerTest.cpp b/cc/CCDamageTrackerTest.cpp
index 2f8adcf2..a59ccc1 100644
--- a/cc/CCDamageTrackerTest.cpp
+++ b/cc/CCDamageTrackerTest.cpp
@@ -23,7 +23,7 @@ using namespace WebKitTests;
namespace {
-void executeCalculateDrawTransformsAndVisibility(CCLayerImpl* root, Vector<CCLayerImpl*>& renderSurfaceLayerList)
+void executeCalculateDrawTransformsAndVisibility(CCLayerImpl* root, std::vector<CCLayerImpl*>& renderSurfaceLayerList)
{
CCLayerSorter layerSorter;
int dummyMaxTextureSize = 512;
@@ -55,7 +55,7 @@ void emulateDrawingOneFrame(CCLayerImpl* root)
// 2. updating all damage trackers in the correct order
// 3. resetting all updateRects and propertyChanged flags for all layers and surfaces.
- Vector<CCLayerImpl*> renderSurfaceLayerList;
+ std::vector<CCLayerImpl*> renderSurfaceLayerList;
executeCalculateDrawTransformsAndVisibility(root, renderSurfaceLayerList);
// Iterate back-to-front, so that damage correctly propagates from descendant surfaces to ancestors.
diff --git a/cc/CCDebugRectHistory.cpp b/cc/CCDebugRectHistory.cpp
index 1043ced..7f3c2ea 100644
--- a/cc/CCDebugRectHistory.cpp
+++ b/cc/CCDebugRectHistory.cpp
@@ -22,7 +22,7 @@ CCDebugRectHistory::~CCDebugRectHistory()
{
}
-void CCDebugRectHistory::saveDebugRectsForCurrentFrame(CCLayerImpl* rootLayer, const Vector<CCLayerImpl*>& renderSurfaceLayerList, const Vector<IntRect>& occludingScreenSpaceRects, const CCLayerTreeSettings& settings)
+void CCDebugRectHistory::saveDebugRectsForCurrentFrame(CCLayerImpl* rootLayer, const std::vector<CCLayerImpl*>& renderSurfaceLayerList, const Vector<IntRect>& occludingScreenSpaceRects, const CCLayerTreeSettings& settings)
{
// For now, clear all rects from previous frames. In the future we may want to store
// all debug rects for a history of many frames.
@@ -61,14 +61,14 @@ void CCDebugRectHistory::savePaintRects(CCLayerImpl* layer)
savePaintRects(layer->children()[i]);
}
-void CCDebugRectHistory::savePropertyChangedRects(const Vector<CCLayerImpl*>& renderSurfaceLayerList)
+void CCDebugRectHistory::savePropertyChangedRects(const std::vector<CCLayerImpl*>& renderSurfaceLayerList)
{
for (int surfaceIndex = renderSurfaceLayerList.size() - 1; surfaceIndex >= 0 ; --surfaceIndex) {
CCLayerImpl* renderSurfaceLayer = renderSurfaceLayerList[surfaceIndex];
CCRenderSurface* renderSurface = renderSurfaceLayer->renderSurface();
ASSERT(renderSurface);
- const Vector<CCLayerImpl*>& layerList = renderSurface->layerList();
+ const std::vector<CCLayerImpl*>& layerList = renderSurface->layerList();
for (unsigned layerIndex = 0; layerIndex < layerList.size(); ++layerIndex) {
CCLayerImpl* layer = layerList[layerIndex];
@@ -84,7 +84,7 @@ void CCDebugRectHistory::savePropertyChangedRects(const Vector<CCLayerImpl*>& re
}
}
-void CCDebugRectHistory::saveSurfaceDamageRects(const Vector<CCLayerImpl* >& renderSurfaceLayerList)
+void CCDebugRectHistory::saveSurfaceDamageRects(const std::vector<CCLayerImpl* >& renderSurfaceLayerList)
{
for (int surfaceIndex = renderSurfaceLayerList.size() - 1; surfaceIndex >= 0 ; --surfaceIndex) {
CCLayerImpl* renderSurfaceLayer = renderSurfaceLayerList[surfaceIndex];
@@ -95,7 +95,7 @@ void CCDebugRectHistory::saveSurfaceDamageRects(const Vector<CCLayerImpl* >& ren
}
}
-void CCDebugRectHistory::saveScreenSpaceRects(const Vector<CCLayerImpl* >& renderSurfaceLayerList)
+void CCDebugRectHistory::saveScreenSpaceRects(const std::vector<CCLayerImpl* >& renderSurfaceLayerList)
{
for (int surfaceIndex = renderSurfaceLayerList.size() - 1; surfaceIndex >= 0 ; --surfaceIndex) {
CCLayerImpl* renderSurfaceLayer = renderSurfaceLayerList[surfaceIndex];
diff --git a/cc/CCDebugRectHistory.h b/cc/CCDebugRectHistory.h
index 2668001..1b03f34 100644
--- a/cc/CCDebugRectHistory.h
+++ b/cc/CCDebugRectHistory.h
@@ -12,6 +12,7 @@
#include "IntRect.h"
#include <wtf/PassOwnPtr.h>
#include <wtf/Vector.h>
+#include <vector>
namespace cc {
@@ -61,7 +62,7 @@ public:
~CCDebugRectHistory();
// Note: Saving debug rects must happen before layers' change tracking is reset.
- void saveDebugRectsForCurrentFrame(CCLayerImpl* rootLayer, const Vector<CCLayerImpl*>& renderSurfaceLayerList, const Vector<IntRect>& occludingScreenSpaceRects, const CCLayerTreeSettings&);
+ void saveDebugRectsForCurrentFrame(CCLayerImpl* rootLayer, const std::vector<CCLayerImpl*>& renderSurfaceLayerList, const Vector<IntRect>& occludingScreenSpaceRects, const CCLayerTreeSettings&);
const Vector<CCDebugRect>& debugRects() { return m_debugRects; }
@@ -69,9 +70,9 @@ private:
CCDebugRectHistory();
void savePaintRects(CCLayerImpl*);
- void savePropertyChangedRects(const Vector<CCLayerImpl*>& renderSurfaceLayerList);
- void saveSurfaceDamageRects(const Vector<CCLayerImpl* >& renderSurfaceLayerList);
- void saveScreenSpaceRects(const Vector<CCLayerImpl* >& renderSurfaceLayerList);
+ void savePropertyChangedRects(const std::vector<CCLayerImpl*>& renderSurfaceLayerList);
+ void saveSurfaceDamageRects(const std::vector<CCLayerImpl* >& renderSurfaceLayerList);
+ void saveScreenSpaceRects(const std::vector<CCLayerImpl* >& renderSurfaceLayerList);
void saveOccludingRects(const Vector<IntRect>& occludingScreenSpaceRects);
Vector<CCDebugRect> m_debugRects;
diff --git a/cc/CCHeadsUpDisplayTest.cpp b/cc/CCHeadsUpDisplayTest.cpp
index ce847ab..5ad3796 100644
--- a/cc/CCHeadsUpDisplayTest.cpp
+++ b/cc/CCHeadsUpDisplayTest.cpp
@@ -25,11 +25,14 @@ protected:
class DrawsContentLayerChromium : public LayerChromium {
public:
- static PassRefPtr<DrawsContentLayerChromium> create() { return adoptRef(new DrawsContentLayerChromium()); }
+ static scoped_refptr<DrawsContentLayerChromium> create() { return make_scoped_refptr(new DrawsContentLayerChromium()); }
virtual bool drawsContent() const OVERRIDE { return true; }
private:
DrawsContentLayerChromium() : LayerChromium() { }
+ virtual ~DrawsContentLayerChromium()
+ {
+ }
};
class CCHudWithRootLayerChange : public CCHeadsUpDisplayTest {
@@ -97,8 +100,8 @@ public:
}
private:
- RefPtr<DrawsContentLayerChromium> m_rootLayer1;
- RefPtr<DrawsContentLayerChromium> m_rootLayer2;
+ scoped_refptr<DrawsContentLayerChromium> m_rootLayer1;
+ scoped_refptr<DrawsContentLayerChromium> m_rootLayer2;
int m_numCommits;
};
diff --git a/cc/CCLayerImpl.cpp b/cc/CCLayerImpl.cpp
index cbba7519..9168e04 100644
--- a/cc/CCLayerImpl.cpp
+++ b/cc/CCLayerImpl.cpp
@@ -272,7 +272,7 @@ void CCLayerImpl::dumpLayerProperties(std::string* str, int indent) const
base::StringAppendF(str, "drawsContent: %s\n", m_drawsContent ? "yes" : "no");
}
-void sortLayers(Vector<CCLayerImpl*>::iterator first, Vector<CCLayerImpl*>::iterator end, CCLayerSorter* layerSorter)
+void sortLayers(std::vector<CCLayerImpl*>::iterator first, std::vector<CCLayerImpl*>::iterator end, CCLayerSorter* layerSorter)
{
TRACE_EVENT0("cc", "CCLayerImpl::sortLayers");
layerSorter->sort(first, end);
diff --git a/cc/CCLayerImpl.h b/cc/CCLayerImpl.h
index 0f9ebe9..92cfbb2 100644
--- a/cc/CCLayerImpl.h
+++ b/cc/CCLayerImpl.h
@@ -392,7 +392,7 @@ private:
OwnPtr<CCScrollbarAnimationController> m_scrollbarAnimationController;
};
-void sortLayers(Vector<CCLayerImpl*>::iterator first, Vector<CCLayerImpl*>::iterator end, CCLayerSorter*);
+void sortLayers(std::vector<CCLayerImpl*>::iterator first, std::vector<CCLayerImpl*>::iterator end, CCLayerSorter*);
}
diff --git a/cc/CCLayerIterator.cpp b/cc/CCLayerIterator.cpp
index 6549910..71fde80 100644
--- a/cc/CCLayerIterator.cpp
+++ b/cc/CCLayerIterator.cpp
@@ -126,24 +126,27 @@ void CCLayerIteratorActions::FrontToBack::goToHighestInSubtree(CCLayerIterator<L
}
}
+typedef std::vector<scoped_refptr<LayerChromium> > LayerChromiumList;
+typedef std::vector<CCLayerImpl*> CCLayerImplList;
+
// Declare each of the above functions for LayerChromium and CCLayerImpl classes so that they are linked.
-template void CCLayerIteratorActions::BackToFront::begin(CCLayerIterator<LayerChromium, Vector<RefPtr<LayerChromium> >, RenderSurfaceChromium, BackToFront> &);
-template void CCLayerIteratorActions::BackToFront::end(CCLayerIterator<LayerChromium, Vector<RefPtr<LayerChromium> >, RenderSurfaceChromium, BackToFront>&);
-template void CCLayerIteratorActions::BackToFront::next(CCLayerIterator<LayerChromium, Vector<RefPtr<LayerChromium> >, RenderSurfaceChromium, BackToFront>&);
-
-template void CCLayerIteratorActions::BackToFront::begin(CCLayerIterator<CCLayerImpl, Vector<CCLayerImpl*>, CCRenderSurface, BackToFront>&);
-template void CCLayerIteratorActions::BackToFront::end(CCLayerIterator<CCLayerImpl, Vector<CCLayerImpl*>, CCRenderSurface, BackToFront>&);
-template void CCLayerIteratorActions::BackToFront::next(CCLayerIterator<CCLayerImpl, Vector<CCLayerImpl*>, CCRenderSurface, BackToFront>&);
-
-template void CCLayerIteratorActions::FrontToBack::next(CCLayerIterator<LayerChromium, Vector<RefPtr<LayerChromium> >, RenderSurfaceChromium, FrontToBack>&);
-template void CCLayerIteratorActions::FrontToBack::end(CCLayerIterator<LayerChromium, Vector<RefPtr<LayerChromium> >, RenderSurfaceChromium, FrontToBack>&);
-template void CCLayerIteratorActions::FrontToBack::begin(CCLayerIterator<LayerChromium, Vector<RefPtr<LayerChromium> >, RenderSurfaceChromium, FrontToBack>&);
-template void CCLayerIteratorActions::FrontToBack::goToHighestInSubtree(CCLayerIterator<LayerChromium, Vector<RefPtr<LayerChromium> >, RenderSurfaceChromium, FrontToBack>&);
-
-template void CCLayerIteratorActions::FrontToBack::next(CCLayerIterator<CCLayerImpl, Vector<CCLayerImpl*>, CCRenderSurface, FrontToBack>&);
-template void CCLayerIteratorActions::FrontToBack::end(CCLayerIterator<CCLayerImpl, Vector<CCLayerImpl*>, CCRenderSurface, FrontToBack>&);
-template void CCLayerIteratorActions::FrontToBack::begin(CCLayerIterator<CCLayerImpl, Vector<CCLayerImpl*>, CCRenderSurface, FrontToBack>&);
-template void CCLayerIteratorActions::FrontToBack::goToHighestInSubtree(CCLayerIterator<CCLayerImpl, Vector<CCLayerImpl*>, CCRenderSurface, FrontToBack>&);
+template void CCLayerIteratorActions::BackToFront::begin(CCLayerIterator<LayerChromium, LayerChromiumList, RenderSurfaceChromium, BackToFront> &);
+template void CCLayerIteratorActions::BackToFront::end(CCLayerIterator<LayerChromium, LayerChromiumList, RenderSurfaceChromium, BackToFront>&);
+template void CCLayerIteratorActions::BackToFront::next(CCLayerIterator<LayerChromium, LayerChromiumList, RenderSurfaceChromium, BackToFront>&);
+
+template void CCLayerIteratorActions::BackToFront::begin(CCLayerIterator<CCLayerImpl, CCLayerImplList, CCRenderSurface, BackToFront>&);
+template void CCLayerIteratorActions::BackToFront::end(CCLayerIterator<CCLayerImpl, CCLayerImplList, CCRenderSurface, BackToFront>&);
+template void CCLayerIteratorActions::BackToFront::next(CCLayerIterator<CCLayerImpl, CCLayerImplList, CCRenderSurface, BackToFront>&);
+
+template void CCLayerIteratorActions::FrontToBack::next(CCLayerIterator<LayerChromium, LayerChromiumList, RenderSurfaceChromium, FrontToBack>&);
+template void CCLayerIteratorActions::FrontToBack::end(CCLayerIterator<LayerChromium, LayerChromiumList, RenderSurfaceChromium, FrontToBack>&);
+template void CCLayerIteratorActions::FrontToBack::begin(CCLayerIterator<LayerChromium, LayerChromiumList, RenderSurfaceChromium, FrontToBack>&);
+template void CCLayerIteratorActions::FrontToBack::goToHighestInSubtree(CCLayerIterator<LayerChromium, LayerChromiumList, RenderSurfaceChromium, FrontToBack>&);
+
+template void CCLayerIteratorActions::FrontToBack::next(CCLayerIterator<CCLayerImpl, CCLayerImplList, CCRenderSurface, FrontToBack>&);
+template void CCLayerIteratorActions::FrontToBack::end(CCLayerIterator<CCLayerImpl, CCLayerImplList, CCRenderSurface, FrontToBack>&);
+template void CCLayerIteratorActions::FrontToBack::begin(CCLayerIterator<CCLayerImpl, CCLayerImplList, CCRenderSurface, FrontToBack>&);
+template void CCLayerIteratorActions::FrontToBack::goToHighestInSubtree(CCLayerIterator<CCLayerImpl, CCLayerImplList, CCRenderSurface, FrontToBack>&);
} // namespace cc
diff --git a/cc/CCLayerIterator.h b/cc/CCLayerIterator.h
index 7fc3af4..4d36080 100644
--- a/cc/CCLayerIterator.h
+++ b/cc/CCLayerIterator.h
@@ -7,7 +7,7 @@
#include "CCLayerTreeHostCommon.h"
-#include <wtf/RefPtr.h>
+#include "base/memory/ref_counted.h"
namespace cc {
@@ -15,7 +15,7 @@ namespace cc {
// Example code follows, for a tree of LayerChromium/RenderSurfaceChromium objects. See below for details.
//
-// void doStuffOnLayers(const Vector<RefPtr<LayerChromium> >& renderSurfaceLayerList)
+// void doStuffOnLayers(const std::vector<scoped_refptr<LayerChromium> >& renderSurfaceLayerList)
// {
// typedef CCLayerIterator<LayerChromium, RenderSurfaceChromium, CCLayerIteratorActions::FrontToBack> CCLayerIteratorType;
//
@@ -131,13 +131,13 @@ private:
}
}
- if (start && !renderSurfaceLayerList->isEmpty())
+ if (start && !renderSurfaceLayerList->empty())
m_actions.begin(*this);
else
m_actions.end(*this);
}
- inline static LayerChromium* getRawPtr(const RefPtr<LayerChromium>& ptr) { return ptr.get(); }
+ inline static LayerChromium* getRawPtr(const scoped_refptr<LayerChromium>& ptr) { return ptr.get(); }
inline static CCLayerImpl* getRawPtr(CCLayerImpl* ptr) { return ptr; }
inline LayerType* currentLayer() const { return currentLayerRepresentsTargetRenderSurface() ? targetRenderSurfaceLayer() : getRawPtr(targetRenderSurfaceChildren()[m_currentLayerIndex]); }
diff --git a/cc/CCLayerIteratorTest.cpp b/cc/CCLayerIteratorTest.cpp
index 36d22da..569f319 100644
--- a/cc/CCLayerIteratorTest.cpp
+++ b/cc/CCLayerIteratorTest.cpp
@@ -23,7 +23,7 @@ namespace {
class TestLayerChromium : public LayerChromium {
public:
- static PassRefPtr<TestLayerChromium> create() { return adoptRef(new TestLayerChromium()); }
+ static scoped_refptr<TestLayerChromium> create() { return make_scoped_refptr(new TestLayerChromium()); }
int m_countRepresentingTargetSurface;
int m_countRepresentingContributingSurface;
@@ -41,6 +41,9 @@ private:
setPosition(IntPoint());
setAnchorPoint(IntPoint());
}
+ virtual ~TestLayerChromium()
+ {
+ }
bool m_drawsContent;
};
@@ -50,10 +53,10 @@ private:
EXPECT_EQ(contrib, layer->m_countRepresentingContributingSurface); \
EXPECT_EQ(itself, layer->m_countRepresentingItself);
-typedef CCLayerIterator<LayerChromium, Vector<RefPtr<LayerChromium> >, RenderSurfaceChromium, CCLayerIteratorActions::FrontToBack> FrontToBack;
-typedef CCLayerIterator<LayerChromium, Vector<RefPtr<LayerChromium> >, RenderSurfaceChromium, CCLayerIteratorActions::BackToFront> BackToFront;
+typedef CCLayerIterator<LayerChromium, std::vector<scoped_refptr<LayerChromium> >, RenderSurfaceChromium, CCLayerIteratorActions::FrontToBack> FrontToBack;
+typedef CCLayerIterator<LayerChromium, std::vector<scoped_refptr<LayerChromium> >, RenderSurfaceChromium, CCLayerIteratorActions::BackToFront> BackToFront;
-void resetCounts(Vector<RefPtr<LayerChromium> >& renderSurfaceLayerList)
+void resetCounts(std::vector<scoped_refptr<LayerChromium> >& renderSurfaceLayerList)
{
for (unsigned surfaceIndex = 0; surfaceIndex < renderSurfaceLayerList.size(); ++surfaceIndex) {
TestLayerChromium* renderSurfaceLayer = static_cast<TestLayerChromium*>(renderSurfaceLayerList[surfaceIndex].get());
@@ -73,7 +76,7 @@ void resetCounts(Vector<RefPtr<LayerChromium> >& renderSurfaceLayerList)
}
}
-void iterateFrontToBack(Vector<RefPtr<LayerChromium> >* renderSurfaceLayerList)
+void iterateFrontToBack(std::vector<scoped_refptr<LayerChromium> >* renderSurfaceLayerList)
{
resetCounts(*renderSurfaceLayerList);
int count = 0;
@@ -88,7 +91,7 @@ void iterateFrontToBack(Vector<RefPtr<LayerChromium> >* renderSurfaceLayerList)
}
}
-void iterateBackToFront(Vector<RefPtr<LayerChromium> >* renderSurfaceLayerList)
+void iterateBackToFront(std::vector<scoped_refptr<LayerChromium> >* renderSurfaceLayerList)
{
resetCounts(*renderSurfaceLayerList);
int count = 0;
@@ -105,7 +108,7 @@ void iterateBackToFront(Vector<RefPtr<LayerChromium> >* renderSurfaceLayerList)
TEST(CCLayerIteratorTest, emptyTree)
{
- Vector<RefPtr<LayerChromium> > renderSurfaceLayerList;
+ std::vector<scoped_refptr<LayerChromium> > renderSurfaceLayerList;
iterateBackToFront(&renderSurfaceLayerList);
iterateFrontToBack(&renderSurfaceLayerList);
@@ -113,11 +116,11 @@ TEST(CCLayerIteratorTest, emptyTree)
TEST(CCLayerIteratorTest, simpleTree)
{
- RefPtr<TestLayerChromium> rootLayer = TestLayerChromium::create();
- RefPtr<TestLayerChromium> first = TestLayerChromium::create();
- RefPtr<TestLayerChromium> second = TestLayerChromium::create();
- RefPtr<TestLayerChromium> third = TestLayerChromium::create();
- RefPtr<TestLayerChromium> fourth = TestLayerChromium::create();
+ scoped_refptr<TestLayerChromium> rootLayer = TestLayerChromium::create();
+ scoped_refptr<TestLayerChromium> first = TestLayerChromium::create();
+ scoped_refptr<TestLayerChromium> second = TestLayerChromium::create();
+ scoped_refptr<TestLayerChromium> third = TestLayerChromium::create();
+ scoped_refptr<TestLayerChromium> fourth = TestLayerChromium::create();
rootLayer->createRenderSurface();
@@ -126,7 +129,7 @@ TEST(CCLayerIteratorTest, simpleTree)
rootLayer->addChild(third);
rootLayer->addChild(fourth);
- Vector<RefPtr<LayerChromium> > renderSurfaceLayerList;
+ std::vector<scoped_refptr<LayerChromium> > renderSurfaceLayerList;
CCLayerTreeHostCommon::calculateDrawTransforms(rootLayer.get(), rootLayer->bounds(), 1, 256, renderSurfaceLayerList);
CCLayerTreeHostCommon::calculateVisibleRects(renderSurfaceLayerList);
@@ -148,15 +151,15 @@ TEST(CCLayerIteratorTest, simpleTree)
TEST(CCLayerIteratorTest, complexTree)
{
- RefPtr<TestLayerChromium> rootLayer = TestLayerChromium::create();
- RefPtr<TestLayerChromium> root1 = TestLayerChromium::create();
- RefPtr<TestLayerChromium> root2 = TestLayerChromium::create();
- RefPtr<TestLayerChromium> root3 = TestLayerChromium::create();
- RefPtr<TestLayerChromium> root21 = TestLayerChromium::create();
- RefPtr<TestLayerChromium> root22 = TestLayerChromium::create();
- RefPtr<TestLayerChromium> root23 = TestLayerChromium::create();
- RefPtr<TestLayerChromium> root221 = TestLayerChromium::create();
- RefPtr<TestLayerChromium> root231 = TestLayerChromium::create();
+ scoped_refptr<TestLayerChromium> rootLayer = TestLayerChromium::create();
+ scoped_refptr<TestLayerChromium> root1 = TestLayerChromium::create();
+ scoped_refptr<TestLayerChromium> root2 = TestLayerChromium::create();
+ scoped_refptr<TestLayerChromium> root3 = TestLayerChromium::create();
+ scoped_refptr<TestLayerChromium> root21 = TestLayerChromium::create();
+ scoped_refptr<TestLayerChromium> root22 = TestLayerChromium::create();
+ scoped_refptr<TestLayerChromium> root23 = TestLayerChromium::create();
+ scoped_refptr<TestLayerChromium> root221 = TestLayerChromium::create();
+ scoped_refptr<TestLayerChromium> root231 = TestLayerChromium::create();
rootLayer->createRenderSurface();
@@ -169,7 +172,7 @@ TEST(CCLayerIteratorTest, complexTree)
root22->addChild(root221);
root23->addChild(root231);
- Vector<RefPtr<LayerChromium> > renderSurfaceLayerList;
+ std::vector<scoped_refptr<LayerChromium> > renderSurfaceLayerList;
CCLayerTreeHostCommon::calculateDrawTransforms(rootLayer.get(), rootLayer->bounds(), 1, 256, renderSurfaceLayerList);
CCLayerTreeHostCommon::calculateVisibleRects(renderSurfaceLayerList);
@@ -199,15 +202,15 @@ TEST(CCLayerIteratorTest, complexTree)
TEST(CCLayerIteratorTest, complexTreeMultiSurface)
{
- RefPtr<TestLayerChromium> rootLayer = TestLayerChromium::create();
- RefPtr<TestLayerChromium> root1 = TestLayerChromium::create();
- RefPtr<TestLayerChromium> root2 = TestLayerChromium::create();
- RefPtr<TestLayerChromium> root3 = TestLayerChromium::create();
- RefPtr<TestLayerChromium> root21 = TestLayerChromium::create();
- RefPtr<TestLayerChromium> root22 = TestLayerChromium::create();
- RefPtr<TestLayerChromium> root23 = TestLayerChromium::create();
- RefPtr<TestLayerChromium> root221 = TestLayerChromium::create();
- RefPtr<TestLayerChromium> root231 = TestLayerChromium::create();
+ scoped_refptr<TestLayerChromium> rootLayer = TestLayerChromium::create();
+ scoped_refptr<TestLayerChromium> root1 = TestLayerChromium::create();
+ scoped_refptr<TestLayerChromium> root2 = TestLayerChromium::create();
+ scoped_refptr<TestLayerChromium> root3 = TestLayerChromium::create();
+ scoped_refptr<TestLayerChromium> root21 = TestLayerChromium::create();
+ scoped_refptr<TestLayerChromium> root22 = TestLayerChromium::create();
+ scoped_refptr<TestLayerChromium> root23 = TestLayerChromium::create();
+ scoped_refptr<TestLayerChromium> root221 = TestLayerChromium::create();
+ scoped_refptr<TestLayerChromium> root231 = TestLayerChromium::create();
rootLayer->createRenderSurface();
rootLayer->renderSurface()->setContentRect(IntRect(IntPoint(), rootLayer->bounds()));
@@ -225,7 +228,7 @@ TEST(CCLayerIteratorTest, complexTreeMultiSurface)
root23->setOpacity(0.5);
root23->addChild(root231);
- Vector<RefPtr<LayerChromium> > renderSurfaceLayerList;
+ std::vector<scoped_refptr<LayerChromium> > renderSurfaceLayerList;
CCLayerTreeHostCommon::calculateDrawTransforms(rootLayer.get(), rootLayer->bounds(), 1, 256, renderSurfaceLayerList);
CCLayerTreeHostCommon::calculateVisibleRects(renderSurfaceLayerList);
diff --git a/cc/CCLayerSorter.h b/cc/CCLayerSorter.h
index 4402851..d4ca664 100644
--- a/cc/CCLayerSorter.h
+++ b/cc/CCLayerSorter.h
@@ -10,6 +10,7 @@
#include "FloatPoint3D.h"
#include "FloatQuad.h"
#include "FloatRect.h"
+#include <vector>
#include <wtf/HashMap.h>
#include <wtf/Vector.h>
@@ -24,7 +25,7 @@ public:
CCLayerSorter();
~CCLayerSorter();
- typedef Vector<CCLayerImpl*> LayerList;
+ typedef std::vector<CCLayerImpl*> LayerList;
void sort(LayerList::iterator first, LayerList::iterator last);
diff --git a/cc/CCLayerSorterTest.cpp b/cc/CCLayerSorterTest.cpp
index e3df5d5..d8a3675 100644
--- a/cc/CCLayerSorterTest.cpp
+++ b/cc/CCLayerSorterTest.cpp
@@ -239,12 +239,12 @@ TEST(CCLayerSorterTest, verifyExistingOrderingPreservedWhenNoZDiff)
layer5->setDrawTransform(BehindMatrix);
layer5->setDrawsContent(true);
- Vector<CCLayerImpl*> layerList;
- layerList.append(layer1.get());
- layerList.append(layer2.get());
- layerList.append(layer3.get());
- layerList.append(layer4.get());
- layerList.append(layer5.get());
+ std::vector<CCLayerImpl*> layerList;
+ layerList.push_back(layer1.get());
+ layerList.push_back(layer2.get());
+ layerList.push_back(layer3.get());
+ layerList.push_back(layer4.get());
+ layerList.push_back(layer5.get());
ASSERT_EQ(static_cast<size_t>(5), layerList.size());
EXPECT_EQ(1, layerList[0]->id());
diff --git a/cc/CCLayerTreeHost.cpp b/cc/CCLayerTreeHost.cpp
index ea27d4d..3f4b0dc 100644
--- a/cc/CCLayerTreeHost.cpp
+++ b/cc/CCLayerTreeHost.cpp
@@ -392,7 +392,7 @@ void CCLayerTreeHost::didAddAnimation()
m_proxy->didAddAnimation();
}
-void CCLayerTreeHost::setRootLayer(PassRefPtr<LayerChromium> rootLayer)
+void CCLayerTreeHost::setRootLayer(scoped_refptr<LayerChromium> rootLayer)
{
if (m_rootLayer == rootLayer)
return;
@@ -554,7 +554,7 @@ static void updateLayerScale(LayerChromium* layer, float deviceScaleFactor, floa
if (replicaMaskLayer)
setScale(replicaMaskLayer, deviceScaleFactor, pageScaleFactor);
- const Vector<RefPtr<LayerChromium> >& children = layer->children();
+ const std::vector<scoped_refptr<LayerChromium> >& children = layer->children();
for (unsigned int i = 0; i < children.size(); ++i)
updateLayerScale(children[i].get(), deviceScaleFactor, pageScaleFactor);
}
@@ -596,7 +596,7 @@ void CCLayerTreeHost::setPrioritiesForSurfaces(size_t surfaceMemoryBytes)
void CCLayerTreeHost::setPrioritiesForLayers(const LayerList& updateList)
{
// Use BackToFront since it's cheap and this isn't order-dependent.
- typedef CCLayerIterator<LayerChromium, Vector<RefPtr<LayerChromium> >, RenderSurfaceChromium, CCLayerIteratorActions::BackToFront> CCLayerIteratorType;
+ typedef CCLayerIterator<LayerChromium, LayerList, RenderSurfaceChromium, CCLayerIteratorActions::BackToFront> CCLayerIteratorType;
CCPriorityCalculator calculator;
CCLayerIteratorType end = CCLayerIteratorType::end(&updateList);
@@ -676,7 +676,7 @@ bool CCLayerTreeHost::paintMasksForRenderSurface(LayerChromium* renderSurfaceLay
bool CCLayerTreeHost::paintLayerContents(const LayerList& renderSurfaceLayerList, CCTextureUpdateQueue& queue)
{
// Use FrontToBack to allow for testing occlusion and performing culling during the tree walk.
- typedef CCLayerIterator<LayerChromium, Vector<RefPtr<LayerChromium> >, RenderSurfaceChromium, CCLayerIteratorActions::FrontToBack> CCLayerIteratorType;
+ typedef CCLayerIterator<LayerChromium, LayerList, RenderSurfaceChromium, CCLayerIteratorActions::FrontToBack> CCLayerIteratorType;
bool needMoreUpdates = false;
bool recordMetricsForFrame = true; // FIXME: In the future, disable this when about:tracing is off.
diff --git a/cc/CCLayerTreeHost.h b/cc/CCLayerTreeHost.h
index ac04bea..4eccef2 100644
--- a/cc/CCLayerTreeHost.h
+++ b/cc/CCLayerTreeHost.h
@@ -6,6 +6,7 @@
#define CCLayerTreeHost_h
#include "base/basictypes.h"
+#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "cc/own_ptr_vector.h"
#include "CCAnimationEvents.h"
@@ -23,7 +24,6 @@
#include <wtf/HashMap.h>
#include <wtf/OwnPtr.h>
#include <wtf/PassOwnPtr.h>
-#include <wtf/PassRefPtr.h>
namespace cc {
@@ -152,7 +152,7 @@ public:
LayerChromium* rootLayer() { return m_rootLayer.get(); }
const LayerChromium* rootLayer() const { return m_rootLayer.get(); }
- void setRootLayer(PassRefPtr<LayerChromium>);
+ void setRootLayer(scoped_refptr<LayerChromium>);
const CCLayerTreeSettings& settings() const { return m_settings; }
@@ -214,7 +214,7 @@ protected:
bool initialize();
private:
- typedef Vector<RefPtr<LayerChromium> > LayerList;
+ typedef std::vector<scoped_refptr<LayerChromium> > LayerList;
void initializeRenderer();
@@ -247,8 +247,8 @@ private:
int m_numTimesRecreateShouldFail;
int m_numFailedRecreateAttempts;
- RefPtr<LayerChromium> m_rootLayer;
- RefPtr<HeadsUpDisplayLayerChromium> m_hudLayer;
+ scoped_refptr<LayerChromium> m_rootLayer;
+ scoped_refptr<HeadsUpDisplayLayerChromium> m_hudLayer;
scoped_ptr<CCFontAtlas> m_fontAtlas;
OwnPtr<CCPrioritizedTextureManager> m_contentsTextureManager;
diff --git a/cc/CCLayerTreeHostCommon.cpp b/cc/CCLayerTreeHostCommon.cpp
index 141b3ff..197625d 100644
--- a/cc/CCLayerTreeHostCommon.cpp
+++ b/cc/CCLayerTreeHostCommon.cpp
@@ -343,8 +343,8 @@ void setupRootLayerAndSurfaceForRecursion(LayerType* rootLayer, LayerList& rende
rootLayer->renderSurface()->setContentRect(IntRect(IntPoint::zero(), deviceViewportSize));
rootLayer->renderSurface()->clearLayerLists();
- ASSERT(renderSurfaceLayerList.isEmpty());
- renderSurfaceLayerList.append(rootLayer);
+ ASSERT(renderSurfaceLayerList.empty());
+ renderSurfaceLayerList.push_back(rootLayer);
}
// Recursively walks the layer tree starting at the given node and computes all the
@@ -579,7 +579,7 @@ static void calculateDrawTransformsInternal(LayerType* layer, LayerType* rootLay
renderSurface->setNearestAncestorThatMovesPixels(nearestAncestorThatMovesPixels);
- renderSurfaceLayerList.append(layer);
+ renderSurfaceLayerList.push_back(layer);
} else {
layer->setDrawTransform(drawTransform);
layer->setDrawTransformIsAnimating(animatingTransformToTarget);
@@ -637,7 +637,7 @@ static void calculateDrawTransformsInternal(LayerType* layer, LayerType* rootLay
unsigned sortingStartIndex = descendants.size();
if (!layerShouldBeSkipped(layer))
- descendants.append(layer);
+ descendants.push_back(layer);
WebTransformationMatrix nextScrollCompensationMatrix = computeScrollCompensationMatrixForChildren(layer, parentMatrix, currentScrollCompensationMatrix);;
@@ -651,7 +651,7 @@ static void calculateDrawTransformsInternal(LayerType* layer, LayerType* rootLay
if (!drawableContentRectOfChildSubtree.isEmpty()) {
accumulatedDrawableContentRectOfChildren.unite(drawableContentRectOfChildSubtree);
if (child->renderSurface())
- descendants.append(child);
+ descendants.push_back(child);
}
}
@@ -727,12 +727,12 @@ static void calculateDrawTransformsInternal(LayerType* layer, LayerType* rootLay
// entire subtree of surfaces to fix a crash bug. The root cause is
// https://bugs.webkit.org/show_bug.cgi?id=74147 and we should be able
// to put the original assert after fixing that.
- while (renderSurfaceLayerList.last() != layer) {
- renderSurfaceLayerList.last()->clearRenderSurface();
- renderSurfaceLayerList.removeLast();
+ while (renderSurfaceLayerList.back() != layer) {
+ renderSurfaceLayerList.back()->clearRenderSurface();
+ renderSurfaceLayerList.pop_back();
}
- ASSERT(renderSurfaceLayerList.last() == layer);
- renderSurfaceLayerList.removeLast();
+ ASSERT(renderSurfaceLayerList.back() == layer);
+ renderSurfaceLayerList.pop_back();
layer->clearRenderSurface();
return;
}
@@ -746,7 +746,7 @@ static void calculateDrawTransformsInternal(LayerType* layer, LayerType* rootLay
// drawn from back to front. If the preserves-3d property is also set on the parent then
// skip the sorting as the parent will sort all the descendants anyway.
if (descendants.size() && layer->preserves3D() && (!layer->parent() || !layer->parent()->preserves3D()))
- sortLayers(&descendants.at(sortingStartIndex), descendants.end(), layerSorter);
+ sortLayers(descendants.begin() + sortingStartIndex, descendants.end(), layerSorter);
if (layer->renderSurface())
drawableContentRectOfSubtree = enclosingIntRect(layer->renderSurface()->drawableContentRect());
@@ -782,42 +782,42 @@ static void calculateVisibleRectsInternal(const LayerList& renderSurfaceLayerLis
}
}
-void CCLayerTreeHostCommon::calculateDrawTransforms(LayerChromium* rootLayer, const IntSize& deviceViewportSize, float deviceScaleFactor, int maxTextureSize, Vector<RefPtr<LayerChromium> >& renderSurfaceLayerList)
+void CCLayerTreeHostCommon::calculateDrawTransforms(LayerChromium* rootLayer, const IntSize& deviceViewportSize, float deviceScaleFactor, int maxTextureSize, std::vector<scoped_refptr<LayerChromium> >& renderSurfaceLayerList)
{
IntRect totalDrawableContentRect;
WebTransformationMatrix identityMatrix;
WebTransformationMatrix deviceScaleTransform;
deviceScaleTransform.scale(deviceScaleFactor);
- setupRootLayerAndSurfaceForRecursion<LayerChromium, Vector<RefPtr<LayerChromium> > >(rootLayer, renderSurfaceLayerList, deviceViewportSize);
+ setupRootLayerAndSurfaceForRecursion<LayerChromium, std::vector<scoped_refptr<LayerChromium> > >(rootLayer, renderSurfaceLayerList, deviceViewportSize);
- cc::calculateDrawTransformsInternal<LayerChromium, Vector<RefPtr<LayerChromium> >, RenderSurfaceChromium, void>(rootLayer, rootLayer, deviceScaleTransform, identityMatrix, identityMatrix,
+ cc::calculateDrawTransformsInternal<LayerChromium, std::vector<scoped_refptr<LayerChromium> >, RenderSurfaceChromium, void>(rootLayer, rootLayer, deviceScaleTransform, identityMatrix, identityMatrix,
rootLayer->renderSurface()->contentRect(), true, 0, renderSurfaceLayerList,
rootLayer->renderSurface()->layerList(), 0, maxTextureSize, deviceScaleFactor, totalDrawableContentRect);
}
-void CCLayerTreeHostCommon::calculateDrawTransforms(CCLayerImpl* rootLayer, const IntSize& deviceViewportSize, float deviceScaleFactor, CCLayerSorter* layerSorter, int maxTextureSize, Vector<CCLayerImpl*>& renderSurfaceLayerList)
+void CCLayerTreeHostCommon::calculateDrawTransforms(CCLayerImpl* rootLayer, const IntSize& deviceViewportSize, float deviceScaleFactor, CCLayerSorter* layerSorter, int maxTextureSize, std::vector<CCLayerImpl*>& renderSurfaceLayerList)
{
IntRect totalDrawableContentRect;
WebTransformationMatrix identityMatrix;
WebTransformationMatrix deviceScaleTransform;
deviceScaleTransform.scale(deviceScaleFactor);
- setupRootLayerAndSurfaceForRecursion<CCLayerImpl, Vector<CCLayerImpl*> >(rootLayer, renderSurfaceLayerList, deviceViewportSize);
+ setupRootLayerAndSurfaceForRecursion<CCLayerImpl, std::vector<CCLayerImpl*> >(rootLayer, renderSurfaceLayerList, deviceViewportSize);
- cc::calculateDrawTransformsInternal<CCLayerImpl, Vector<CCLayerImpl*>, CCRenderSurface, CCLayerSorter>(rootLayer, rootLayer, deviceScaleTransform, identityMatrix, identityMatrix,
+ cc::calculateDrawTransformsInternal<CCLayerImpl, std::vector<CCLayerImpl*>, CCRenderSurface, CCLayerSorter>(rootLayer, rootLayer, deviceScaleTransform, identityMatrix, identityMatrix,
rootLayer->renderSurface()->contentRect(), true, 0, renderSurfaceLayerList,
rootLayer->renderSurface()->layerList(), layerSorter, maxTextureSize, deviceScaleFactor, totalDrawableContentRect);
}
-void CCLayerTreeHostCommon::calculateVisibleRects(Vector<RefPtr<LayerChromium> >& renderSurfaceLayerList)
+void CCLayerTreeHostCommon::calculateVisibleRects(std::vector<scoped_refptr<LayerChromium> >& renderSurfaceLayerList)
{
- calculateVisibleRectsInternal<LayerChromium, Vector<RefPtr<LayerChromium> >, RenderSurfaceChromium>(renderSurfaceLayerList);
+ calculateVisibleRectsInternal<LayerChromium, std::vector<scoped_refptr<LayerChromium> >, RenderSurfaceChromium>(renderSurfaceLayerList);
}
-void CCLayerTreeHostCommon::calculateVisibleRects(Vector<CCLayerImpl*>& renderSurfaceLayerList)
+void CCLayerTreeHostCommon::calculateVisibleRects(std::vector<CCLayerImpl*>& renderSurfaceLayerList)
{
- calculateVisibleRectsInternal<CCLayerImpl, Vector<CCLayerImpl*>, CCRenderSurface>(renderSurfaceLayerList);
+ calculateVisibleRectsInternal<CCLayerImpl, std::vector<CCLayerImpl*>, CCRenderSurface>(renderSurfaceLayerList);
}
static bool pointHitsRect(const IntPoint& viewportPoint, const WebTransformationMatrix& localSpaceToScreenSpaceTransform, FloatRect localSpaceRect)
@@ -859,11 +859,11 @@ static bool pointIsClippedBySurfaceOrClipRect(const IntPoint& viewportPoint, CCL
return false;
}
-CCLayerImpl* CCLayerTreeHostCommon::findLayerThatIsHitByPoint(const IntPoint& viewportPoint, Vector<CCLayerImpl*>& renderSurfaceLayerList)
+CCLayerImpl* CCLayerTreeHostCommon::findLayerThatIsHitByPoint(const IntPoint& viewportPoint, std::vector<CCLayerImpl*>& renderSurfaceLayerList)
{
CCLayerImpl* foundLayer = 0;
- typedef CCLayerIterator<CCLayerImpl, Vector<CCLayerImpl*>, CCRenderSurface, CCLayerIteratorActions::FrontToBack> CCLayerIteratorType;
+ typedef CCLayerIterator<CCLayerImpl, std::vector<CCLayerImpl*>, CCRenderSurface, CCLayerIteratorActions::FrontToBack> CCLayerIteratorType;
CCLayerIteratorType end = CCLayerIteratorType::end(&renderSurfaceLayerList);
for (CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList); it != end; ++it) {
diff --git a/cc/CCLayerTreeHostCommon.h b/cc/CCLayerTreeHostCommon.h
index 55d137c..eda7daf 100644
--- a/cc/CCLayerTreeHostCommon.h
+++ b/cc/CCLayerTreeHostCommon.h
@@ -5,11 +5,11 @@
#ifndef CCLayerTreeHostCommon_h
#define CCLayerTreeHostCommon_h
+#include "base/memory/ref_counted.h"
+#include "cc/own_ptr_vector.h"
#include "IntRect.h"
#include "IntSize.h"
-#include "cc/own_ptr_vector.h"
#include <public/WebTransformationMatrix.h>
-#include <wtf/RefPtr.h>
#include <wtf/Vector.h>
namespace cc {
@@ -22,14 +22,14 @@ class CCLayerTreeHostCommon {
public:
static IntRect calculateVisibleRect(const IntRect& targetSurfaceRect, const IntRect& layerBoundRect, const WebKit::WebTransformationMatrix&);
- static void calculateDrawTransforms(LayerChromium* rootLayer, const IntSize& deviceViewportSize, float deviceScaleFactor, int maxTextureSize, Vector<RefPtr<LayerChromium> >& renderSurfaceLayerList);
- static void calculateDrawTransforms(CCLayerImpl* rootLayer, const IntSize& deviceViewportSize, float deviceScaleFactor, CCLayerSorter*, int maxTextureSize, Vector<CCLayerImpl*>& renderSurfaceLayerList);
+ static void calculateDrawTransforms(LayerChromium* rootLayer, const IntSize& deviceViewportSize, float deviceScaleFactor, int maxTextureSize, std::vector<scoped_refptr<LayerChromium> >& renderSurfaceLayerList);
+ static void calculateDrawTransforms(CCLayerImpl* rootLayer, const IntSize& deviceViewportSize, float deviceScaleFactor, CCLayerSorter*, int maxTextureSize, std::vector<CCLayerImpl*>& renderSurfaceLayerList);
- static void calculateVisibleRects(Vector<CCLayerImpl*>& renderSurfaceLayerList);
- static void calculateVisibleRects(Vector<RefPtr<LayerChromium> >& renderSurfaceLayerList);
+ static void calculateVisibleRects(std::vector<CCLayerImpl*>& renderSurfaceLayerList);
+ static void calculateVisibleRects(std::vector<scoped_refptr<LayerChromium> >& renderSurfaceLayerList);
// Performs hit testing for a given renderSurfaceLayerList.
- static CCLayerImpl* findLayerThatIsHitByPoint(const IntPoint& viewportPoint, Vector<CCLayerImpl*>& renderSurfaceLayerList);
+ static CCLayerImpl* findLayerThatIsHitByPoint(const IntPoint& viewportPoint, std::vector<CCLayerImpl*>& renderSurfaceLayerList);
template<typename LayerType> static bool renderSurfaceContributesToTarget(LayerType*, int targetSurfaceLayerID);
@@ -37,7 +37,7 @@ public:
// from the given root layer (including mask and replica layers).
template<typename LayerType> static LayerType* findLayerInSubtree(LayerType* rootLayer, int layerId);
- static LayerChromium* getChildAsRawPtr(const Vector<RefPtr<LayerChromium> >& children, size_t index)
+ static LayerChromium* getChildAsRawPtr(const std::vector<scoped_refptr<LayerChromium> >& children, size_t index)
{
return children[index].get();
}
diff --git a/cc/CCLayerTreeHostCommonTest.cpp b/cc/CCLayerTreeHostCommonTest.cpp
index c23ae32..d4d3a90 100644
--- a/cc/CCLayerTreeHostCommonTest.cpp
+++ b/cc/CCLayerTreeHostCommonTest.cpp
@@ -54,7 +54,7 @@ void setLayerPropertiesForTesting(CCLayerImpl* layer, const WebTransformationMat
void executeCalculateDrawTransformsAndVisibility(LayerChromium* rootLayer, float deviceScaleFactor = 1)
{
WebTransformationMatrix identityMatrix;
- Vector<RefPtr<LayerChromium> > dummyRenderSurfaceLayerList;
+ std::vector<scoped_refptr<LayerChromium> > dummyRenderSurfaceLayerList;
int dummyMaxTextureSize = 512;
IntSize deviceViewportSize = IntSize(rootLayer->bounds().width() * deviceScaleFactor, rootLayer->bounds().height() * deviceScaleFactor);
@@ -69,7 +69,7 @@ void executeCalculateDrawTransformsAndVisibility(CCLayerImpl* rootLayer, float d
// Note: this version skips layer sorting.
WebTransformationMatrix identityMatrix;
- Vector<CCLayerImpl*> dummyRenderSurfaceLayerList;
+ std::vector<CCLayerImpl*> dummyRenderSurfaceLayerList;
int dummyMaxTextureSize = 512;
IntSize deviceViewportSize = IntSize(rootLayer->bounds().width() * deviceScaleFactor, rootLayer->bounds().height() * deviceScaleFactor);
@@ -123,6 +123,11 @@ public:
}
virtual bool drawsContent() const OVERRIDE { return true; }
+
+private:
+ virtual ~LayerChromiumWithForcedDrawsContent()
+ {
+ }
};
class MockContentLayerChromiumClient : public ContentLayerChromiumClient {
@@ -132,11 +137,11 @@ public:
virtual void paintContents(SkCanvas*, const IntRect& clip, FloatRect& opaque) OVERRIDE { }
};
-PassRefPtr<ContentLayerChromium> createDrawableContentLayerChromium(ContentLayerChromiumClient* delegate)
+scoped_refptr<ContentLayerChromium> createDrawableContentLayerChromium(ContentLayerChromiumClient* delegate)
{
- RefPtr<ContentLayerChromium> toReturn = ContentLayerChromium::create(delegate);
+ scoped_refptr<ContentLayerChromium> toReturn = ContentLayerChromium::create(delegate);
toReturn->setIsDrawable(true);
- return toReturn.release();
+ return toReturn;
}
TEST(CCLayerTreeHostCommonTest, verifyTransformsForNoOpLayer)
@@ -146,9 +151,9 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForNoOpLayer)
// screenSpaceTransform, and the hierarchy passed on to children
// layers should also be identity transforms.
- RefPtr<LayerChromium> parent = LayerChromium::create();
- RefPtr<LayerChromium> child = LayerChromium::create();
- RefPtr<LayerChromium> grandChild = LayerChromium::create();
+ scoped_refptr<LayerChromium> parent = LayerChromium::create();
+ scoped_refptr<LayerChromium> child = LayerChromium::create();
+ scoped_refptr<LayerChromium> grandChild = LayerChromium::create();
parent->addChild(child);
child->addChild(grandChild);
@@ -168,7 +173,7 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForNoOpLayer)
TEST(CCLayerTreeHostCommonTest, verifyTransformsForSingleLayer)
{
WebTransformationMatrix identityMatrix;
- RefPtr<LayerChromium> layer = LayerChromium::create();
+ scoped_refptr<LayerChromium> layer = LayerChromium::create();
// Case 1: setting the sublayer transform should not affect this layer's draw transform or screen-space transform.
WebTransformationMatrix arbitraryTranslation;
@@ -232,9 +237,9 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForSingleLayer)
TEST(CCLayerTreeHostCommonTest, verifyTransformsForSimpleHierarchy)
{
WebTransformationMatrix identityMatrix;
- RefPtr<LayerChromium> parent = LayerChromium::create();
- RefPtr<LayerChromium> child = LayerChromium::create();
- RefPtr<LayerChromium> grandChild = LayerChromium::create();
+ scoped_refptr<LayerChromium> parent = LayerChromium::create();
+ scoped_refptr<LayerChromium> child = LayerChromium::create();
+ scoped_refptr<LayerChromium> grandChild = LayerChromium::create();
parent->addChild(child);
child->addChild(grandChild);
@@ -310,9 +315,9 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForSimpleHierarchy)
TEST(CCLayerTreeHostCommonTest, verifyTransformsForSingleRenderSurface)
{
- RefPtr<LayerChromium> parent = LayerChromium::create();
- RefPtr<LayerChromium> child = LayerChromium::create();
- RefPtr<LayerChromiumWithForcedDrawsContent> grandChild = adoptRef(new LayerChromiumWithForcedDrawsContent());
+ scoped_refptr<LayerChromium> parent = LayerChromium::create();
+ scoped_refptr<LayerChromium> child = LayerChromium::create();
+ scoped_refptr<LayerChromiumWithForcedDrawsContent> grandChild = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent());
parent->addChild(child);
child->addChild(grandChild);
@@ -357,10 +362,10 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForSingleRenderSurface)
TEST(CCLayerTreeHostCommonTest, verifyTransformsForReplica)
{
- RefPtr<LayerChromium> parent = LayerChromium::create();
- RefPtr<LayerChromium> child = LayerChromium::create();
- RefPtr<LayerChromium> childReplica = LayerChromium::create();
- RefPtr<LayerChromiumWithForcedDrawsContent> grandChild = adoptRef(new LayerChromiumWithForcedDrawsContent());
+ scoped_refptr<LayerChromium> parent = LayerChromium::create();
+ scoped_refptr<LayerChromium> child = LayerChromium::create();
+ scoped_refptr<LayerChromium> childReplica = LayerChromium::create();
+ scoped_refptr<LayerChromiumWithForcedDrawsContent> grandChild = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent());
parent->addChild(child);
child->addChild(grandChild);
child->setReplicaLayer(childReplica.get());
@@ -411,17 +416,17 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForRenderSurfaceHierarchy)
// - Sanity check on recursion: verify transforms of layers described w.r.t. a render surface that is described w.r.t. an ancestor render surface.
// - verifying that each layer has a reference to the correct renderSurface and renderTarget values.
- RefPtr<LayerChromium> parent = LayerChromium::create();
- RefPtr<LayerChromium> renderSurface1 = LayerChromium::create();
- RefPtr<LayerChromium> renderSurface2 = LayerChromium::create();
- RefPtr<LayerChromium> childOfRoot = LayerChromium::create();
- RefPtr<LayerChromium> childOfRS1 = LayerChromium::create();
- RefPtr<LayerChromium> childOfRS2 = LayerChromium::create();
- RefPtr<LayerChromium> replicaOfRS1 = LayerChromium::create();
- RefPtr<LayerChromium> replicaOfRS2 = LayerChromium::create();
- RefPtr<LayerChromium> grandChildOfRoot = LayerChromium::create();
- RefPtr<LayerChromiumWithForcedDrawsContent> grandChildOfRS1 = adoptRef(new LayerChromiumWithForcedDrawsContent());
- RefPtr<LayerChromiumWithForcedDrawsContent> grandChildOfRS2 = adoptRef(new LayerChromiumWithForcedDrawsContent());
+ scoped_refptr<LayerChromium> parent = LayerChromium::create();
+ scoped_refptr<LayerChromium> renderSurface1 = LayerChromium::create();
+ scoped_refptr<LayerChromium> renderSurface2 = LayerChromium::create();
+ scoped_refptr<LayerChromium> childOfRoot = LayerChromium::create();
+ scoped_refptr<LayerChromium> childOfRS1 = LayerChromium::create();
+ scoped_refptr<LayerChromium> childOfRS2 = LayerChromium::create();
+ scoped_refptr<LayerChromium> replicaOfRS1 = LayerChromium::create();
+ scoped_refptr<LayerChromium> replicaOfRS2 = LayerChromium::create();
+ scoped_refptr<LayerChromium> grandChildOfRoot = LayerChromium::create();
+ scoped_refptr<LayerChromiumWithForcedDrawsContent> grandChildOfRS1 = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent());
+ scoped_refptr<LayerChromiumWithForcedDrawsContent> grandChildOfRS2 = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent());
parent->addChild(renderSurface1);
parent->addChild(childOfRoot);
renderSurface1->addChild(childOfRS1);
@@ -568,9 +573,9 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForFlatteningLayer)
// code is currently implemented, it is not expected to use a canonical orthographic
// projection.
- RefPtr<LayerChromium> root = LayerChromium::create();
- RefPtr<LayerChromium> child = LayerChromium::create();
- RefPtr<LayerChromiumWithForcedDrawsContent> grandChild = adoptRef(new LayerChromiumWithForcedDrawsContent());
+ scoped_refptr<LayerChromium> root = LayerChromium::create();
+ scoped_refptr<LayerChromium> child = LayerChromium::create();
+ scoped_refptr<LayerChromiumWithForcedDrawsContent> grandChild = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent());
WebTransformationMatrix rotationAboutYAxis;
rotationAboutYAxis.rotate3d(0, 30, 0);
@@ -614,9 +619,9 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForDegenerateIntermediateLayer)
// Normally this isn't a problem, because the layer wouldn't be drawn anyway, but if that layer becomes a renderSurface, then
// its drawTransform is implicitly inherited by the rest of the subtree, which then is positioned incorrectly as a result.
- RefPtr<LayerChromium> root = LayerChromium::create();
- RefPtr<LayerChromium> child = LayerChromium::create();
- RefPtr<LayerChromiumWithForcedDrawsContent> grandChild = adoptRef(new LayerChromiumWithForcedDrawsContent());
+ scoped_refptr<LayerChromium> root = LayerChromium::create();
+ scoped_refptr<LayerChromium> child = LayerChromium::create();
+ scoped_refptr<LayerChromiumWithForcedDrawsContent> grandChild = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent());
// The child height is zero, but has non-zero width that should be accounted for while computing drawTransforms.
const WebTransformationMatrix identityMatrix;
@@ -638,9 +643,9 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForDegenerateIntermediateLayer)
TEST(CCLayerTreeHostCommonTest, verifyRenderSurfaceListForRenderSurfaceWithClippedLayer)
{
- RefPtr<LayerChromium> parent = LayerChromium::create();
- RefPtr<LayerChromium> renderSurface1 = LayerChromium::create();
- RefPtr<LayerChromiumWithForcedDrawsContent> child = adoptRef(new LayerChromiumWithForcedDrawsContent());
+ scoped_refptr<LayerChromium> parent = LayerChromium::create();
+ scoped_refptr<LayerChromium> renderSurface1 = LayerChromium::create();
+ scoped_refptr<LayerChromiumWithForcedDrawsContent> child = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent());
const WebTransformationMatrix identityMatrix;
setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, FloatPoint::zero(), FloatPoint::zero(), IntSize(10, 10), false);
@@ -652,7 +657,7 @@ TEST(CCLayerTreeHostCommonTest, verifyRenderSurfaceListForRenderSurfaceWithClipp
renderSurface1->addChild(child);
renderSurface1->setForceRenderSurface(true);
- Vector<RefPtr<LayerChromium> > renderSurfaceLayerList;
+ std::vector<scoped_refptr<LayerChromium> > renderSurfaceLayerList;
int dummyMaxTextureSize = 512;
CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(), 1, dummyMaxTextureSize, renderSurfaceLayerList);
CCLayerTreeHostCommon::calculateVisibleRects(renderSurfaceLayerList);
@@ -667,9 +672,9 @@ TEST(CCLayerTreeHostCommonTest, verifyRenderSurfaceListForRenderSurfaceWithClipp
TEST(CCLayerTreeHostCommonTest, verifyRenderSurfaceListForTransparentChild)
{
- RefPtr<LayerChromium> parent = LayerChromium::create();
- RefPtr<LayerChromium> renderSurface1 = LayerChromium::create();
- RefPtr<LayerChromiumWithForcedDrawsContent> child = adoptRef(new LayerChromiumWithForcedDrawsContent());
+ scoped_refptr<LayerChromium> parent = LayerChromium::create();
+ scoped_refptr<LayerChromium> renderSurface1 = LayerChromium::create();
+ scoped_refptr<LayerChromiumWithForcedDrawsContent> child = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent());
const WebTransformationMatrix identityMatrix;
setLayerPropertiesForTesting(renderSurface1.get(), identityMatrix, identityMatrix, FloatPoint::zero(), FloatPoint::zero(), IntSize(10, 10), false);
@@ -680,7 +685,7 @@ TEST(CCLayerTreeHostCommonTest, verifyRenderSurfaceListForTransparentChild)
renderSurface1->setForceRenderSurface(true);
renderSurface1->setOpacity(0);
- Vector<RefPtr<LayerChromium> > renderSurfaceLayerList;
+ std::vector<scoped_refptr<LayerChromium> > renderSurfaceLayerList;
int dummyMaxTextureSize = 512;
CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(), 1, dummyMaxTextureSize, renderSurfaceLayerList);
CCLayerTreeHostCommon::calculateVisibleRects(renderSurfaceLayerList);
@@ -696,9 +701,9 @@ TEST(CCLayerTreeHostCommonTest, verifyRenderSurfaceListForTransparentChild)
TEST(CCLayerTreeHostCommonTest, verifyForceRenderSurface)
{
- RefPtr<LayerChromium> parent = LayerChromium::create();
- RefPtr<LayerChromium> renderSurface1 = LayerChromium::create();
- RefPtr<LayerChromiumWithForcedDrawsContent> child = adoptRef(new LayerChromiumWithForcedDrawsContent());
+ scoped_refptr<LayerChromium> parent = LayerChromium::create();
+ scoped_refptr<LayerChromium> renderSurface1 = LayerChromium::create();
+ scoped_refptr<LayerChromiumWithForcedDrawsContent> child = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent());
renderSurface1->setForceRenderSurface(true);
const WebTransformationMatrix identityMatrix;
@@ -713,7 +718,7 @@ TEST(CCLayerTreeHostCommonTest, verifyForceRenderSurface)
EXPECT_FALSE(parent->renderSurface());
EXPECT_FALSE(renderSurface1->renderSurface());
- Vector<RefPtr<LayerChromium> > renderSurfaceLayerList;
+ std::vector<scoped_refptr<LayerChromium> > renderSurfaceLayerList;
int dummyMaxTextureSize = 512;
CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(), 1, dummyMaxTextureSize, renderSurfaceLayerList);
@@ -1309,12 +1314,12 @@ TEST(CCLayerTreeHostCommonTest, verifyClipRectCullsRenderSurfaces)
//
const WebTransformationMatrix identityMatrix;
- RefPtr<LayerChromium> parent = LayerChromium::create();
- RefPtr<LayerChromium> child = LayerChromium::create();
- RefPtr<LayerChromium> grandChild = LayerChromium::create();
- RefPtr<LayerChromium> greatGrandChild = LayerChromium::create();
- RefPtr<LayerChromiumWithForcedDrawsContent> leafNode1 = adoptRef(new LayerChromiumWithForcedDrawsContent());
- RefPtr<LayerChromiumWithForcedDrawsContent> leafNode2 = adoptRef(new LayerChromiumWithForcedDrawsContent());
+ scoped_refptr<LayerChromium> parent = LayerChromium::create();
+ scoped_refptr<LayerChromium> child = LayerChromium::create();
+ scoped_refptr<LayerChromium> grandChild = LayerChromium::create();
+ scoped_refptr<LayerChromium> greatGrandChild = LayerChromium::create();
+ scoped_refptr<LayerChromiumWithForcedDrawsContent> leafNode1 = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent());
+ scoped_refptr<LayerChromiumWithForcedDrawsContent> leafNode2 = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent());
parent->addChild(child);
child->addChild(grandChild);
grandChild->addChild(greatGrandChild);
@@ -1336,7 +1341,7 @@ TEST(CCLayerTreeHostCommonTest, verifyClipRectCullsRenderSurfaces)
grandChild->setOpacity(0.5);
greatGrandChild->setOpacity(0.4f);
- Vector<RefPtr<LayerChromium> > renderSurfaceLayerList;
+ std::vector<scoped_refptr<LayerChromium> > renderSurfaceLayerList;
int dummyMaxTextureSize = 512;
CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(), 1, dummyMaxTextureSize, renderSurfaceLayerList);
CCLayerTreeHostCommon::calculateVisibleRects(renderSurfaceLayerList);
@@ -1366,10 +1371,10 @@ TEST(CCLayerTreeHostCommonTest, verifyClipRectCullsSurfaceWithoutVisibleContent)
// in the renderSurfaceLayerList.
const WebTransformationMatrix identityMatrix;
- RefPtr<LayerChromium> parent = LayerChromium::create();
- RefPtr<LayerChromium> child = LayerChromium::create();
- RefPtr<LayerChromium> grandChild = LayerChromium::create();
- RefPtr<LayerChromiumWithForcedDrawsContent> leafNode = adoptRef(new LayerChromiumWithForcedDrawsContent());
+ scoped_refptr<LayerChromium> parent = LayerChromium::create();
+ scoped_refptr<LayerChromium> child = LayerChromium::create();
+ scoped_refptr<LayerChromium> grandChild = LayerChromium::create();
+ scoped_refptr<LayerChromiumWithForcedDrawsContent> leafNode = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent());
parent->addChild(child);
child->addChild(grandChild);
grandChild->addChild(leafNode);
@@ -1383,7 +1388,7 @@ TEST(CCLayerTreeHostCommonTest, verifyClipRectCullsSurfaceWithoutVisibleContent)
child->setOpacity(0.4f);
grandChild->setOpacity(0.4f);
- Vector<RefPtr<LayerChromium> > renderSurfaceLayerList;
+ std::vector<scoped_refptr<LayerChromium> > renderSurfaceLayerList;
int dummyMaxTextureSize = 512;
CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(), 1, dummyMaxTextureSize, renderSurfaceLayerList);
@@ -1419,12 +1424,12 @@ TEST(CCLayerTreeHostCommonTest, verifyDrawableContentRectForLayers)
//
const WebTransformationMatrix identityMatrix;
- RefPtr<LayerChromium> parent = LayerChromium::create();
- RefPtr<LayerChromium> child = LayerChromium::create();
- RefPtr<LayerChromium> grandChild1 = LayerChromium::create();
- RefPtr<LayerChromium> grandChild2 = LayerChromium::create();
- RefPtr<LayerChromium> grandChild3 = LayerChromium::create();
- RefPtr<LayerChromium> grandChild4 = LayerChromium::create();
+ scoped_refptr<LayerChromium> parent = LayerChromium::create();
+ scoped_refptr<LayerChromium> child = LayerChromium::create();
+ scoped_refptr<LayerChromium> grandChild1 = LayerChromium::create();
+ scoped_refptr<LayerChromium> grandChild2 = LayerChromium::create();
+ scoped_refptr<LayerChromium> grandChild3 = LayerChromium::create();
+ scoped_refptr<LayerChromium> grandChild4 = LayerChromium::create();
parent->addChild(child);
child->addChild(grandChild1);
@@ -1449,7 +1454,7 @@ TEST(CCLayerTreeHostCommonTest, verifyDrawableContentRectForLayers)
grandChild3->setOpacity(0.5);
grandChild4->setOpacity(0.5);
- Vector<RefPtr<LayerChromium> > renderSurfaceLayerList;
+ std::vector<scoped_refptr<LayerChromium> > renderSurfaceLayerList;
int dummyMaxTextureSize = 512;
CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(), 1, dummyMaxTextureSize, renderSurfaceLayerList);
CCLayerTreeHostCommon::calculateVisibleRects(renderSurfaceLayerList);
@@ -1470,16 +1475,16 @@ TEST(CCLayerTreeHostCommonTest, verifyClipRectIsPropagatedCorrectlyToSurfaces)
//
const WebTransformationMatrix identityMatrix;
- RefPtr<LayerChromium> parent = LayerChromium::create();
- RefPtr<LayerChromium> child = LayerChromium::create();
- RefPtr<LayerChromium> grandChild1 = LayerChromium::create();
- RefPtr<LayerChromium> grandChild2 = LayerChromium::create();
- RefPtr<LayerChromium> grandChild3 = LayerChromium::create();
- RefPtr<LayerChromium> grandChild4 = LayerChromium::create();
- RefPtr<LayerChromiumWithForcedDrawsContent> leafNode1 = adoptRef(new LayerChromiumWithForcedDrawsContent());
- RefPtr<LayerChromiumWithForcedDrawsContent> leafNode2 = adoptRef(new LayerChromiumWithForcedDrawsContent());
- RefPtr<LayerChromiumWithForcedDrawsContent> leafNode3 = adoptRef(new LayerChromiumWithForcedDrawsContent());
- RefPtr<LayerChromiumWithForcedDrawsContent> leafNode4 = adoptRef(new LayerChromiumWithForcedDrawsContent());
+ scoped_refptr<LayerChromium> parent = LayerChromium::create();
+ scoped_refptr<LayerChromium> child = LayerChromium::create();
+ scoped_refptr<LayerChromium> grandChild1 = LayerChromium::create();
+ scoped_refptr<LayerChromium> grandChild2 = LayerChromium::create();
+ scoped_refptr<LayerChromium> grandChild3 = LayerChromium::create();
+ scoped_refptr<LayerChromium> grandChild4 = LayerChromium::create();
+ scoped_refptr<LayerChromiumWithForcedDrawsContent> leafNode1 = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent());
+ scoped_refptr<LayerChromiumWithForcedDrawsContent> leafNode2 = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent());
+ scoped_refptr<LayerChromiumWithForcedDrawsContent> leafNode3 = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent());
+ scoped_refptr<LayerChromiumWithForcedDrawsContent> leafNode4 = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent());
parent->addChild(child);
child->addChild(grandChild1);
@@ -1515,7 +1520,7 @@ TEST(CCLayerTreeHostCommonTest, verifyClipRectIsPropagatedCorrectlyToSurfaces)
grandChild3->setOpacity(0.5);
grandChild4->setOpacity(0.5);
- Vector<RefPtr<LayerChromium> > renderSurfaceLayerList;
+ std::vector<scoped_refptr<LayerChromium> > renderSurfaceLayerList;
int dummyMaxTextureSize = 512;
CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(), 1, dummyMaxTextureSize, renderSurfaceLayerList);
CCLayerTreeHostCommon::calculateVisibleRects(renderSurfaceLayerList);
@@ -1533,15 +1538,15 @@ TEST(CCLayerTreeHostCommonTest, verifyClipRectIsPropagatedCorrectlyToSurfaces)
TEST(CCLayerTreeHostCommonTest, verifyAnimationsForRenderSurfaceHierarchy)
{
- RefPtr<LayerChromium> parent = LayerChromium::create();
- RefPtr<LayerChromium> renderSurface1 = LayerChromium::create();
- RefPtr<LayerChromium> renderSurface2 = LayerChromium::create();
- RefPtr<LayerChromium> childOfRoot = LayerChromium::create();
- RefPtr<LayerChromium> childOfRS1 = LayerChromium::create();
- RefPtr<LayerChromium> childOfRS2 = LayerChromium::create();
- RefPtr<LayerChromium> grandChildOfRoot = LayerChromium::create();
- RefPtr<LayerChromiumWithForcedDrawsContent> grandChildOfRS1 = adoptRef(new LayerChromiumWithForcedDrawsContent());
- RefPtr<LayerChromiumWithForcedDrawsContent> grandChildOfRS2 = adoptRef(new LayerChromiumWithForcedDrawsContent());
+ scoped_refptr<LayerChromium> parent = LayerChromium::create();
+ scoped_refptr<LayerChromium> renderSurface1 = LayerChromium::create();
+ scoped_refptr<LayerChromium> renderSurface2 = LayerChromium::create();
+ scoped_refptr<LayerChromium> childOfRoot = LayerChromium::create();
+ scoped_refptr<LayerChromium> childOfRS1 = LayerChromium::create();
+ scoped_refptr<LayerChromium> childOfRS2 = LayerChromium::create();
+ scoped_refptr<LayerChromium> grandChildOfRoot = LayerChromium::create();
+ scoped_refptr<LayerChromiumWithForcedDrawsContent> grandChildOfRS1 = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent());
+ scoped_refptr<LayerChromiumWithForcedDrawsContent> grandChildOfRS2 = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent());
parent->addChild(renderSurface1);
parent->addChild(childOfRoot);
renderSurface1->addChild(childOfRS1);
@@ -1932,10 +1937,10 @@ TEST(CCLayerTreeHostCommonTest, verifyVisibleRectForPerspectiveUnprojection)
TEST(CCLayerTreeHostCommonTest, verifyDrawableAndVisibleContentRectsForSimpleLayers)
{
- RefPtr<LayerChromium> root = LayerChromium::create();
- RefPtr<LayerChromiumWithForcedDrawsContent> child1 = adoptRef(new LayerChromiumWithForcedDrawsContent());
- RefPtr<LayerChromiumWithForcedDrawsContent> child2 = adoptRef(new LayerChromiumWithForcedDrawsContent());
- RefPtr<LayerChromiumWithForcedDrawsContent> child3 = adoptRef(new LayerChromiumWithForcedDrawsContent());
+ scoped_refptr<LayerChromium> root = LayerChromium::create();
+ scoped_refptr<LayerChromiumWithForcedDrawsContent> child1 = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent());
+ scoped_refptr<LayerChromiumWithForcedDrawsContent> child2 = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent());
+ scoped_refptr<LayerChromiumWithForcedDrawsContent> child3 = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent());
root->addChild(child1);
root->addChild(child2);
root->addChild(child3);
@@ -1967,11 +1972,11 @@ TEST(CCLayerTreeHostCommonTest, verifyDrawableAndVisibleContentRectsForSimpleLay
TEST(CCLayerTreeHostCommonTest, verifyDrawableAndVisibleContentRectsForLayersClippedByLayer)
{
- RefPtr<LayerChromium> root = LayerChromium::create();
- RefPtr<LayerChromium> child = LayerChromium::create();
- RefPtr<LayerChromiumWithForcedDrawsContent> grandChild1 = adoptRef(new LayerChromiumWithForcedDrawsContent());
- RefPtr<LayerChromiumWithForcedDrawsContent> grandChild2 = adoptRef(new LayerChromiumWithForcedDrawsContent());
- RefPtr<LayerChromiumWithForcedDrawsContent> grandChild3 = adoptRef(new LayerChromiumWithForcedDrawsContent());
+ scoped_refptr<LayerChromium> root = LayerChromium::create();
+ scoped_refptr<LayerChromium> child = LayerChromium::create();
+ scoped_refptr<LayerChromiumWithForcedDrawsContent> grandChild1 = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent());
+ scoped_refptr<LayerChromiumWithForcedDrawsContent> grandChild2 = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent());
+ scoped_refptr<LayerChromiumWithForcedDrawsContent> grandChild3 = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent());
root->addChild(child);
child->addChild(grandChild1);
child->addChild(grandChild2);
@@ -2009,11 +2014,11 @@ TEST(CCLayerTreeHostCommonTest, verifyDrawableAndVisibleContentRectsForLayersCli
TEST(CCLayerTreeHostCommonTest, verifyDrawableAndVisibleContentRectsForLayersInUnclippedRenderSurface)
{
- RefPtr<LayerChromium> root = LayerChromium::create();
- RefPtr<LayerChromium> renderSurface1 = LayerChromium::create();
- RefPtr<LayerChromiumWithForcedDrawsContent> child1 = adoptRef(new LayerChromiumWithForcedDrawsContent());
- RefPtr<LayerChromiumWithForcedDrawsContent> child2 = adoptRef(new LayerChromiumWithForcedDrawsContent());
- RefPtr<LayerChromiumWithForcedDrawsContent> child3 = adoptRef(new LayerChromiumWithForcedDrawsContent());
+ scoped_refptr<LayerChromium> root = LayerChromium::create();
+ scoped_refptr<LayerChromium> renderSurface1 = LayerChromium::create();
+ scoped_refptr<LayerChromiumWithForcedDrawsContent> child1 = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent());
+ scoped_refptr<LayerChromiumWithForcedDrawsContent> child2 = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent());
+ scoped_refptr<LayerChromiumWithForcedDrawsContent> child3 = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent());
root->addChild(renderSurface1);
renderSurface1->addChild(child1);
renderSurface1->addChild(child2);
@@ -2053,11 +2058,11 @@ TEST(CCLayerTreeHostCommonTest, verifyDrawableAndVisibleContentRectsForLayersInU
TEST(CCLayerTreeHostCommonTest, verifyDrawableAndVisibleContentRectsForLayersInClippedRenderSurface)
{
- RefPtr<LayerChromium> root = LayerChromium::create();
- RefPtr<LayerChromium> renderSurface1 = LayerChromium::create();
- RefPtr<LayerChromiumWithForcedDrawsContent> child1 = adoptRef(new LayerChromiumWithForcedDrawsContent());
- RefPtr<LayerChromiumWithForcedDrawsContent> child2 = adoptRef(new LayerChromiumWithForcedDrawsContent());
- RefPtr<LayerChromiumWithForcedDrawsContent> child3 = adoptRef(new LayerChromiumWithForcedDrawsContent());
+ scoped_refptr<LayerChromium> root = LayerChromium::create();
+ scoped_refptr<LayerChromium> renderSurface1 = LayerChromium::create();
+ scoped_refptr<LayerChromiumWithForcedDrawsContent> child1 = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent());
+ scoped_refptr<LayerChromiumWithForcedDrawsContent> child2 = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent());
+ scoped_refptr<LayerChromiumWithForcedDrawsContent> child3 = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent());
root->addChild(renderSurface1);
renderSurface1->addChild(child1);
renderSurface1->addChild(child2);
@@ -2101,12 +2106,12 @@ TEST(CCLayerTreeHostCommonTest, verifyDrawableAndVisibleContentRectsForLayersInC
TEST(CCLayerTreeHostCommonTest, verifyDrawableAndVisibleContentRectsForSurfaceHierarchy)
{
// Check that clipping does not propagate down surfaces.
- RefPtr<LayerChromium> root = LayerChromium::create();
- RefPtr<LayerChromium> renderSurface1 = LayerChromium::create();
- RefPtr<LayerChromium> renderSurface2 = LayerChromium::create();
- RefPtr<LayerChromiumWithForcedDrawsContent> child1 = adoptRef(new LayerChromiumWithForcedDrawsContent());
- RefPtr<LayerChromiumWithForcedDrawsContent> child2 = adoptRef(new LayerChromiumWithForcedDrawsContent());
- RefPtr<LayerChromiumWithForcedDrawsContent> child3 = adoptRef(new LayerChromiumWithForcedDrawsContent());
+ scoped_refptr<LayerChromium> root = LayerChromium::create();
+ scoped_refptr<LayerChromium> renderSurface1 = LayerChromium::create();
+ scoped_refptr<LayerChromium> renderSurface2 = LayerChromium::create();
+ scoped_refptr<LayerChromiumWithForcedDrawsContent> child1 = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent());
+ scoped_refptr<LayerChromiumWithForcedDrawsContent> child2 = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent());
+ scoped_refptr<LayerChromiumWithForcedDrawsContent> child3 = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent());
root->addChild(renderSurface1);
renderSurface1->addChild(renderSurface2);
renderSurface2->addChild(child1);
@@ -2162,9 +2167,9 @@ TEST(CCLayerTreeHostCommonTest, verifyDrawableAndVisibleContentRectsWithTransfor
// Layers that have non-axis aligned bounds (due to transforms) have an expanded,
// axis-aligned drawableContentRect and visibleContentRect.
- RefPtr<LayerChromium> root = LayerChromium::create();
- RefPtr<LayerChromium> renderSurface1 = LayerChromium::create();
- RefPtr<LayerChromiumWithForcedDrawsContent> child1 = adoptRef(new LayerChromiumWithForcedDrawsContent());
+ scoped_refptr<LayerChromium> root = LayerChromium::create();
+ scoped_refptr<LayerChromium> renderSurface1 = LayerChromium::create();
+ scoped_refptr<LayerChromiumWithForcedDrawsContent> child1 = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent());
root->addChild(renderSurface1);
renderSurface1->addChild(child1);
@@ -2202,9 +2207,9 @@ TEST(CCLayerTreeHostCommonTest, verifyDrawableAndVisibleContentRectsWithTransfor
// Layers that have non-axis aligned bounds (due to transforms) have an expanded,
// axis-aligned drawableContentRect and visibleContentRect.
- RefPtr<LayerChromium> root = LayerChromium::create();
- RefPtr<LayerChromium> renderSurface1 = LayerChromium::create();
- RefPtr<LayerChromiumWithForcedDrawsContent> child1 = adoptRef(new LayerChromiumWithForcedDrawsContent());
+ scoped_refptr<LayerChromium> root = LayerChromium::create();
+ scoped_refptr<LayerChromium> renderSurface1 = LayerChromium::create();
+ scoped_refptr<LayerChromiumWithForcedDrawsContent> child1 = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent());
root->addChild(renderSurface1);
renderSurface1->addChild(child1);
@@ -2240,12 +2245,12 @@ TEST(CCLayerTreeHostCommonTest, verifyDrawableAndVisibleContentRectsInHighDPI)
{
MockContentLayerChromiumClient client;
- RefPtr<LayerChromium> root = LayerChromium::create();
- RefPtr<ContentLayerChromium> renderSurface1 = createDrawableContentLayerChromium(&client);
- RefPtr<ContentLayerChromium> renderSurface2 = createDrawableContentLayerChromium(&client);
- RefPtr<ContentLayerChromium> child1 = createDrawableContentLayerChromium(&client);
- RefPtr<ContentLayerChromium> child2 = createDrawableContentLayerChromium(&client);
- RefPtr<ContentLayerChromium> child3 = createDrawableContentLayerChromium(&client);
+ scoped_refptr<LayerChromium> root = LayerChromium::create();
+ scoped_refptr<ContentLayerChromium> renderSurface1 = createDrawableContentLayerChromium(&client);
+ scoped_refptr<ContentLayerChromium> renderSurface2 = createDrawableContentLayerChromium(&client);
+ scoped_refptr<ContentLayerChromium> child1 = createDrawableContentLayerChromium(&client);
+ scoped_refptr<ContentLayerChromium> child2 = createDrawableContentLayerChromium(&client);
+ scoped_refptr<ContentLayerChromium> child3 = createDrawableContentLayerChromium(&client);
root->addChild(renderSurface1);
renderSurface1->addChild(renderSurface2);
renderSurface2->addChild(child1);
@@ -2308,15 +2313,15 @@ TEST(CCLayerTreeHostCommonTest, verifyBackFaceCullingWithoutPreserves3d)
// parent layer according to current W3C spec.
const WebTransformationMatrix identityMatrix;
- RefPtr<LayerChromium> parent = LayerChromium::create();
- RefPtr<LayerChromiumWithForcedDrawsContent> frontFacingChild = adoptRef(new LayerChromiumWithForcedDrawsContent());
- RefPtr<LayerChromiumWithForcedDrawsContent> backFacingChild = adoptRef(new LayerChromiumWithForcedDrawsContent());
- RefPtr<LayerChromiumWithForcedDrawsContent> frontFacingSurface = adoptRef(new LayerChromiumWithForcedDrawsContent());
- RefPtr<LayerChromiumWithForcedDrawsContent> backFacingSurface = adoptRef(new LayerChromiumWithForcedDrawsContent());
- RefPtr<LayerChromiumWithForcedDrawsContent> frontFacingChildOfFrontFacingSurface = adoptRef(new LayerChromiumWithForcedDrawsContent());
- RefPtr<LayerChromiumWithForcedDrawsContent> backFacingChildOfFrontFacingSurface = adoptRef(new LayerChromiumWithForcedDrawsContent());
- RefPtr<LayerChromiumWithForcedDrawsContent> frontFacingChildOfBackFacingSurface = adoptRef(new LayerChromiumWithForcedDrawsContent());
- RefPtr<LayerChromiumWithForcedDrawsContent> backFacingChildOfBackFacingSurface = adoptRef(new LayerChromiumWithForcedDrawsContent());
+ scoped_refptr<LayerChromium> parent = LayerChromium::create();
+ scoped_refptr<LayerChromiumWithForcedDrawsContent> frontFacingChild = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent());
+ scoped_refptr<LayerChromiumWithForcedDrawsContent> backFacingChild = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent());
+ scoped_refptr<LayerChromiumWithForcedDrawsContent> frontFacingSurface = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent());
+ scoped_refptr<LayerChromiumWithForcedDrawsContent> backFacingSurface = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent());
+ scoped_refptr<LayerChromiumWithForcedDrawsContent> frontFacingChildOfFrontFacingSurface = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent());
+ scoped_refptr<LayerChromiumWithForcedDrawsContent> backFacingChildOfFrontFacingSurface = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent());
+ scoped_refptr<LayerChromiumWithForcedDrawsContent> frontFacingChildOfBackFacingSurface = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent());
+ scoped_refptr<LayerChromiumWithForcedDrawsContent> backFacingChildOfBackFacingSurface = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent());
parent->addChild(frontFacingChild);
parent->addChild(backFacingChild);
@@ -2358,7 +2363,7 @@ TEST(CCLayerTreeHostCommonTest, verifyBackFaceCullingWithoutPreserves3d)
setLayerPropertiesForTesting(frontFacingChildOfBackFacingSurface.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false);
setLayerPropertiesForTesting(backFacingChildOfBackFacingSurface.get(), backfaceMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false);
- Vector<RefPtr<LayerChromium> > renderSurfaceLayerList;
+ std::vector<scoped_refptr<LayerChromium> > renderSurfaceLayerList;
int dummyMaxTextureSize = 512;
CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(), 1, dummyMaxTextureSize, renderSurfaceLayerList);
@@ -2400,17 +2405,17 @@ TEST(CCLayerTreeHostCommonTest, verifyBackFaceCullingWithPreserves3d)
// Verify the behavior of back-face culling when preserves-3d transform style is used.
const WebTransformationMatrix identityMatrix;
- RefPtr<LayerChromium> parent = LayerChromium::create();
- RefPtr<LayerChromiumWithForcedDrawsContent> frontFacingChild = adoptRef(new LayerChromiumWithForcedDrawsContent());
- RefPtr<LayerChromiumWithForcedDrawsContent> backFacingChild = adoptRef(new LayerChromiumWithForcedDrawsContent());
- RefPtr<LayerChromiumWithForcedDrawsContent> frontFacingSurface = adoptRef(new LayerChromiumWithForcedDrawsContent());
- RefPtr<LayerChromiumWithForcedDrawsContent> backFacingSurface = adoptRef(new LayerChromiumWithForcedDrawsContent());
- RefPtr<LayerChromiumWithForcedDrawsContent> frontFacingChildOfFrontFacingSurface = adoptRef(new LayerChromiumWithForcedDrawsContent());
- RefPtr<LayerChromiumWithForcedDrawsContent> backFacingChildOfFrontFacingSurface = adoptRef(new LayerChromiumWithForcedDrawsContent());
- RefPtr<LayerChromiumWithForcedDrawsContent> frontFacingChildOfBackFacingSurface = adoptRef(new LayerChromiumWithForcedDrawsContent());
- RefPtr<LayerChromiumWithForcedDrawsContent> backFacingChildOfBackFacingSurface = adoptRef(new LayerChromiumWithForcedDrawsContent());
- RefPtr<LayerChromiumWithForcedDrawsContent> dummyReplicaLayer1 = adoptRef(new LayerChromiumWithForcedDrawsContent());
- RefPtr<LayerChromiumWithForcedDrawsContent> dummyReplicaLayer2 = adoptRef(new LayerChromiumWithForcedDrawsContent());
+ scoped_refptr<LayerChromium> parent = LayerChromium::create();
+ scoped_refptr<LayerChromiumWithForcedDrawsContent> frontFacingChild = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent());
+ scoped_refptr<LayerChromiumWithForcedDrawsContent> backFacingChild = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent());
+ scoped_refptr<LayerChromiumWithForcedDrawsContent> frontFacingSurface = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent());
+ scoped_refptr<LayerChromiumWithForcedDrawsContent> backFacingSurface = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent());
+ scoped_refptr<LayerChromiumWithForcedDrawsContent> frontFacingChildOfFrontFacingSurface = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent());
+ scoped_refptr<LayerChromiumWithForcedDrawsContent> backFacingChildOfFrontFacingSurface = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent());
+ scoped_refptr<LayerChromiumWithForcedDrawsContent> frontFacingChildOfBackFacingSurface = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent());
+ scoped_refptr<LayerChromiumWithForcedDrawsContent> backFacingChildOfBackFacingSurface = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent());
+ scoped_refptr<LayerChromiumWithForcedDrawsContent> dummyReplicaLayer1 = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent());
+ scoped_refptr<LayerChromiumWithForcedDrawsContent> dummyReplicaLayer2 = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent());
parent->addChild(frontFacingChild);
parent->addChild(backFacingChild);
@@ -2457,7 +2462,7 @@ TEST(CCLayerTreeHostCommonTest, verifyBackFaceCullingWithPreserves3d)
setLayerPropertiesForTesting(frontFacingChildOfBackFacingSurface.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false);
setLayerPropertiesForTesting(backFacingChildOfBackFacingSurface.get(), backfaceMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false);
- Vector<RefPtr<LayerChromium> > renderSurfaceLayerList;
+ std::vector<scoped_refptr<LayerChromium> > renderSurfaceLayerList;
int dummyMaxTextureSize = 512;
CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(), 1, dummyMaxTextureSize, renderSurfaceLayerList);
@@ -2497,12 +2502,12 @@ TEST(CCLayerTreeHostCommonTest, verifyBackFaceCullingWithAnimatingTransforms)
//
const WebTransformationMatrix identityMatrix;
- RefPtr<LayerChromium> parent = LayerChromium::create();
- RefPtr<LayerChromiumWithForcedDrawsContent> child = adoptRef(new LayerChromiumWithForcedDrawsContent());
- RefPtr<LayerChromiumWithForcedDrawsContent> animatingSurface = adoptRef(new LayerChromiumWithForcedDrawsContent());
- RefPtr<LayerChromiumWithForcedDrawsContent> childOfAnimatingSurface = adoptRef(new LayerChromiumWithForcedDrawsContent());
- RefPtr<LayerChromiumWithForcedDrawsContent> animatingChild = adoptRef(new LayerChromiumWithForcedDrawsContent());
- RefPtr<LayerChromiumWithForcedDrawsContent> child2 = adoptRef(new LayerChromiumWithForcedDrawsContent());
+ scoped_refptr<LayerChromium> parent = LayerChromium::create();
+ scoped_refptr<LayerChromiumWithForcedDrawsContent> child = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent());
+ scoped_refptr<LayerChromiumWithForcedDrawsContent> animatingSurface = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent());
+ scoped_refptr<LayerChromiumWithForcedDrawsContent> childOfAnimatingSurface = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent());
+ scoped_refptr<LayerChromiumWithForcedDrawsContent> animatingChild = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent());
+ scoped_refptr<LayerChromiumWithForcedDrawsContent> child2 = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent());
parent->addChild(child);
parent->addChild(animatingSurface);
@@ -2537,7 +2542,7 @@ TEST(CCLayerTreeHostCommonTest, verifyBackFaceCullingWithAnimatingTransforms)
setLayerPropertiesForTesting(animatingChild.get(), backfaceMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false);
setLayerPropertiesForTesting(child2.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false);
- Vector<RefPtr<LayerChromium> > renderSurfaceLayerList;
+ std::vector<scoped_refptr<LayerChromium> > renderSurfaceLayerList;
int dummyMaxTextureSize = 512;
CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(), 1, dummyMaxTextureSize, renderSurfaceLayerList);
CCLayerTreeHostCommon::calculateVisibleRects(renderSurfaceLayerList);
@@ -2578,11 +2583,11 @@ TEST(CCLayerTreeHostCommonTest, verifyBackFaceCullingWithPreserves3dForFlattenin
// when it flattens its subtree, and its parent has preserves-3d.
const WebTransformationMatrix identityMatrix;
- RefPtr<LayerChromium> parent = LayerChromium::create();
- RefPtr<LayerChromiumWithForcedDrawsContent> frontFacingSurface = adoptRef(new LayerChromiumWithForcedDrawsContent());
- RefPtr<LayerChromiumWithForcedDrawsContent> backFacingSurface = adoptRef(new LayerChromiumWithForcedDrawsContent());
- RefPtr<LayerChromiumWithForcedDrawsContent> child1 = adoptRef(new LayerChromiumWithForcedDrawsContent());
- RefPtr<LayerChromiumWithForcedDrawsContent> child2 = adoptRef(new LayerChromiumWithForcedDrawsContent());
+ scoped_refptr<LayerChromium> parent = LayerChromium::create();
+ scoped_refptr<LayerChromiumWithForcedDrawsContent> frontFacingSurface = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent());
+ scoped_refptr<LayerChromiumWithForcedDrawsContent> backFacingSurface = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent());
+ scoped_refptr<LayerChromiumWithForcedDrawsContent> child1 = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent());
+ scoped_refptr<LayerChromiumWithForcedDrawsContent> child2 = make_scoped_refptr(new LayerChromiumWithForcedDrawsContent());
parent->addChild(frontFacingSurface);
parent->addChild(backFacingSurface);
@@ -2604,7 +2609,7 @@ TEST(CCLayerTreeHostCommonTest, verifyBackFaceCullingWithPreserves3dForFlattenin
setLayerPropertiesForTesting(child1.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false);
setLayerPropertiesForTesting(child2.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false);
- Vector<RefPtr<LayerChromium> > renderSurfaceLayerList;
+ std::vector<scoped_refptr<LayerChromium> > renderSurfaceLayerList;
int dummyMaxTextureSize = 512;
CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(), 1, dummyMaxTextureSize, renderSurfaceLayerList);
@@ -2634,7 +2639,7 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForEmptyLayerList)
// Hit testing on an empty renderSurfaceLayerList should return a null pointer.
DebugScopedSetImplThread thisScopeIsOnImplThread;
- Vector<CCLayerImpl*> renderSurfaceLayerList;
+ std::vector<CCLayerImpl*> renderSurfaceLayerList;
IntPoint testPoint(0, 0);
CCLayerImpl* resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
@@ -2658,7 +2663,7 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForSingleLayer)
setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anchor, position, bounds, false);
root->setDrawsContent(true);
- Vector<CCLayerImpl*> renderSurfaceLayerList;
+ std::vector<CCLayerImpl*> renderSurfaceLayerList;
int dummyMaxTextureSize = 512;
CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1, 0, dummyMaxTextureSize, renderSurfaceLayerList);
CCLayerTreeHostCommon::calculateVisibleRects(renderSurfaceLayerList);
@@ -2708,7 +2713,7 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForUninvertibleTransform)
setLayerPropertiesForTesting(root.get(), uninvertibleTransform, identityMatrix, anchor, position, bounds, false);
root->setDrawsContent(true);
- Vector<CCLayerImpl*> renderSurfaceLayerList;
+ std::vector<CCLayerImpl*> renderSurfaceLayerList;
int dummyMaxTextureSize = 512;
CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1, 0, dummyMaxTextureSize, renderSurfaceLayerList);
CCLayerTreeHostCommon::calculateVisibleRects(renderSurfaceLayerList);
@@ -2763,7 +2768,7 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForSinglePositionedLayer)
setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anchor, position, bounds, false);
root->setDrawsContent(true);
- Vector<CCLayerImpl*> renderSurfaceLayerList;
+ std::vector<CCLayerImpl*> renderSurfaceLayerList;
int dummyMaxTextureSize = 512;
CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1, 0, dummyMaxTextureSize, renderSurfaceLayerList);
CCLayerTreeHostCommon::calculateVisibleRects(renderSurfaceLayerList);
@@ -2811,7 +2816,7 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForSingleRotatedLayer)
setLayerPropertiesForTesting(root.get(), rotation45DegreesAboutCenter, identityMatrix, anchor, position, bounds, false);
root->setDrawsContent(true);
- Vector<CCLayerImpl*> renderSurfaceLayerList;
+ std::vector<CCLayerImpl*> renderSurfaceLayerList;
int dummyMaxTextureSize = 512;
CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1, 0, dummyMaxTextureSize, renderSurfaceLayerList);
CCLayerTreeHostCommon::calculateVisibleRects(renderSurfaceLayerList);
@@ -2868,7 +2873,7 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForSinglePerspectiveLayer)
setLayerPropertiesForTesting(root.get(), perspectiveProjectionAboutCenter * translationByZ, identityMatrix, anchor, position, bounds, false);
root->setDrawsContent(true);
- Vector<CCLayerImpl*> renderSurfaceLayerList;
+ std::vector<CCLayerImpl*> renderSurfaceLayerList;
int dummyMaxTextureSize = 512;
CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1, 0, dummyMaxTextureSize, renderSurfaceLayerList);
CCLayerTreeHostCommon::calculateVisibleRects(renderSurfaceLayerList);
@@ -2933,7 +2938,7 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForSingleLayerWithScaledContents
root->addChild(testLayer.release());
}
- Vector<CCLayerImpl*> renderSurfaceLayerList;
+ std::vector<CCLayerImpl*> renderSurfaceLayerList;
int dummyMaxTextureSize = 512;
CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1, 0, dummyMaxTextureSize, renderSurfaceLayerList);
CCLayerTreeHostCommon::calculateVisibleRects(renderSurfaceLayerList);
@@ -2998,7 +3003,7 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForSimpleClippedLayer)
root->addChild(clippingLayer.release());
}
- Vector<CCLayerImpl*> renderSurfaceLayerList;
+ std::vector<CCLayerImpl*> renderSurfaceLayerList;
int dummyMaxTextureSize = 512;
CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1, 0, dummyMaxTextureSize, renderSurfaceLayerList);
CCLayerTreeHostCommon::calculateVisibleRects(renderSurfaceLayerList);
@@ -3089,7 +3094,7 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForMultiClippedRotatedLayer)
root->addChild(child.release());
}
- Vector<CCLayerImpl*> renderSurfaceLayerList;
+ std::vector<CCLayerImpl*> renderSurfaceLayerList;
int dummyMaxTextureSize = 512;
CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1, 0, dummyMaxTextureSize, renderSurfaceLayerList);
CCLayerTreeHostCommon::calculateVisibleRects(renderSurfaceLayerList);
@@ -3172,7 +3177,7 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForNonClippingIntermediateLayer)
root->addChild(intermediateLayer.release());
}
- Vector<CCLayerImpl*> renderSurfaceLayerList;
+ std::vector<CCLayerImpl*> renderSurfaceLayerList;
int dummyMaxTextureSize = 512;
CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1, 0, dummyMaxTextureSize, renderSurfaceLayerList);
CCLayerTreeHostCommon::calculateVisibleRects(renderSurfaceLayerList);
@@ -3253,7 +3258,7 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForMultipleLayers)
CCLayerImpl* child2 = root->children()[1];
CCLayerImpl* grandChild1 = child1->children()[0];
- Vector<CCLayerImpl*> renderSurfaceLayerList;
+ std::vector<CCLayerImpl*> renderSurfaceLayerList;
int dummyMaxTextureSize = 512;
CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1, 0, dummyMaxTextureSize, renderSurfaceLayerList);
CCLayerTreeHostCommon::calculateVisibleRects(renderSurfaceLayerList);
@@ -3362,7 +3367,7 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForMultipleLayerLists)
CCLayerImpl* child2 = root->children()[1];
CCLayerImpl* grandChild1 = child1->children()[0];
- Vector<CCLayerImpl*> renderSurfaceLayerList;
+ std::vector<CCLayerImpl*> renderSurfaceLayerList;
int dummyMaxTextureSize = 512;
CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1, 0, dummyMaxTextureSize, renderSurfaceLayerList);
CCLayerTreeHostCommon::calculateVisibleRects(renderSurfaceLayerList);
@@ -3427,19 +3432,19 @@ TEST(CCLayerTreeHostCommonTest, verifyLayerTransformsInHighDPI)
MockContentLayerChromiumClient delegate;
WebTransformationMatrix identityMatrix;
- RefPtr<ContentLayerChromium> parent = createDrawableContentLayerChromium(&delegate);
+ scoped_refptr<ContentLayerChromium> parent = createDrawableContentLayerChromium(&delegate);
setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), true);
- RefPtr<ContentLayerChromium> child = createDrawableContentLayerChromium(&delegate);
+ scoped_refptr<ContentLayerChromium> child = createDrawableContentLayerChromium(&delegate);
setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(2, 2), IntSize(10, 10), true);
- RefPtr<ContentLayerChromium> childNoScale = createDrawableContentLayerChromium(&delegate);
+ scoped_refptr<ContentLayerChromium> childNoScale = createDrawableContentLayerChromium(&delegate);
setLayerPropertiesForTesting(childNoScale.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(2, 2), IntSize(10, 10), true);
parent->addChild(child);
parent->addChild(childNoScale);
- Vector<RefPtr<LayerChromium> > renderSurfaceLayerList;
+ std::vector<scoped_refptr<LayerChromium> > renderSurfaceLayerList;
int dummyMaxTextureSize = 512;
const double deviceScaleFactor = 2.5;
@@ -3499,27 +3504,27 @@ TEST(CCLayerTreeHostCommonTest, verifyRenderSurfaceTransformsInHighDPI)
MockContentLayerChromiumClient delegate;
WebTransformationMatrix identityMatrix;
- RefPtr<ContentLayerChromium> parent = createDrawableContentLayerChromium(&delegate);
+ scoped_refptr<ContentLayerChromium> parent = createDrawableContentLayerChromium(&delegate);
setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(30, 30), true);
- RefPtr<ContentLayerChromium> child = createDrawableContentLayerChromium(&delegate);
+ scoped_refptr<ContentLayerChromium> child = createDrawableContentLayerChromium(&delegate);
setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(2, 2), IntSize(10, 10), true);
WebTransformationMatrix replicaTransform;
replicaTransform.scaleNonUniform(1, -1);
- RefPtr<ContentLayerChromium> replica = createDrawableContentLayerChromium(&delegate);
+ scoped_refptr<ContentLayerChromium> replica = createDrawableContentLayerChromium(&delegate);
setLayerPropertiesForTesting(replica.get(), replicaTransform, identityMatrix, FloatPoint(0, 0), FloatPoint(2, 2), IntSize(10, 10), true);
// This layer should end up in the same surface as child, with the same draw
// and screen space transforms.
- RefPtr<ContentLayerChromium> duplicateChildNonOwner = createDrawableContentLayerChromium(&delegate);
+ scoped_refptr<ContentLayerChromium> duplicateChildNonOwner = createDrawableContentLayerChromium(&delegate);
setLayerPropertiesForTesting(duplicateChildNonOwner.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(10, 10), true);
parent->addChild(child);
child->addChild(duplicateChildNonOwner);
child->setReplicaLayer(replica.get());
- Vector<RefPtr<LayerChromium> > renderSurfaceLayerList;
+ std::vector<scoped_refptr<LayerChromium> > renderSurfaceLayerList;
int dummyMaxTextureSize = 512;
const double deviceScaleFactor = 1.5;
@@ -3578,11 +3583,11 @@ TEST(CCLayerTreeHostCommonTest, verifyRenderSurfaceTransformsInHighDPI)
TEST(CCLayerTreeHostCommonTest, verifySubtreeSearch)
{
- RefPtr<LayerChromium> root = LayerChromium::create();
- RefPtr<LayerChromium> child = LayerChromium::create();
- RefPtr<LayerChromium> grandChild = LayerChromium::create();
- RefPtr<LayerChromium> maskLayer = LayerChromium::create();
- RefPtr<LayerChromium> replicaLayer = LayerChromium::create();
+ scoped_refptr<LayerChromium> root = LayerChromium::create();
+ scoped_refptr<LayerChromium> child = LayerChromium::create();
+ scoped_refptr<LayerChromium> grandChild = LayerChromium::create();
+ scoped_refptr<LayerChromium> maskLayer = LayerChromium::create();
+ scoped_refptr<LayerChromium> replicaLayer = LayerChromium::create();
grandChild->setReplicaLayer(replicaLayer.get());
child->addChild(grandChild.get());
diff --git a/cc/CCLayerTreeHostImpl.cpp b/cc/CCLayerTreeHostImpl.cpp
index f58f407..24701c7 100644
--- a/cc/CCLayerTreeHostImpl.cpp
+++ b/cc/CCLayerTreeHostImpl.cpp
@@ -242,7 +242,7 @@ void CCLayerTreeHostImpl::trackDamageForAllSurfaces(CCLayerImpl* rootDrawLayer,
void CCLayerTreeHostImpl::calculateRenderSurfaceLayerList(CCLayerList& renderSurfaceLayerList)
{
- ASSERT(renderSurfaceLayerList.isEmpty());
+ ASSERT(renderSurfaceLayerList.empty());
ASSERT(m_rootLayerImpl);
ASSERT(m_renderer); // For maxTextureSize.
@@ -284,7 +284,7 @@ bool CCLayerTreeHostImpl::calculateRenderPasses(FrameData& frame)
occlusionTracker.setOccludingScreenSpaceRectsContainer(&frame.occludingScreenSpaceRects);
// Add quads to the Render passes in FrontToBack order to allow for testing occlusion and performing culling during the tree walk.
- typedef CCLayerIterator<CCLayerImpl, Vector<CCLayerImpl*>, CCRenderSurface, CCLayerIteratorActions::FrontToBack> CCLayerIteratorType;
+ typedef CCLayerIterator<CCLayerImpl, std::vector<CCLayerImpl*>, CCRenderSurface, CCLayerIteratorActions::FrontToBack> CCLayerIteratorType;
// Typically when we are missing a texture and use a checkerboard quad, we still draw the frame. However when the layer being
// checkerboarded is moving due to an impl-animation, we drop the frame to avoid flashing due to the texture suddenly appearing
@@ -310,7 +310,7 @@ bool CCLayerTreeHostImpl::calculateRenderPasses(FrameData& frame)
appendQuadsData.hadOcclusionFromOutsideTargetSurface |= hasOcclusionFromOutsideTargetSurface;
else {
it->willDraw(m_resourceProvider.get());
- frame.willDrawLayers.append(*it);
+ frame.willDrawLayers.push_back(*it);
if (it->hasContributingDelegatedRenderPasses()) {
CCRenderPass::Id contributingRenderPassId = it->firstContributingRenderPassId();
diff --git a/cc/CCLayerTreeHostImpl.h b/cc/CCLayerTreeHostImpl.h
index d723a95..7952d18 100644
--- a/cc/CCLayerTreeHostImpl.h
+++ b/cc/CCLayerTreeHostImpl.h
@@ -49,7 +49,7 @@ public:
class CCLayerTreeHostImpl : public CCInputHandlerClient,
public CCRendererClient,
public WebKit::WebCompositorOutputSurfaceClient {
- typedef Vector<CCLayerImpl*> CCLayerList;
+ typedef std::vector<CCLayerImpl*> CCLayerList;
public:
static scoped_ptr<CCLayerTreeHostImpl> create(const CCLayerTreeSettings&, CCLayerTreeHostImplClient*);
diff --git a/cc/CCLayerTreeHostTest.cpp b/cc/CCLayerTreeHostTest.cpp
index bae4e86..1bc669e 100644
--- a/cc/CCLayerTreeHostTest.cpp
+++ b/cc/CCLayerTreeHostTest.cpp
@@ -1183,7 +1183,7 @@ private:
class ContentLayerChromiumWithUpdateTracking : public ContentLayerChromium {
public:
- static PassRefPtr<ContentLayerChromiumWithUpdateTracking> create(ContentLayerChromiumClient* client) { return adoptRef(new ContentLayerChromiumWithUpdateTracking(client)); }
+ static scoped_refptr<ContentLayerChromiumWithUpdateTracking> create(ContentLayerChromiumClient* client) { return make_scoped_refptr(new ContentLayerChromiumWithUpdateTracking(client)); }
int paintContentsCount() { return m_paintContentsCount; }
void resetPaintContentsCount() { m_paintContentsCount = 0; }
@@ -1203,6 +1203,9 @@ private:
setBounds(IntSize(10, 10));
setIsDrawable(true);
}
+ virtual ~ContentLayerChromiumWithUpdateTracking()
+ {
+ }
int m_paintContentsCount;
};
@@ -1235,12 +1238,12 @@ public:
EXPECT_EQ(1, m_updateCheckLayer->paintContentsCount());
// clear m_updateCheckLayer so CCLayerTreeHost dies.
- m_updateCheckLayer.clear();
+ m_updateCheckLayer = NULL;
}
private:
TestOpacityChangeLayerDelegate m_testOpacityChangeDelegate;
- RefPtr<ContentLayerChromiumWithUpdateTracking> m_updateCheckLayer;
+ scoped_refptr<ContentLayerChromiumWithUpdateTracking> m_updateCheckLayer;
};
TEST_F(CCLayerTreeHostTestOpacityChange, runMultiThread)
@@ -1258,13 +1261,14 @@ public:
class NoScaleContentLayerChromium : public ContentLayerChromium {
public:
- static PassRefPtr<NoScaleContentLayerChromium> create(ContentLayerChromiumClient* client) { return adoptRef(new NoScaleContentLayerChromium(client)); }
+ static scoped_refptr<NoScaleContentLayerChromium> create(ContentLayerChromiumClient* client) { return make_scoped_refptr(new NoScaleContentLayerChromium(client)); }
virtual bool needsContentsScale() const OVERRIDE { return false; }
private:
explicit NoScaleContentLayerChromium(ContentLayerChromiumClient* client)
: ContentLayerChromium(client) { }
+ virtual ~NoScaleContentLayerChromium() { }
};
class CCLayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers : public CCLayerTreeHostTest {
@@ -1361,14 +1365,14 @@ public:
virtual void afterTest() OVERRIDE
{
- m_rootLayer.clear();
- m_childLayer.clear();
+ m_rootLayer = NULL;
+ m_childLayer = NULL;
}
private:
MockContentLayerChromiumClient m_client;
- RefPtr<NoScaleContentLayerChromium> m_rootLayer;
- RefPtr<ContentLayerChromium> m_childLayer;
+ scoped_refptr<NoScaleContentLayerChromium> m_rootLayer;
+ scoped_refptr<ContentLayerChromium> m_childLayer;
};
// Test is flaky - http://crbug.com/148490
@@ -1456,7 +1460,7 @@ public:
private:
MockContentLayerChromiumClient m_client;
- RefPtr<ContentLayerChromiumWithUpdateTracking> m_layer;
+ scoped_refptr<ContentLayerChromiumWithUpdateTracking> m_layer;
};
TEST_F(CCLayerTreeHostTestAtomicCommit, runMultiThread)
@@ -1603,8 +1607,8 @@ public:
private:
MockContentLayerChromiumClient m_client;
- RefPtr<ContentLayerChromiumWithUpdateTracking> m_parent;
- RefPtr<ContentLayerChromiumWithUpdateTracking> m_child;
+ scoped_refptr<ContentLayerChromiumWithUpdateTracking> m_parent;
+ scoped_refptr<ContentLayerChromiumWithUpdateTracking> m_child;
int m_numCommits;
};
@@ -1615,7 +1619,7 @@ TEST_F(CCLayerTreeHostTestAtomicCommitWithPartialUpdate, runMultiThread)
class TestLayerChromium : public LayerChromium {
public:
- static PassRefPtr<TestLayerChromium> create() { return adoptRef(new TestLayerChromium()); }
+ static scoped_refptr<TestLayerChromium> create() { return make_scoped_refptr(new TestLayerChromium()); }
virtual void update(CCTextureUpdateQueue&, const CCOcclusionTracker* occlusion, CCRenderingStats&) OVERRIDE
{
@@ -1631,6 +1635,7 @@ public:
private:
TestLayerChromium() : LayerChromium() { }
+ virtual ~TestLayerChromium() { }
Region m_occludedScreenSpace;
};
@@ -1647,11 +1652,11 @@ public:
virtual void beginTest() OVERRIDE
{
- RefPtr<TestLayerChromium> rootLayer = TestLayerChromium::create();
- RefPtr<TestLayerChromium> child = TestLayerChromium::create();
- RefPtr<TestLayerChromium> child2 = TestLayerChromium::create();
- RefPtr<TestLayerChromium> grandChild = TestLayerChromium::create();
- RefPtr<TestLayerChromium> mask = TestLayerChromium::create();
+ scoped_refptr<TestLayerChromium> rootLayer = TestLayerChromium::create();
+ scoped_refptr<TestLayerChromium> child = TestLayerChromium::create();
+ scoped_refptr<TestLayerChromium> child2 = TestLayerChromium::create();
+ scoped_refptr<TestLayerChromium> grandChild = TestLayerChromium::create();
+ scoped_refptr<TestLayerChromium> mask = TestLayerChromium::create();
WebTransformationMatrix identityMatrix;
WebTransformationMatrix childTransform;
@@ -1850,11 +1855,11 @@ public:
virtual void beginTest() OVERRIDE
{
- RefPtr<TestLayerChromium> rootLayer = TestLayerChromium::create();
- RefPtr<TestLayerChromium> child = TestLayerChromium::create();
- RefPtr<TestLayerChromium> child2 = TestLayerChromium::create();
- RefPtr<TestLayerChromium> grandChild = TestLayerChromium::create();
- RefPtr<TestLayerChromium> mask = TestLayerChromium::create();
+ scoped_refptr<TestLayerChromium> rootLayer = TestLayerChromium::create();
+ scoped_refptr<TestLayerChromium> child = TestLayerChromium::create();
+ scoped_refptr<TestLayerChromium> child2 = TestLayerChromium::create();
+ scoped_refptr<TestLayerChromium> grandChild = TestLayerChromium::create();
+ scoped_refptr<TestLayerChromium> mask = TestLayerChromium::create();
WebTransformationMatrix identityMatrix;
WebTransformationMatrix childTransform;
@@ -1944,26 +1949,26 @@ public:
// We create enough RenderSurfaces that it will trigger Vector reallocation while computing occlusion.
Region occluded;
const WebTransformationMatrix identityMatrix;
- Vector<RefPtr<TestLayerChromium> > layers;
- Vector<RefPtr<TestLayerChromium> > children;
+ std::vector<scoped_refptr<TestLayerChromium> > layers;
+ std::vector<scoped_refptr<TestLayerChromium> > children;
int numSurfaces = 20;
- RefPtr<TestLayerChromium> replica = TestLayerChromium::create();
+ scoped_refptr<TestLayerChromium> replica = TestLayerChromium::create();
for (int i = 0; i < numSurfaces; ++i) {
- layers.append(TestLayerChromium::create());
+ layers.push_back(TestLayerChromium::create());
if (!i) {
- setTestLayerPropertiesForTesting(layers.last().get(), 0, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(200, 200), true);
- layers.last()->createRenderSurface();
+ setTestLayerPropertiesForTesting(layers.back().get(), 0, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(200, 200), true);
+ layers.back()->createRenderSurface();
} else {
- setTestLayerPropertiesForTesting(layers.last().get(), layers[layers.size()-2].get(), identityMatrix, FloatPoint(0, 0), FloatPoint(1, 1), IntSize(200-i, 200-i), true);
- layers.last()->setMasksToBounds(true);
- layers.last()->setReplicaLayer(replica.get()); // Make it have a RenderSurface
+ setTestLayerPropertiesForTesting(layers.back().get(), layers[layers.size()-2].get(), identityMatrix, FloatPoint(0, 0), FloatPoint(1, 1), IntSize(200-i, 200-i), true);
+ layers.back()->setMasksToBounds(true);
+ layers.back()->setReplicaLayer(replica.get()); // Make it have a RenderSurface
}
}
for (int i = 1; i < numSurfaces; ++i) {
- children.append(TestLayerChromium::create());
- setTestLayerPropertiesForTesting(children.last().get(), layers[i].get(), identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(500, 500), false);
+ children.push_back(TestLayerChromium::create());
+ setTestLayerPropertiesForTesting(children.back().get(), layers[i].get(), identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(500, 500), false);
}
m_layerTreeHost->setRootLayer(layers[0].get());
@@ -2179,7 +2184,7 @@ public:
{
EXPECT_FALSE(m_addedAnimation);
- RefPtr<LayerChromium> layer = LayerChromium::create();
+ scoped_refptr<LayerChromium> layer = LayerChromium::create();
layer->setLayerAnimationDelegate(this);
// Any valid CCAnimationCurve will do here.
@@ -2282,8 +2287,8 @@ private:
const IntSize m_scrollAmount;
IntPoint m_finalScrollPosition;
MockContentLayerChromiumClient m_mockDelegate;
- RefPtr<LayerChromium> m_childLayer;
- RefPtr<LayerChromium> m_rootScrollLayer;
+ scoped_refptr<LayerChromium> m_childLayer;
+ scoped_refptr<LayerChromium> m_rootScrollLayer;
};
TEST_F(CCLayerTreeHostTestScrollChildLayer, runMultiThread)
@@ -2375,20 +2380,20 @@ public:
EXPECT_EQ(2, m_surfaceLayer2->paintContentsCount());
// Clear layer references so CCLayerTreeHost dies.
- m_rootLayer.clear();
- m_surfaceLayer1.clear();
- m_replicaLayer1.clear();
- m_surfaceLayer2.clear();
- m_replicaLayer2.clear();
+ m_rootLayer = NULL;
+ m_surfaceLayer1 = NULL;
+ m_replicaLayer1 = NULL;
+ m_surfaceLayer2 = NULL;
+ m_replicaLayer2 = NULL;
}
private:
MockContentLayerChromiumClient m_mockDelegate;
- RefPtr<ContentLayerChromiumWithUpdateTracking> m_rootLayer;
- RefPtr<ContentLayerChromiumWithUpdateTracking> m_surfaceLayer1;
- RefPtr<ContentLayerChromiumWithUpdateTracking> m_replicaLayer1;
- RefPtr<ContentLayerChromiumWithUpdateTracking> m_surfaceLayer2;
- RefPtr<ContentLayerChromiumWithUpdateTracking> m_replicaLayer2;
+ scoped_refptr<ContentLayerChromiumWithUpdateTracking> m_rootLayer;
+ scoped_refptr<ContentLayerChromiumWithUpdateTracking> m_surfaceLayer1;
+ scoped_refptr<ContentLayerChromiumWithUpdateTracking> m_replicaLayer1;
+ scoped_refptr<ContentLayerChromiumWithUpdateTracking> m_surfaceLayer2;
+ scoped_refptr<ContentLayerChromiumWithUpdateTracking> m_replicaLayer2;
};
SINGLE_AND_MULTI_THREAD_TEST_F(CCLayerTreeHostTestSurfaceNotAllocatedForLayersOutsideMemoryLimit)
@@ -2418,7 +2423,7 @@ private:
class EvictionTestLayer : public LayerChromium {
public:
- static PassRefPtr<EvictionTestLayer> create() { return adoptRef(new EvictionTestLayer()); }
+ static scoped_refptr<EvictionTestLayer> create() { return make_scoped_refptr(new EvictionTestLayer()); }
virtual void update(CCTextureUpdateQueue&, const CCOcclusionTracker*, CCRenderingStats&) OVERRIDE;
virtual bool drawsContent() const OVERRIDE { return true; }
@@ -2436,6 +2441,7 @@ public:
private:
EvictionTestLayer() : LayerChromium() { }
+ virtual ~EvictionTestLayer() { }
void createTextureIfNeeded()
{
@@ -2632,7 +2638,7 @@ public:
private:
MockContentLayerChromiumClient m_client;
- RefPtr<EvictionTestLayer> m_layer;
+ scoped_refptr<EvictionTestLayer> m_layer;
CCLayerTreeHostImpl* m_implForEvictTextures;
int m_numCommits;
};
@@ -2728,7 +2734,7 @@ public:
private:
MockContentLayerChromiumClient m_client;
- RefPtr<EvictionTestLayer> m_layer;
+ scoped_refptr<EvictionTestLayer> m_layer;
CCLayerTreeHostImpl* m_implForEvictTextures;
int m_numCommits;
};
@@ -2778,7 +2784,7 @@ public:
, m_numChildren(50)
{
for (int i = 0; i < m_numChildren; i++)
- m_children.append(ContentLayerChromiumWithUpdateTracking::create(&m_client));
+ m_children.push_back(ContentLayerChromiumWithUpdateTracking::create(&m_client));
}
virtual scoped_ptr<WebKit::WebCompositorOutputSurface> createOutputSurface()
@@ -2817,9 +2823,9 @@ public:
private:
MockContentLayerChromiumClient m_client;
- RefPtr<ContentLayerChromiumWithUpdateTracking> m_parent;
+ scoped_refptr<ContentLayerChromiumWithUpdateTracking> m_parent;
int m_numChildren;
- Vector<RefPtr<ContentLayerChromiumWithUpdateTracking> > m_children;
+ std::vector<scoped_refptr<ContentLayerChromiumWithUpdateTracking> > m_children;
};
TEST_F(CCLayerTreeHostTestLostContextWhileUpdatingResources, runMultiThread)
@@ -2924,12 +2930,12 @@ public:
EXPECT_EQ(1, m_numCommitComplete);
// Clear layer references so CCLayerTreeHost dies.
- m_contentLayer.clear();
+ m_contentLayer = NULL;
}
private:
MockContentLayerChromiumClient m_mockDelegate;
- RefPtr<LayerChromium> m_contentLayer;
+ scoped_refptr<LayerChromium> m_contentLayer;
int m_numCommitComplete;
int m_numDrawLayers;
};
diff --git a/cc/CCOcclusionTrackerTest.cpp b/cc/CCOcclusionTrackerTest.cpp
index 627e63b..fb03e22 100644
--- a/cc/CCOcclusionTrackerTest.cpp
+++ b/cc/CCOcclusionTrackerTest.cpp
@@ -51,6 +51,10 @@ public:
}
private:
+ virtual ~TestContentLayerChromium()
+ {
+ }
+
bool m_overrideOpaqueContentsRect;
IntRect m_opaqueContentsRect;
};
@@ -105,18 +109,23 @@ struct CCOcclusionTrackerTestMainThreadTypes {
typedef LayerChromium LayerType;
typedef RenderSurfaceChromium RenderSurfaceType;
typedef TestContentLayerChromium ContentLayerType;
- typedef RefPtr<LayerChromium> LayerPtrType;
- typedef PassRefPtr<LayerChromium> PassLayerPtrType;
- typedef RefPtr<ContentLayerType> ContentLayerPtrType;
- typedef PassRefPtr<ContentLayerType> PassContentLayerPtrType;
- typedef CCLayerIterator<LayerChromium, Vector<RefPtr<LayerChromium> >, RenderSurfaceChromium, CCLayerIteratorActions::FrontToBack> LayerIterator;
+ typedef scoped_refptr<LayerChromium> LayerPtrType;
+ typedef scoped_refptr<LayerChromium> PassLayerPtrType;
+ typedef scoped_refptr<ContentLayerType> ContentLayerPtrType;
+ typedef scoped_refptr<ContentLayerType> PassContentLayerPtrType;
+ typedef CCLayerIterator<LayerChromium, std::vector<scoped_refptr<LayerChromium> >, RenderSurfaceChromium, CCLayerIteratorActions::FrontToBack> LayerIterator;
typedef CCOcclusionTracker OcclusionTrackerType;
static PassLayerPtrType createLayer()
{
return LayerChromium::create();
}
- static PassContentLayerPtrType createContentLayer() { return adoptRef(new ContentLayerType()); }
+ static PassContentLayerPtrType createContentLayer() { return make_scoped_refptr(new ContentLayerType()); }
+
+ static void destroyLayer(LayerPtrType& layer)
+ {
+ layer = NULL;
+ }
};
struct CCOcclusionTrackerTestImplThreadTypes {
@@ -127,12 +136,17 @@ struct CCOcclusionTrackerTestImplThreadTypes {
typedef PassOwnPtr<CCLayerImpl> PassLayerPtrType;
typedef OwnPtr<ContentLayerType> ContentLayerPtrType;
typedef PassOwnPtr<ContentLayerType> PassContentLayerPtrType;
- typedef CCLayerIterator<CCLayerImpl, Vector<CCLayerImpl*>, CCRenderSurface, CCLayerIteratorActions::FrontToBack> LayerIterator;
+ typedef CCLayerIterator<CCLayerImpl, std::vector<CCLayerImpl*>, CCRenderSurface, CCLayerIteratorActions::FrontToBack> LayerIterator;
typedef CCOcclusionTrackerImpl OcclusionTrackerType;
static PassLayerPtrType createLayer() { return CCLayerImpl::create(nextCCLayerImplId++); }
static PassContentLayerPtrType createContentLayer() { return adoptPtr(new ContentLayerType(nextCCLayerImplId++)); }
static int nextCCLayerImplId;
+
+ static void destroyLayer(LayerPtrType& layer)
+ {
+ layer.clear();
+ }
};
int CCOcclusionTrackerTestImplThreadTypes::nextCCLayerImplId = 1;
@@ -148,7 +162,7 @@ protected:
virtual void TearDown()
{
- m_root.clear();
+ Types::destroyLayer(m_root);
m_renderSurfaceLayerListChromium.clear();
m_renderSurfaceLayerListImpl.clear();
m_replicaLayers.clear();
@@ -334,10 +348,10 @@ private:
layer->setContentBounds(layer->bounds());
}
- void setReplica(LayerChromium* owningLayer, PassRefPtr<LayerChromium> layer)
+ void setReplica(LayerChromium* owningLayer, scoped_refptr<LayerChromium> layer)
{
owningLayer->setReplicaLayer(layer.get());
- m_replicaLayers.append(layer);
+ m_replicaLayers.push_back(layer);
}
void setReplica(CCLayerImpl* owningLayer, PassOwnPtr<CCLayerImpl> layer)
@@ -345,10 +359,10 @@ private:
owningLayer->setReplicaLayer(layer);
}
- void setMask(LayerChromium* owningLayer, PassRefPtr<LayerChromium> layer)
+ void setMask(LayerChromium* owningLayer, scoped_refptr<LayerChromium> layer)
{
owningLayer->setMaskLayer(layer.get());
- m_maskLayers.append(layer);
+ m_maskLayers.push_back(layer);
}
void setMask(CCLayerImpl* owningLayer, PassOwnPtr<CCLayerImpl> layer)
@@ -358,13 +372,13 @@ private:
// These hold ownership of the layers for the duration of the test.
typename Types::LayerPtrType m_root;
- Vector<RefPtr<LayerChromium> > m_renderSurfaceLayerListChromium;
- Vector<CCLayerImpl*> m_renderSurfaceLayerListImpl;
+ std::vector<scoped_refptr<LayerChromium> > m_renderSurfaceLayerListChromium;
+ std::vector<CCLayerImpl*> m_renderSurfaceLayerListImpl;
typename Types::LayerIterator m_layerIteratorBegin;
typename Types::LayerIterator m_layerIterator;
typename Types::LayerType* m_lastLayerVisited;
- Vector<RefPtr<LayerChromium> > m_replicaLayers;
- Vector<RefPtr<LayerChromium> > m_maskLayers;
+ std::vector<scoped_refptr<LayerChromium> > m_replicaLayers;
+ std::vector<scoped_refptr<LayerChromium> > m_maskLayers;
};
#define RUN_TEST_MAIN_THREAD_OPAQUE_LAYERS(ClassName) \
diff --git a/cc/CCQuadCullerTest.cpp b/cc/CCQuadCullerTest.cpp
index 42708c7..a47c4e7 100644
--- a/cc/CCQuadCullerTest.cpp
+++ b/cc/CCQuadCullerTest.cpp
@@ -38,9 +38,9 @@ private:
IntRect m_scissorRectInScreen;
};
-typedef CCLayerIterator<CCLayerImpl, Vector<CCLayerImpl*>, CCRenderSurface, CCLayerIteratorActions::FrontToBack> CCLayerIteratorType;
+typedef CCLayerIterator<CCLayerImpl, std::vector<CCLayerImpl*>, CCRenderSurface, CCLayerIteratorActions::FrontToBack> CCLayerIteratorType;
-static PassOwnPtr<CCTiledLayerImpl> makeLayer(CCTiledLayerImpl* parent, const WebTransformationMatrix& drawTransform, const IntRect& layerRect, float opacity, bool opaque, const IntRect& layerOpaqueRect, Vector<CCLayerImpl*>& surfaceLayerList)
+static PassOwnPtr<CCTiledLayerImpl> makeLayer(CCTiledLayerImpl* parent, const WebTransformationMatrix& drawTransform, const IntRect& layerRect, float opacity, bool opaque, const IntRect& layerOpaqueRect, std::vector<CCLayerImpl*>& surfaceLayerList)
{
OwnPtr<CCTiledLayerImpl> layer = CCTiledLayerImpl::create(1);
OwnPtr<CCLayerTilingData> tiler = CCLayerTilingData::create(IntSize(100, 100), CCLayerTilingData::NoBorderTexels);
@@ -65,11 +65,11 @@ static PassOwnPtr<CCTiledLayerImpl> makeLayer(CCTiledLayerImpl* parent, const We
IntRect rectInTarget = CCMathUtil::mapClippedRect(layer->drawTransform(), layer->visibleContentRect());
if (!parent) {
layer->createRenderSurface();
- surfaceLayerList.append(layer.get());
- layer->renderSurface()->layerList().append(layer.get());
+ surfaceLayerList.push_back(layer.get());
+ layer->renderSurface()->layerList().push_back(layer.get());
} else {
layer->setRenderTarget(parent->renderTarget());
- parent->renderSurface()->layerList().append(layer.get());
+ parent->renderSurface()->layerList().push_back(layer.get());
rectInTarget.unite(CCMathUtil::mapClippedRect(parent->drawTransform(), parent->visibleContentRect()));
}
layer->setDrawableContentRect(rectInTarget);
@@ -91,7 +91,7 @@ static void appendQuads(CCQuadList& quadList, CCSharedQuadStateList& sharedState
DebugScopedSetImplThread impl; \
CCQuadList quadList; \
CCSharedQuadStateList sharedStateList; \
- Vector<CCLayerImpl*> renderSurfaceLayerList; \
+ std::vector<CCLayerImpl*> renderSurfaceLayerList; \
WebTransformationMatrix childTransform; \
IntSize rootSize = IntSize(300, 300); \
IntRect rootRect = IntRect(IntPoint(), rootSize); \
diff --git a/cc/CCRenderSurface.cpp b/cc/CCRenderSurface.cpp
index 7a2518f..f10c83b 100644
--- a/cc/CCRenderSurface.cpp
+++ b/cc/CCRenderSurface.cpp
@@ -147,9 +147,9 @@ bool CCRenderSurface::surfacePropertyChangedOnlyFromDescendant() const
void CCRenderSurface::addContributingDelegatedRenderPassLayer(CCLayerImpl* layer)
{
- ASSERT(m_layerList.contains(layer));
+ ASSERT(std::find(m_layerList.begin(), m_layerList.end(), layer) != m_layerList.end());
CCDelegatedRendererLayerImpl* delegatedRendererLayer = static_cast<CCDelegatedRendererLayerImpl*>(layer);
- m_contributingDelegatedRenderPassLayerList.append(delegatedRendererLayer);
+ m_contributingDelegatedRenderPassLayerList.push_back(delegatedRendererLayer);
}
void CCRenderSurface::clearLayerLists()
diff --git a/cc/CCRenderSurface.h b/cc/CCRenderSurface.h
index f06e587..afdf062 100644
--- a/cc/CCRenderSurface.h
+++ b/cc/CCRenderSurface.h
@@ -72,7 +72,7 @@ public:
void setContentRect(const IntRect&);
const IntRect& contentRect() const { return m_contentRect; }
- Vector<CCLayerImpl*>& layerList() { return m_layerList; }
+ std::vector<CCLayerImpl*>& layerList() { return m_layerList; }
void addContributingDelegatedRenderPassLayer(CCLayerImpl*);
void clearLayerLists();
@@ -108,8 +108,8 @@ private:
// Uses the space of the surface's target surface.
IntRect m_clipRect;
- Vector<CCLayerImpl*> m_layerList;
- Vector<CCDelegatedRendererLayerImpl*> m_contributingDelegatedRenderPassLayerList;
+ std::vector<CCLayerImpl*> m_layerList;
+ std::vector<CCDelegatedRendererLayerImpl*> m_contributingDelegatedRenderPassLayerList;
// The nearest ancestor target surface that will contain the contents of this surface, and that is going
// to move pixels within the surface (such as with a blur). This can point to itself.
diff --git a/cc/CCThreadedTest.cpp b/cc/CCThreadedTest.cpp
index 3a07759..af60e16 100644
--- a/cc/CCThreadedTest.cpp
+++ b/cc/CCThreadedTest.cpp
@@ -30,7 +30,6 @@
#include <public/WebFilterOperations.h>
#include <public/WebThread.h>
#include <wtf/Locker.h>
-#include <wtf/PassRefPtr.h>
using namespace cc;
using namespace WebKit;
@@ -142,7 +141,7 @@ MockLayerTreeHostImpl::MockLayerTreeHostImpl(TestHooks* testHooks, const CCLayer
// Adapts CCLayerTreeHost for test. Injects MockLayerTreeHostImpl.
class MockLayerTreeHost : public cc::CCLayerTreeHost {
public:
- static scoped_ptr<MockLayerTreeHost> create(TestHooks* testHooks, cc::CCLayerTreeHostClient* client, PassRefPtr<cc::LayerChromium> rootLayer, const cc::CCLayerTreeSettings& settings)
+ static scoped_ptr<MockLayerTreeHost> create(TestHooks* testHooks, cc::CCLayerTreeHostClient* client, scoped_refptr<cc::LayerChromium> rootLayer, const cc::CCLayerTreeSettings& settings)
{
scoped_ptr<MockLayerTreeHost> layerTreeHost(new MockLayerTreeHost(testHooks, client, settings));
bool success = layerTreeHost->initialize();
@@ -378,7 +377,7 @@ void CCThreadedTest::doBeginTest()
ASSERT(CCProxy::isMainThread());
m_client = MockLayerTreeHostClient::create(this);
- RefPtr<LayerChromium> rootLayer = LayerChromium::create();
+ scoped_refptr<LayerChromium> rootLayer = LayerChromium::create();
m_layerTreeHost = MockLayerTreeHost::create(this, m_client.get(), rootLayer, m_settings);
ASSERT_TRUE(m_layerTreeHost.get());
rootLayer->setLayerTreeHost(m_layerTreeHost.get());
diff --git a/cc/CCThreadedTest.h b/cc/CCThreadedTest.h
index d38c49de..2b53fa7 100644
--- a/cc/CCThreadedTest.h
+++ b/cc/CCThreadedTest.h
@@ -153,7 +153,7 @@ public:
virtual void drawLayers(const FrameData&) OVERRIDE;
// Make these public.
- typedef Vector<cc::CCLayerImpl*> CCLayerList;
+ typedef std::vector<cc::CCLayerImpl*> CCLayerList;
using CCLayerTreeHostImpl::calculateRenderSurfaceLayerList;
protected:
diff --git a/cc/ContentLayerChromium.cpp b/cc/ContentLayerChromium.cpp
index 675a6a1..c2bd8d1 100644
--- a/cc/ContentLayerChromium.cpp
+++ b/cc/ContentLayerChromium.cpp
@@ -40,9 +40,9 @@ void ContentLayerPainter::paint(SkCanvas* canvas, const IntRect& contentRect, Fl
WebKit::Platform::current()->histogramCustomCounts("Renderer4.AccelContentPaintMegapixPerSecond", pixelsPerSec / 1000000, 10, 210, 30);
}
-PassRefPtr<ContentLayerChromium> ContentLayerChromium::create(ContentLayerChromiumClient* client)
+scoped_refptr<ContentLayerChromium> ContentLayerChromium::create(ContentLayerChromiumClient* client)
{
- return adoptRef(new ContentLayerChromium(client));
+ return make_scoped_refptr(new ContentLayerChromium(client));
}
ContentLayerChromium::ContentLayerChromium(ContentLayerChromiumClient* client)
diff --git a/cc/ContentLayerChromium.h b/cc/ContentLayerChromium.h
index 1112134..b8ac462 100644
--- a/cc/ContentLayerChromium.h
+++ b/cc/ContentLayerChromium.h
@@ -38,9 +38,7 @@ private:
// A layer that renders its contents into an SkCanvas.
class ContentLayerChromium : public TiledLayerChromium {
public:
- static PassRefPtr<ContentLayerChromium> create(ContentLayerChromiumClient*);
-
- virtual ~ContentLayerChromium();
+ static scoped_refptr<ContentLayerChromium> create(ContentLayerChromiumClient*);
void clearClient() { m_client = 0; }
@@ -53,7 +51,7 @@ public:
protected:
explicit ContentLayerChromium(ContentLayerChromiumClient*);
-
+ virtual ~ContentLayerChromium();
private:
virtual LayerTextureUpdater* textureUpdater() const OVERRIDE;
diff --git a/cc/DelegatedRendererLayerChromium.cpp b/cc/DelegatedRendererLayerChromium.cpp
index 8b7a710..de34a00 100644
--- a/cc/DelegatedRendererLayerChromium.cpp
+++ b/cc/DelegatedRendererLayerChromium.cpp
@@ -9,9 +9,9 @@
namespace cc {
-PassRefPtr<DelegatedRendererLayerChromium> DelegatedRendererLayerChromium::create()
+scoped_refptr<DelegatedRendererLayerChromium> DelegatedRendererLayerChromium::create()
{
- return adoptRef(new DelegatedRendererLayerChromium());
+ return scoped_refptr<DelegatedRendererLayerChromium>(new DelegatedRendererLayerChromium());
}
DelegatedRendererLayerChromium::DelegatedRendererLayerChromium()
diff --git a/cc/DelegatedRendererLayerChromium.h b/cc/DelegatedRendererLayerChromium.h
index 1e464ae..32dbdcf 100644
--- a/cc/DelegatedRendererLayerChromium.h
+++ b/cc/DelegatedRendererLayerChromium.h
@@ -11,13 +11,15 @@ namespace cc {
class DelegatedRendererLayerChromium : public LayerChromium {
public:
- static PassRefPtr<DelegatedRendererLayerChromium> create();
- virtual ~DelegatedRendererLayerChromium();
+ static scoped_refptr<DelegatedRendererLayerChromium> create();
virtual PassOwnPtr<CCLayerImpl> createCCLayerImpl() OVERRIDE;
protected:
DelegatedRendererLayerChromium();
+
+private:
+ virtual ~DelegatedRendererLayerChromium();
};
}
diff --git a/cc/HeadsUpDisplayLayerChromium.cpp b/cc/HeadsUpDisplayLayerChromium.cpp
index a9e1108..7ec7a56 100644
--- a/cc/HeadsUpDisplayLayerChromium.cpp
+++ b/cc/HeadsUpDisplayLayerChromium.cpp
@@ -12,9 +12,9 @@
namespace cc {
-PassRefPtr<HeadsUpDisplayLayerChromium> HeadsUpDisplayLayerChromium::create()
+scoped_refptr<HeadsUpDisplayLayerChromium> HeadsUpDisplayLayerChromium::create()
{
- return adoptRef(new HeadsUpDisplayLayerChromium());
+ return make_scoped_refptr(new HeadsUpDisplayLayerChromium());
}
HeadsUpDisplayLayerChromium::HeadsUpDisplayLayerChromium()
diff --git a/cc/HeadsUpDisplayLayerChromium.h b/cc/HeadsUpDisplayLayerChromium.h
index a22d44e..36701f4 100644
--- a/cc/HeadsUpDisplayLayerChromium.h
+++ b/cc/HeadsUpDisplayLayerChromium.h
@@ -14,8 +14,7 @@ namespace cc {
class HeadsUpDisplayLayerChromium : public LayerChromium {
public:
- static PassRefPtr<HeadsUpDisplayLayerChromium> create();
- virtual ~HeadsUpDisplayLayerChromium();
+ static scoped_refptr<HeadsUpDisplayLayerChromium> create();
virtual void update(CCTextureUpdateQueue&, const CCOcclusionTracker*, CCRenderingStats&) OVERRIDE;
virtual bool drawsContent() const OVERRIDE;
@@ -29,6 +28,8 @@ protected:
HeadsUpDisplayLayerChromium();
private:
+ virtual ~HeadsUpDisplayLayerChromium();
+
scoped_ptr<CCFontAtlas> m_fontAtlas;
};
diff --git a/cc/IOSurfaceLayerChromium.cpp b/cc/IOSurfaceLayerChromium.cpp
index 896defa..7b242fd 100644
--- a/cc/IOSurfaceLayerChromium.cpp
+++ b/cc/IOSurfaceLayerChromium.cpp
@@ -12,9 +12,9 @@
namespace cc {
-PassRefPtr<IOSurfaceLayerChromium> IOSurfaceLayerChromium::create()
+scoped_refptr<IOSurfaceLayerChromium> IOSurfaceLayerChromium::create()
{
- return adoptRef(new IOSurfaceLayerChromium());
+ return make_scoped_refptr(new IOSurfaceLayerChromium());
}
IOSurfaceLayerChromium::IOSurfaceLayerChromium()
diff --git a/cc/IOSurfaceLayerChromium.h b/cc/IOSurfaceLayerChromium.h
index f1eb8e1..9c353f5 100644
--- a/cc/IOSurfaceLayerChromium.h
+++ b/cc/IOSurfaceLayerChromium.h
@@ -14,8 +14,7 @@ namespace cc {
class IOSurfaceLayerChromium : public LayerChromium {
public:
- static PassRefPtr<IOSurfaceLayerChromium> create();
- virtual ~IOSurfaceLayerChromium();
+ static scoped_refptr<IOSurfaceLayerChromium> create();
void setIOSurfaceProperties(uint32_t ioSurfaceId, const IntSize&);
@@ -27,6 +26,7 @@ protected:
IOSurfaceLayerChromium();
private:
+ virtual ~IOSurfaceLayerChromium();
uint32_t m_ioSurfaceId;
IntSize m_ioSurfaceSize;
diff --git a/cc/ImageLayerChromium.cpp b/cc/ImageLayerChromium.cpp
index ce1621c..ec1117a 100644
--- a/cc/ImageLayerChromium.cpp
+++ b/cc/ImageLayerChromium.cpp
@@ -80,9 +80,9 @@ private:
SkBitmap m_bitmap;
};
-PassRefPtr<ImageLayerChromium> ImageLayerChromium::create()
+scoped_refptr<ImageLayerChromium> ImageLayerChromium::create()
{
- return adoptRef(new ImageLayerChromium());
+ return make_scoped_refptr(new ImageLayerChromium());
}
ImageLayerChromium::ImageLayerChromium()
diff --git a/cc/ImageLayerChromium.h b/cc/ImageLayerChromium.h
index 8f76363..12ac397 100644
--- a/cc/ImageLayerChromium.h
+++ b/cc/ImageLayerChromium.h
@@ -18,8 +18,7 @@ class ImageLayerTextureUpdater;
// A Layer that contains only an Image element.
class ImageLayerChromium : public TiledLayerChromium {
public:
- static PassRefPtr<ImageLayerChromium> create();
- virtual ~ImageLayerChromium();
+ static scoped_refptr<ImageLayerChromium> create();
virtual bool drawsContent() const OVERRIDE;
virtual void setTexturePriorities(const CCPriorityCalculator&) OVERRIDE;
@@ -30,6 +29,7 @@ public:
private:
ImageLayerChromium();
+ virtual ~ImageLayerChromium();
void setTilingOption(TilingOption);
diff --git a/cc/LayerChromium.cpp b/cc/LayerChromium.cpp
index 744a2b5..9d1fda6 100644
--- a/cc/LayerChromium.cpp
+++ b/cc/LayerChromium.cpp
@@ -24,9 +24,9 @@ namespace cc {
static int s_nextLayerId = 1;
-PassRefPtr<LayerChromium> LayerChromium::create()
+scoped_refptr<LayerChromium> LayerChromium::create()
{
- return adoptRef(new LayerChromium());
+ return make_scoped_refptr(new LayerChromium());
}
LayerChromium::LayerChromium()
@@ -68,7 +68,6 @@ LayerChromium::LayerChromium()
, m_layerAnimationDelegate(0)
, m_layerScrollClient(0)
{
- turnOffVerifier(); // In the component build we don't have WTF threading initialized in this DLL so the thread verifier explodes.
if (m_layerId < 0) {
s_nextLayerId = 1;
m_layerId = s_nextLayerId++;
@@ -141,18 +140,20 @@ bool LayerChromium::hasAncestor(LayerChromium* ancestor) const
return false;
}
-void LayerChromium::addChild(PassRefPtr<LayerChromium> child)
+void LayerChromium::addChild(scoped_refptr<LayerChromium> child)
{
insertChild(child, numChildren());
}
-void LayerChromium::insertChild(PassRefPtr<LayerChromium> child, size_t index)
+void LayerChromium::insertChild(scoped_refptr<LayerChromium> child, size_t index)
{
index = min(index, m_children.size());
child->removeFromParent();
child->setParent(this);
child->m_stackingOrderChanged = true;
- m_children.insert(index, child);
+
+ LayerList::iterator iter = m_children.begin();
+ m_children.insert(iter + index, child);
setNeedsCommit();
}
@@ -164,16 +165,19 @@ void LayerChromium::removeFromParent()
void LayerChromium::removeChild(LayerChromium* child)
{
- int foundIndex = indexOfChild(child);
- if (foundIndex == -1)
- return;
+ for (LayerList::iterator iter = m_children.begin(); iter != m_children.end(); ++iter)
+ {
+ if (*iter != child)
+ continue;
- child->setParent(0);
- m_children.remove(foundIndex);
- setNeedsCommit();
+ child->setParent(0);
+ m_children.erase(iter);
+ setNeedsCommit();
+ return;
+ }
}
-void LayerChromium::replaceChild(LayerChromium* reference, PassRefPtr<LayerChromium> newLayer)
+void LayerChromium::replaceChild(LayerChromium* reference, scoped_refptr<LayerChromium> newLayer)
{
ASSERT_ARG(reference, reference);
ASSERT_ARG(reference, reference->parent() == this);
@@ -236,7 +240,7 @@ void LayerChromium::removeAllChildren()
}
}
-void LayerChromium::setChildren(const Vector<RefPtr<LayerChromium> >& children)
+void LayerChromium::setChildren(const LayerList& children)
{
if (children == m_children)
return;
@@ -778,7 +782,7 @@ ScrollbarLayerChromium* LayerChromium::toScrollbarLayerChromium()
return 0;
}
-void sortLayers(Vector<RefPtr<LayerChromium> >::iterator, Vector<RefPtr<LayerChromium> >::iterator, void*)
+void sortLayers(std::vector<scoped_refptr<LayerChromium> >::iterator, std::vector<scoped_refptr<LayerChromium> >::iterator, void*)
{
// Currently we don't use z-order to decide what to paint, so there's no need to actually sort LayerChromiums.
}
diff --git a/cc/LayerChromium.h b/cc/LayerChromium.h
index 4940bcd..0c98304 100644
--- a/cc/LayerChromium.h
+++ b/cc/LayerChromium.h
@@ -8,6 +8,7 @@
#if USE(ACCELERATED_COMPOSITING)
+#include "base/memory/ref_counted.h"
#include "CCLayerAnimationController.h"
#include "CCOcclusionTracker.h"
#include "CCPrioritizedTexture.h"
@@ -18,11 +19,9 @@
#include <public/WebFilterOperations.h>
#include <public/WebTransformationMatrix.h>
#include <string>
+#include <vector>
#include <wtf/OwnPtr.h>
#include <wtf/PassOwnPtr.h>
-#include <wtf/PassRefPtr.h>
-#include <wtf/RefCounted.h>
-#include <wtf/Vector.h>
namespace WebKit {
class WebAnimationDelegate;
@@ -43,11 +42,11 @@ struct CCRenderingStats;
// Base class for composited layers. Special layer types are derived from
// this class.
-class LayerChromium : public RefCounted<LayerChromium>, public CCLayerAnimationControllerClient {
+class LayerChromium : public base::RefCounted<LayerChromium>, public CCLayerAnimationControllerClient {
public:
- static PassRefPtr<LayerChromium> create();
+ typedef std::vector<scoped_refptr<LayerChromium> > LayerList;
- virtual ~LayerChromium();
+ static scoped_refptr<LayerChromium> create();
// CCLayerAnimationControllerClient implementation
virtual int id() const OVERRIDE;
@@ -61,14 +60,14 @@ public:
LayerChromium* rootLayer();
LayerChromium* parent() const;
- void addChild(PassRefPtr<LayerChromium>);
- void insertChild(PassRefPtr<LayerChromium>, size_t index);
- void replaceChild(LayerChromium* reference, PassRefPtr<LayerChromium> newLayer);
+ void addChild(scoped_refptr<LayerChromium>);
+ void insertChild(scoped_refptr<LayerChromium>, size_t index);
+ void replaceChild(LayerChromium* reference, scoped_refptr<LayerChromium> newLayer);
void removeFromParent();
void removeAllChildren();
- void setChildren(const Vector<RefPtr<LayerChromium> >&);
+ void setChildren(const LayerList&);
- const Vector<RefPtr<LayerChromium> >& children() const { return m_children; }
+ const LayerList& children() const { return m_children; }
void setAnchorPoint(const FloatPoint&);
FloatPoint anchorPoint() const { return m_anchorPoint; }
@@ -269,6 +268,7 @@ public:
protected:
friend class CCLayerImpl;
friend class TreeSynchronizer;
+ virtual ~LayerChromium();
LayerChromium();
@@ -288,13 +288,15 @@ protected:
// Note this rect is in layer space (not content space).
FloatRect m_updateRect;
- RefPtr<LayerChromium> m_maskLayer;
+ scoped_refptr<LayerChromium> m_maskLayer;
// Constructs a CCLayerImpl of the correct runtime type for this LayerChromium type.
virtual PassOwnPtr<CCLayerImpl> createCCLayerImpl();
int m_layerId;
private:
+ friend class base::RefCounted<LayerChromium>;
+
void setParent(LayerChromium*);
bool hasAncestor(LayerChromium*) const;
bool descendantIsFixedToContainerLayer() const;
@@ -307,7 +309,7 @@ private:
// This should only be called from removeFromParent.
void removeChild(LayerChromium*);
- Vector<RefPtr<LayerChromium> > m_children;
+ LayerList m_children;
LayerChromium* m_parent;
// LayerChromium instances have a weak pointer to their CCLayerTreeHost.
@@ -356,7 +358,7 @@ private:
WebKit::WebTransformationMatrix m_sublayerTransform;
// Replica layer used for reflections.
- RefPtr<LayerChromium> m_replicaLayer;
+ scoped_refptr<LayerChromium> m_replicaLayer;
// Transient properties.
OwnPtr<RenderSurfaceChromium> m_renderSurface;
@@ -379,7 +381,7 @@ private:
WebKit::WebLayerScrollClient* m_layerScrollClient;
};
-void sortLayers(Vector<RefPtr<LayerChromium> >::iterator, Vector<RefPtr<LayerChromium> >::iterator, void*);
+void sortLayers(std::vector<scoped_refptr<LayerChromium> >::iterator, std::vector<scoped_refptr<LayerChromium> >::iterator, void*);
}
#endif // USE(ACCELERATED_COMPOSITING)
diff --git a/cc/LayerChromiumTest.cpp b/cc/LayerChromiumTest.cpp
index 8c49f9c..867e4db 100644
--- a/cc/LayerChromiumTest.cpp
+++ b/cc/LayerChromiumTest.cpp
@@ -71,13 +71,13 @@ protected:
{
Mock::VerifyAndClearExpectations(m_layerTreeHost.get());
EXPECT_CALL(*m_layerTreeHost, setNeedsCommit()).Times(AnyNumber());
- m_parent.clear();
- m_child1.clear();
- m_child2.clear();
- m_child3.clear();
- m_grandChild1.clear();
- m_grandChild2.clear();
- m_grandChild3.clear();
+ m_parent = NULL;
+ m_child1 = NULL;
+ m_child2 = NULL;
+ m_child3 = NULL;
+ m_grandChild1 = NULL;
+ m_grandChild2 = NULL;
+ m_grandChild3 = NULL;
m_layerTreeHost->setRootLayer(0);
m_layerTreeHost.reset();
@@ -132,13 +132,13 @@ protected:
}
scoped_ptr<MockCCLayerTreeHost> m_layerTreeHost;
- RefPtr<LayerChromium> m_parent, m_child1, m_child2, m_child3, m_grandChild1, m_grandChild2, m_grandChild3;
+ scoped_refptr<LayerChromium> m_parent, m_child1, m_child2, m_child3, m_grandChild1, m_grandChild2, m_grandChild3;
WebCompositorInitializer m_compositorInitializer;
};
TEST_F(LayerChromiumTest, basicCreateAndDestroy)
{
- RefPtr<LayerChromium> testLayer = LayerChromium::create();
+ scoped_refptr<LayerChromium> testLayer = LayerChromium::create();
ASSERT_TRUE(testLayer);
EXPECT_CALL(*m_layerTreeHost, setNeedsCommit()).Times(0);
@@ -147,8 +147,8 @@ TEST_F(LayerChromiumTest, basicCreateAndDestroy)
TEST_F(LayerChromiumTest, addAndRemoveChild)
{
- RefPtr<LayerChromium> parent = LayerChromium::create();
- RefPtr<LayerChromium> child = LayerChromium::create();
+ scoped_refptr<LayerChromium> parent = LayerChromium::create();
+ scoped_refptr<LayerChromium> child = LayerChromium::create();
// Upon creation, layers should not have children or parent.
ASSERT_EQ(static_cast<size_t>(0), parent->children().size());
@@ -168,11 +168,11 @@ TEST_F(LayerChromiumTest, addAndRemoveChild)
TEST_F(LayerChromiumTest, insertChild)
{
- RefPtr<LayerChromium> parent = LayerChromium::create();
- RefPtr<LayerChromium> child1 = LayerChromium::create();
- RefPtr<LayerChromium> child2 = LayerChromium::create();
- RefPtr<LayerChromium> child3 = LayerChromium::create();
- RefPtr<LayerChromium> child4 = LayerChromium::create();
+ scoped_refptr<LayerChromium> parent = LayerChromium::create();
+ scoped_refptr<LayerChromium> child1 = LayerChromium::create();
+ scoped_refptr<LayerChromium> child2 = LayerChromium::create();
+ scoped_refptr<LayerChromium> child3 = LayerChromium::create();
+ scoped_refptr<LayerChromium> child4 = LayerChromium::create();
parent->setLayerTreeHost(m_layerTreeHost.get());
@@ -214,9 +214,9 @@ TEST_F(LayerChromiumTest, insertChild)
TEST_F(LayerChromiumTest, insertChildPastEndOfList)
{
- RefPtr<LayerChromium> parent = LayerChromium::create();
- RefPtr<LayerChromium> child1 = LayerChromium::create();
- RefPtr<LayerChromium> child2 = LayerChromium::create();
+ scoped_refptr<LayerChromium> parent = LayerChromium::create();
+ scoped_refptr<LayerChromium> child1 = LayerChromium::create();
+ scoped_refptr<LayerChromium> child2 = LayerChromium::create();
ASSERT_EQ(static_cast<size_t>(0), parent->children().size());
@@ -236,9 +236,9 @@ TEST_F(LayerChromiumTest, insertChildPastEndOfList)
TEST_F(LayerChromiumTest, insertSameChildTwice)
{
- RefPtr<LayerChromium> parent = LayerChromium::create();
- RefPtr<LayerChromium> child1 = LayerChromium::create();
- RefPtr<LayerChromium> child2 = LayerChromium::create();
+ scoped_refptr<LayerChromium> parent = LayerChromium::create();
+ scoped_refptr<LayerChromium> child1 = LayerChromium::create();
+ scoped_refptr<LayerChromium> child2 = LayerChromium::create();
parent->setLayerTreeHost(m_layerTreeHost.get());
@@ -265,7 +265,7 @@ TEST_F(LayerChromiumTest, insertSameChildTwice)
TEST_F(LayerChromiumTest, replaceChildWithNewChild)
{
createSimpleTestTree();
- RefPtr<LayerChromium> child4 = LayerChromium::create();
+ scoped_refptr<LayerChromium> child4 = LayerChromium::create();
EXPECT_FALSE(child4->parent());
@@ -285,8 +285,8 @@ TEST_F(LayerChromiumTest, replaceChildWithNewChildThatHasOtherParent)
createSimpleTestTree();
// create another simple tree with testLayer and child4.
- RefPtr<LayerChromium> testLayer = LayerChromium::create();
- RefPtr<LayerChromium> child4 = LayerChromium::create();
+ scoped_refptr<LayerChromium> testLayer = LayerChromium::create();
+ scoped_refptr<LayerChromium> child4 = LayerChromium::create();
testLayer->addChild(child4);
ASSERT_EQ(static_cast<size_t>(1), testLayer->children().size());
EXPECT_EQ(child4, testLayer->children()[0]);
@@ -330,15 +330,15 @@ TEST_F(LayerChromiumTest, removeAllChildren)
TEST_F(LayerChromiumTest, setChildren)
{
- RefPtr<LayerChromium> oldParent = LayerChromium::create();
- RefPtr<LayerChromium> newParent = LayerChromium::create();
+ scoped_refptr<LayerChromium> oldParent = LayerChromium::create();
+ scoped_refptr<LayerChromium> newParent = LayerChromium::create();
- RefPtr<LayerChromium> child1 = LayerChromium::create();
- RefPtr<LayerChromium> child2 = LayerChromium::create();
+ scoped_refptr<LayerChromium> child1 = LayerChromium::create();
+ scoped_refptr<LayerChromium> child2 = LayerChromium::create();
- Vector<RefPtr<LayerChromium> > newChildren;
- newChildren.append(child1);
- newChildren.append(child2);
+ std::vector<scoped_refptr<LayerChromium> > newChildren;
+ newChildren.push_back(child1);
+ newChildren.push_back(child2);
// Set up and verify initial test conditions: child1 has a parent, child2 has no parent.
oldParent->addChild(child1);
@@ -364,7 +364,7 @@ TEST_F(LayerChromiumTest, getRootLayerAfterTreeManipulations)
// For this test we don't care about setNeedsCommit calls.
EXPECT_CALL(*m_layerTreeHost, setNeedsCommit()).Times(AtLeast(1));
- RefPtr<LayerChromium> child4 = LayerChromium::create();
+ scoped_refptr<LayerChromium> child4 = LayerChromium::create();
EXPECT_EQ(m_parent.get(), m_parent->rootLayer());
EXPECT_EQ(m_parent.get(), m_child1->rootLayer());
@@ -417,7 +417,7 @@ TEST_F(LayerChromiumTest, checkSetNeedsDisplayCausesCorrectBehavior)
// 1. sets needsDisplay flag appropriately.
// 2. indirectly calls setNeedsCommit, exactly once for each call to setNeedsDisplay.
- RefPtr<LayerChromium> testLayer = LayerChromium::create();
+ scoped_refptr<LayerChromium> testLayer = LayerChromium::create();
testLayer->setLayerTreeHost(m_layerTreeHost.get());
IntSize testBounds = IntSize(501, 508);
@@ -467,10 +467,10 @@ TEST_F(LayerChromiumTest, checkSetNeedsDisplayCausesCorrectBehavior)
TEST_F(LayerChromiumTest, checkPropertyChangeCausesCorrectBehavior)
{
- RefPtr<LayerChromium> testLayer = LayerChromium::create();
+ scoped_refptr<LayerChromium> testLayer = LayerChromium::create();
testLayer->setLayerTreeHost(m_layerTreeHost.get());
- RefPtr<LayerChromium> dummyLayer = LayerChromium::create(); // just a dummy layer for this test case.
+ scoped_refptr<LayerChromium> dummyLayer = LayerChromium::create(); // just a dummy layer for this test case.
// sanity check of initial test condition
EXPECT_FALSE(testLayer->needsDisplay());
@@ -520,7 +520,7 @@ TEST_F(LayerChromiumTest, verifyPushPropertiesAccumulatesUpdateRect)
{
DebugScopedSetImplThread setImplThread;
- RefPtr<LayerChromium> testLayer = LayerChromium::create();
+ scoped_refptr<LayerChromium> testLayer = LayerChromium::create();
OwnPtr<CCLayerImpl> implLayer = CCLayerImpl::create(1);
testLayer->setNeedsDisplayRect(FloatRect(FloatPoint::zero(), FloatSize(5, 5)));
@@ -565,12 +565,16 @@ public:
const FloatRect& lastNeedsDisplayRect() const { return m_lastNeedsDisplayRect; }
private:
+ virtual ~LayerChromiumWithContentScaling()
+ {
+ }
+
FloatRect m_lastNeedsDisplayRect;
};
TEST_F(LayerChromiumTest, checkContentsScaleChangeTriggersNeedsDisplay)
{
- RefPtr<LayerChromiumWithContentScaling> testLayer = adoptRef(new LayerChromiumWithContentScaling());
+ scoped_refptr<LayerChromiumWithContentScaling> testLayer = make_scoped_refptr(new LayerChromiumWithContentScaling());
testLayer->setLayerTreeHost(m_layerTreeHost.get());
IntSize testBounds = IntSize(320, 240);
@@ -621,11 +625,11 @@ void assertLayerTreeHostMatchesForSubtree(LayerChromium* layer, CCLayerTreeHost*
TEST(LayerChromiumLayerTreeHostTest, enteringTree)
{
WebCompositorInitializer compositorInitializer(0);
- RefPtr<LayerChromium> parent = LayerChromium::create();
- RefPtr<LayerChromium> child = LayerChromium::create();
- RefPtr<LayerChromium> mask = LayerChromium::create();
- RefPtr<LayerChromium> replica = LayerChromium::create();
- RefPtr<LayerChromium> replicaMask = LayerChromium::create();
+ scoped_refptr<LayerChromium> parent = LayerChromium::create();
+ scoped_refptr<LayerChromium> child = LayerChromium::create();
+ scoped_refptr<LayerChromium> mask = LayerChromium::create();
+ scoped_refptr<LayerChromium> replica = LayerChromium::create();
+ scoped_refptr<LayerChromium> replicaMask = LayerChromium::create();
// Set up a detached tree of layers. The host pointer should be nil for these layers.
parent->addChild(child);
@@ -650,7 +654,7 @@ TEST(LayerChromiumLayerTreeHostTest, enteringTree)
TEST(LayerChromiumLayerTreeHostTest, addingLayerSubtree)
{
WebCompositorInitializer compositorInitializer(0);
- RefPtr<LayerChromium> parent = LayerChromium::create();
+ scoped_refptr<LayerChromium> parent = LayerChromium::create();
scoped_ptr<FakeCCLayerTreeHost> layerTreeHost(FakeCCLayerTreeHost::create());
layerTreeHost->setRootLayer(parent.get());
@@ -658,16 +662,16 @@ TEST(LayerChromiumLayerTreeHostTest, addingLayerSubtree)
EXPECT_EQ(parent->layerTreeHost(), layerTreeHost.get());
// Adding a subtree to a layer already associated with a host should set the host pointer on all layers in that subtree.
- RefPtr<LayerChromium> child = LayerChromium::create();
- RefPtr<LayerChromium> grandChild = LayerChromium::create();
+ scoped_refptr<LayerChromium> child = LayerChromium::create();
+ scoped_refptr<LayerChromium> grandChild = LayerChromium::create();
child->addChild(grandChild);
// Masks, replicas, and replica masks should pick up the new host too.
- RefPtr<LayerChromium> childMask = LayerChromium::create();
+ scoped_refptr<LayerChromium> childMask = LayerChromium::create();
child->setMaskLayer(childMask.get());
- RefPtr<LayerChromium> childReplica = LayerChromium::create();
+ scoped_refptr<LayerChromium> childReplica = LayerChromium::create();
child->setReplicaLayer(childReplica.get());
- RefPtr<LayerChromium> childReplicaMask = LayerChromium::create();
+ scoped_refptr<LayerChromium> childReplicaMask = LayerChromium::create();
childReplica->setMaskLayer(childReplicaMask.get());
parent->addChild(child);
@@ -679,11 +683,11 @@ TEST(LayerChromiumLayerTreeHostTest, addingLayerSubtree)
TEST(LayerChromiumLayerTreeHostTest, changeHost)
{
WebCompositorInitializer compositorInitializer(0);
- RefPtr<LayerChromium> parent = LayerChromium::create();
- RefPtr<LayerChromium> child = LayerChromium::create();
- RefPtr<LayerChromium> mask = LayerChromium::create();
- RefPtr<LayerChromium> replica = LayerChromium::create();
- RefPtr<LayerChromium> replicaMask = LayerChromium::create();
+ scoped_refptr<LayerChromium> parent = LayerChromium::create();
+ scoped_refptr<LayerChromium> child = LayerChromium::create();
+ scoped_refptr<LayerChromium> mask = LayerChromium::create();
+ scoped_refptr<LayerChromium> replica = LayerChromium::create();
+ scoped_refptr<LayerChromium> replicaMask = LayerChromium::create();
// Same setup as the previous test.
parent->addChild(child);
@@ -709,11 +713,11 @@ TEST(LayerChromiumLayerTreeHostTest, changeHost)
TEST(LayerChromiumLayerTreeHostTest, changeHostInSubtree)
{
WebCompositorInitializer compositorInitializer(0);
- RefPtr<LayerChromium> firstParent = LayerChromium::create();
- RefPtr<LayerChromium> firstChild = LayerChromium::create();
- RefPtr<LayerChromium> secondParent = LayerChromium::create();
- RefPtr<LayerChromium> secondChild = LayerChromium::create();
- RefPtr<LayerChromium> secondGrandChild = LayerChromium::create();
+ scoped_refptr<LayerChromium> firstParent = LayerChromium::create();
+ scoped_refptr<LayerChromium> firstChild = LayerChromium::create();
+ scoped_refptr<LayerChromium> secondParent = LayerChromium::create();
+ scoped_refptr<LayerChromium> secondChild = LayerChromium::create();
+ scoped_refptr<LayerChromium> secondGrandChild = LayerChromium::create();
// First put all children under the first parent and set the first host.
firstParent->addChild(firstChild);
@@ -743,13 +747,13 @@ TEST(LayerChromiumLayerTreeHostTest, changeHostInSubtree)
TEST(LayerChromiumLayerTreeHostTest, replaceMaskAndReplicaLayer)
{
WebCompositorInitializer compositorInitializer(0);
- RefPtr<LayerChromium> parent = LayerChromium::create();
- RefPtr<LayerChromium> mask = LayerChromium::create();
- RefPtr<LayerChromium> replica = LayerChromium::create();
- RefPtr<LayerChromium> maskChild = LayerChromium::create();
- RefPtr<LayerChromium> replicaChild = LayerChromium::create();
- RefPtr<LayerChromium> maskReplacement = LayerChromium::create();
- RefPtr<LayerChromium> replicaReplacement = LayerChromium::create();
+ scoped_refptr<LayerChromium> parent = LayerChromium::create();
+ scoped_refptr<LayerChromium> mask = LayerChromium::create();
+ scoped_refptr<LayerChromium> replica = LayerChromium::create();
+ scoped_refptr<LayerChromium> maskChild = LayerChromium::create();
+ scoped_refptr<LayerChromium> replicaChild = LayerChromium::create();
+ scoped_refptr<LayerChromium> maskReplacement = LayerChromium::create();
+ scoped_refptr<LayerChromium> replicaReplacement = LayerChromium::create();
parent->setMaskLayer(mask.get());
parent->setReplicaLayer(replica.get());
@@ -778,8 +782,8 @@ TEST(LayerChromiumLayerTreeHostTest, replaceMaskAndReplicaLayer)
TEST(LayerChromiumLayerTreeHostTest, destroyHostWithNonNullRootLayer)
{
WebCompositorInitializer compositorInitializer(0);
- RefPtr<LayerChromium> root = LayerChromium::create();
- RefPtr<LayerChromium> child = LayerChromium::create();
+ scoped_refptr<LayerChromium> root = LayerChromium::create();
+ scoped_refptr<LayerChromium> child = LayerChromium::create();
root->addChild(child);
scoped_ptr<FakeCCLayerTreeHost> layerTreeHost(FakeCCLayerTreeHost::create());
layerTreeHost->setRootLayer(root);
@@ -805,7 +809,7 @@ TEST(LayerChromiumLayerTreeHostTest, shouldNotAddAnimationWithoutLayerTreeHost)
WebKit::Platform::current()->compositorSupport()->setAcceleratedAnimationEnabled(true);
WebCompositorInitializer compositorInitializer(0);
- RefPtr<LayerChromium> layer = LayerChromium::create();
+ scoped_refptr<LayerChromium> layer = LayerChromium::create();
// Case 1: without a layerTreeHost, the animation should not be accepted.
EXPECT_FALSE(addTestAnimation(layer.get()));
@@ -822,11 +826,16 @@ TEST(LayerChromiumLayerTreeHostTest, shouldNotAddAnimationWithoutLayerTreeHost)
class MockLayerChromium : public LayerChromium {
public:
bool needsDisplay() const { return m_needsDisplay; }
+
+private:
+ virtual ~MockLayerChromium()
+ {
+ }
};
TEST(LayerChromiumTestWithoutFixture, setBoundsTriggersSetNeedsRedrawAfterGettingNonEmptyBounds)
{
- RefPtr<MockLayerChromium> layer(adoptRef(new MockLayerChromium));
+ scoped_refptr<MockLayerChromium> layer(new MockLayerChromium);
EXPECT_FALSE(layer->needsDisplay());
layer->setBounds(IntSize(0, 10));
EXPECT_FALSE(layer->needsDisplay());
diff --git a/cc/RenderSurfaceChromium.h b/cc/RenderSurfaceChromium.h
index f267671..67ed626 100644
--- a/cc/RenderSurfaceChromium.h
+++ b/cc/RenderSurfaceChromium.h
@@ -9,9 +9,11 @@
#if USE(ACCELERATED_COMPOSITING)
#include "base/basictypes.h"
+#include "base/memory/ref_counted.h"
#include "FloatRect.h"
#include "IntRect.h"
#include <public/WebTransformationMatrix.h>
+#include <vector>
namespace cc {
@@ -56,7 +58,8 @@ public:
const IntRect& clipRect() const { return m_clipRect; }
void setClipRect(const IntRect& clipRect) { m_clipRect = clipRect; }
- Vector<RefPtr<LayerChromium> >& layerList() { return m_layerList; }
+ typedef std::vector<scoped_refptr<LayerChromium> > LayerList;
+ LayerList& layerList() { return m_layerList; }
// A no-op since DelegatedRendererLayers on the main thread don't have any
// RenderPasses so they can't contribute to a surface.
void addContributingDelegatedRenderPassLayer(LayerChromium*) { }
@@ -85,7 +88,7 @@ private:
// Uses the space of the surface's target surface.
IntRect m_clipRect;
- Vector<RefPtr<LayerChromium> > m_layerList;
+ LayerList m_layerList;
// The nearest ancestor target surface that will contain the contents of this surface, and that is going
// to move pixels within the surface (such as with a blur). This can point to itself.
diff --git a/cc/ScrollbarLayerChromium.cpp b/cc/ScrollbarLayerChromium.cpp
index f07cc42..5cafad2 100644
--- a/cc/ScrollbarLayerChromium.cpp
+++ b/cc/ScrollbarLayerChromium.cpp
@@ -25,9 +25,9 @@ PassOwnPtr<CCLayerImpl> ScrollbarLayerChromium::createCCLayerImpl()
return CCScrollbarLayerImpl::create(id());
}
-PassRefPtr<ScrollbarLayerChromium> ScrollbarLayerChromium::create(PassOwnPtr<WebKit::WebScrollbar> scrollbar, WebKit::WebScrollbarThemePainter painter, PassOwnPtr<WebKit::WebScrollbarThemeGeometry> geometry, int scrollLayerId)
+scoped_refptr<ScrollbarLayerChromium> ScrollbarLayerChromium::create(PassOwnPtr<WebKit::WebScrollbar> scrollbar, WebKit::WebScrollbarThemePainter painter, PassOwnPtr<WebKit::WebScrollbarThemeGeometry> geometry, int scrollLayerId)
{
- return adoptRef(new ScrollbarLayerChromium(scrollbar, painter, geometry, scrollLayerId));
+ return make_scoped_refptr(new ScrollbarLayerChromium(scrollbar, painter, geometry, scrollLayerId));
}
ScrollbarLayerChromium::ScrollbarLayerChromium(PassOwnPtr<WebKit::WebScrollbar> scrollbar, WebKit::WebScrollbarThemePainter painter, PassOwnPtr<WebKit::WebScrollbarThemeGeometry> geometry, int scrollLayerId)
diff --git a/cc/ScrollbarLayerChromium.h b/cc/ScrollbarLayerChromium.h
index 15f3224..e34c2c22 100644
--- a/cc/ScrollbarLayerChromium.h
+++ b/cc/ScrollbarLayerChromium.h
@@ -34,9 +34,7 @@ class ScrollbarLayerChromium : public LayerChromium {
public:
virtual PassOwnPtr<CCLayerImpl> createCCLayerImpl() OVERRIDE;
- static PassRefPtr<ScrollbarLayerChromium> create(PassOwnPtr<WebKit::WebScrollbar>, WebKit::WebScrollbarThemePainter, PassOwnPtr<WebKit::WebScrollbarThemeGeometry>, int scrollLayerId);
-
- virtual ~ScrollbarLayerChromium();
+ static scoped_refptr<ScrollbarLayerChromium> create(PassOwnPtr<WebKit::WebScrollbar>, WebKit::WebScrollbarThemePainter, PassOwnPtr<WebKit::WebScrollbarThemeGeometry>, int scrollLayerId);
// LayerChromium interface
virtual bool needsContentsScale() const OVERRIDE;
@@ -53,6 +51,7 @@ public:
protected:
ScrollbarLayerChromium(PassOwnPtr<WebKit::WebScrollbar>, WebKit::WebScrollbarThemePainter, PassOwnPtr<WebKit::WebScrollbarThemeGeometry>, int scrollLayerId);
+ virtual ~ScrollbarLayerChromium();
private:
void updatePart(ScrollLayerTextureUpdater*, LayerTextureUpdater::Texture*, const IntRect&, CCTextureUpdateQueue&, CCRenderingStats&);
diff --git a/cc/ScrollbarLayerChromiumTest.cpp b/cc/ScrollbarLayerChromiumTest.cpp
index ac79bd9..0231e78 100644
--- a/cc/ScrollbarLayerChromiumTest.cpp
+++ b/cc/ScrollbarLayerChromiumTest.cpp
@@ -51,9 +51,9 @@ TEST(ScrollbarLayerChromiumTest, resolveScrollLayerPointer)
{
OwnPtr<WebKit::WebScrollbar> scrollbar(FakeWebScrollbar::create());
- RefPtr<LayerChromium> layerTreeRoot = LayerChromium::create();
- RefPtr<LayerChromium> child1 = LayerChromium::create();
- RefPtr<LayerChromium> child2 = ScrollbarLayerChromium::create(scrollbar.release(), painter, WebKit::FakeWebScrollbarThemeGeometry::create(), child1->id());
+ scoped_refptr<LayerChromium> layerTreeRoot = LayerChromium::create();
+ scoped_refptr<LayerChromium> child1 = LayerChromium::create();
+ scoped_refptr<LayerChromium> child2 = ScrollbarLayerChromium::create(scrollbar.release(), painter, WebKit::FakeWebScrollbarThemeGeometry::create(), child1->id());
layerTreeRoot->addChild(child1);
layerTreeRoot->addChild(child2);
@@ -68,9 +68,9 @@ TEST(ScrollbarLayerChromiumTest, resolveScrollLayerPointer)
{ // another traverse order
OwnPtr<WebKit::WebScrollbar> scrollbar(FakeWebScrollbar::create());
- RefPtr<LayerChromium> layerTreeRoot = LayerChromium::create();
- RefPtr<LayerChromium> child2 = LayerChromium::create();
- RefPtr<LayerChromium> child1 = ScrollbarLayerChromium::create(scrollbar.release(), painter, WebKit::FakeWebScrollbarThemeGeometry::create(), child2->id());
+ scoped_refptr<LayerChromium> layerTreeRoot = LayerChromium::create();
+ scoped_refptr<LayerChromium> child2 = LayerChromium::create();
+ scoped_refptr<LayerChromium> child1 = ScrollbarLayerChromium::create(scrollbar.release(), painter, WebKit::FakeWebScrollbarThemeGeometry::create(), child2->id());
layerTreeRoot->addChild(child1);
layerTreeRoot->addChild(child2);
@@ -91,9 +91,9 @@ TEST(ScrollbarLayerChromiumTest, scrollOffsetSynchronization)
WebKit::WebScrollbarThemePainter painter;
OwnPtr<WebKit::WebScrollbar> scrollbar(FakeWebScrollbar::create());
- RefPtr<LayerChromium> layerTreeRoot = LayerChromium::create();
- RefPtr<LayerChromium> contentLayer = LayerChromium::create();
- RefPtr<LayerChromium> scrollbarLayer = ScrollbarLayerChromium::create(scrollbar.release(), painter, WebKit::FakeWebScrollbarThemeGeometry::create(), layerTreeRoot->id());
+ scoped_refptr<LayerChromium> layerTreeRoot = LayerChromium::create();
+ scoped_refptr<LayerChromium> contentLayer = LayerChromium::create();
+ scoped_refptr<LayerChromium> scrollbarLayer = ScrollbarLayerChromium::create(scrollbar.release(), painter, WebKit::FakeWebScrollbarThemeGeometry::create(), layerTreeRoot->id());
layerTreeRoot->addChild(contentLayer);
layerTreeRoot->addChild(scrollbarLayer);
diff --git a/cc/SolidColorLayerChromium.cpp b/cc/SolidColorLayerChromium.cpp
index 8955f77..a69e122 100644
--- a/cc/SolidColorLayerChromium.cpp
+++ b/cc/SolidColorLayerChromium.cpp
@@ -17,9 +17,9 @@ PassOwnPtr<CCLayerImpl> SolidColorLayerChromium::createCCLayerImpl()
return CCSolidColorLayerImpl::create(id());
}
-PassRefPtr<SolidColorLayerChromium> SolidColorLayerChromium::create()
+scoped_refptr<SolidColorLayerChromium> SolidColorLayerChromium::create()
{
- return adoptRef(new SolidColorLayerChromium());
+ return make_scoped_refptr(new SolidColorLayerChromium());
}
SolidColorLayerChromium::SolidColorLayerChromium()
diff --git a/cc/SolidColorLayerChromium.h b/cc/SolidColorLayerChromium.h
index c8d173f..592c925 100644
--- a/cc/SolidColorLayerChromium.h
+++ b/cc/SolidColorLayerChromium.h
@@ -16,13 +16,15 @@ namespace cc {
// setBackgroundColor() on the base class.
class SolidColorLayerChromium : public LayerChromium {
public:
- virtual PassOwnPtr<CCLayerImpl> createCCLayerImpl() OVERRIDE;
- static PassRefPtr<SolidColorLayerChromium> create();
+ static scoped_refptr<SolidColorLayerChromium> create();
- virtual ~SolidColorLayerChromium();
+ virtual PassOwnPtr<CCLayerImpl> createCCLayerImpl() OVERRIDE;
protected:
SolidColorLayerChromium();
+
+private:
+ virtual ~SolidColorLayerChromium();
};
}
diff --git a/cc/TextureLayerChromium.cpp b/cc/TextureLayerChromium.cpp
index c1f561e..6435f81 100644
--- a/cc/TextureLayerChromium.cpp
+++ b/cc/TextureLayerChromium.cpp
@@ -15,9 +15,9 @@
namespace cc {
-PassRefPtr<TextureLayerChromium> TextureLayerChromium::create(TextureLayerChromiumClient* client)
+scoped_refptr<TextureLayerChromium> TextureLayerChromium::create(TextureLayerChromiumClient* client)
{
- return adoptRef(new TextureLayerChromium(client));
+ return scoped_refptr<TextureLayerChromium>(new TextureLayerChromium(client));
}
TextureLayerChromium::TextureLayerChromium(TextureLayerChromiumClient* client)
diff --git a/cc/TextureLayerChromium.h b/cc/TextureLayerChromium.h
index 1886c79..2be64d4 100644
--- a/cc/TextureLayerChromium.h
+++ b/cc/TextureLayerChromium.h
@@ -23,8 +23,7 @@ public:
// If this texture layer requires special preparation logic for each frame driven by
// the compositor, pass in a non-nil client. Pass in a nil client pointer if texture updates
// are driven by an external process.
- static PassRefPtr<TextureLayerChromium> create(TextureLayerChromiumClient*);
- virtual ~TextureLayerChromium();
+ static scoped_refptr<TextureLayerChromium> create(TextureLayerChromiumClient*);
void clearClient() { m_client = 0; }
@@ -58,6 +57,7 @@ public:
protected:
explicit TextureLayerChromium(TextureLayerChromiumClient*);
+ virtual ~TextureLayerChromium();
private:
TextureLayerChromiumClient* m_client;
diff --git a/cc/TextureLayerChromiumTest.cpp b/cc/TextureLayerChromiumTest.cpp
index c57b55f..b9d7474 100644
--- a/cc/TextureLayerChromiumTest.cpp
+++ b/cc/TextureLayerChromiumTest.cpp
@@ -64,7 +64,7 @@ private:
TEST_F(TextureLayerChromiumTest, syncImplWhenChangingTextureId)
{
- RefPtr<TextureLayerChromium> testLayer = TextureLayerChromium::create(0);
+ scoped_refptr<TextureLayerChromium> testLayer = TextureLayerChromium::create(0);
ASSERT_TRUE(testLayer);
EXPECT_CALL(*m_layerTreeHost, acquireLayerTextures()).Times(AnyNumber());
@@ -87,12 +87,12 @@ TEST_F(TextureLayerChromiumTest, syncImplWhenChangingTextureId)
TEST_F(TextureLayerChromiumTest, syncImplWhenRemovingFromTree)
{
- RefPtr<LayerChromium> rootLayer = LayerChromium::create();
+ scoped_refptr<LayerChromium> rootLayer = LayerChromium::create();
ASSERT_TRUE(rootLayer);
- RefPtr<LayerChromium> childLayer = LayerChromium::create();
+ scoped_refptr<LayerChromium> childLayer = LayerChromium::create();
ASSERT_TRUE(childLayer);
rootLayer->addChild(childLayer);
- RefPtr<TextureLayerChromium> testLayer = TextureLayerChromium::create(0);
+ scoped_refptr<TextureLayerChromium> testLayer = TextureLayerChromium::create(0);
ASSERT_TRUE(testLayer);
testLayer->setTextureId(0);
childLayer->addChild(testLayer);
diff --git a/cc/TiledLayerChromium.h b/cc/TiledLayerChromium.h
index 18b6da3..016ea1b 100644
--- a/cc/TiledLayerChromium.h
+++ b/cc/TiledLayerChromium.h
@@ -18,8 +18,6 @@ class TiledLayerChromium : public LayerChromium {
public:
enum TilingOption { AlwaysTile, NeverTile, AutoTile };
- virtual ~TiledLayerChromium();
-
virtual void setIsMask(bool) OVERRIDE;
virtual void pushPropertiesTo(CCLayerImpl*) OVERRIDE;
@@ -43,6 +41,7 @@ public:
protected:
TiledLayerChromium();
+ virtual ~TiledLayerChromium();
void updateTileSizeAndTilingOption();
void updateBounds();
diff --git a/cc/TiledLayerChromiumTest.cpp b/cc/TiledLayerChromiumTest.cpp
index 6f1e298..11de0c7 100644
--- a/cc/TiledLayerChromiumTest.cpp
+++ b/cc/TiledLayerChromiumTest.cpp
@@ -171,7 +171,7 @@ public:
TEST_F(TiledLayerChromiumTest, pushDirtyTiles)
{
- RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get()));
+ scoped_refptr<FakeTiledLayerChromium> layer = make_scoped_refptr(new FakeTiledLayerChromium(m_textureManager.get()));
ScopedFakeCCTiledLayerImpl layerImpl(1);
// The tile size is 100x100, so this invalidates and then paints two tiles.
@@ -197,7 +197,7 @@ TEST_F(TiledLayerChromiumTest, pushDirtyTiles)
TEST_F(TiledLayerChromiumTest, pushOccludedDirtyTiles)
{
- RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get()));
+ scoped_refptr<FakeTiledLayerChromium> layer = make_scoped_refptr(new FakeTiledLayerChromium(m_textureManager.get()));
ScopedFakeCCTiledLayerImpl layerImpl(1);
TestCCOcclusionTracker occluded;
m_occlusion = &occluded;
@@ -233,7 +233,7 @@ TEST_F(TiledLayerChromiumTest, pushOccludedDirtyTiles)
TEST_F(TiledLayerChromiumTest, pushDeletedTiles)
{
- RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get()));
+ scoped_refptr<FakeTiledLayerChromium> layer = make_scoped_refptr(new FakeTiledLayerChromium(m_textureManager.get()));
ScopedFakeCCTiledLayerImpl layerImpl(1);
// The tile size is 100x100, so this invalidates and then paints two tiles.
@@ -268,7 +268,7 @@ TEST_F(TiledLayerChromiumTest, pushDeletedTiles)
TEST_F(TiledLayerChromiumTest, pushIdlePaintTiles)
{
- RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get()));
+ scoped_refptr<FakeTiledLayerChromium> layer = make_scoped_refptr(new FakeTiledLayerChromium(m_textureManager.get()));
ScopedFakeCCTiledLayerImpl layerImpl(1);
// The tile size is 100x100. Setup 5x5 tiles with one visible tile in the center.
@@ -305,10 +305,10 @@ TEST_F(TiledLayerChromiumTest, pushIdlePaintTiles)
TEST_F(TiledLayerChromiumTest, pushTilesAfterIdlePaintFailed)
{
// Start with 2mb of memory, but the test is going to try to use just more than 1mb, so we reduce to 1mb later.
- m_textureManager->setMaxMemoryLimitBytes(2 * 1024 * 1024);
- RefPtr<FakeTiledLayerChromium> layer1 = adoptRef(new FakeTiledLayerChromium(m_textureManager.get()));
+ m_textureManager->setMaxMemoryLimitBytes(2 * 1024 * 1024);
+ scoped_refptr<FakeTiledLayerChromium> layer1 = make_scoped_refptr(new FakeTiledLayerChromium(m_textureManager.get()));
ScopedFakeCCTiledLayerImpl layerImpl1(1);
- RefPtr<FakeTiledLayerChromium> layer2 = adoptRef(new FakeTiledLayerChromium(m_textureManager.get()));
+ scoped_refptr<FakeTiledLayerChromium> layer2 = make_scoped_refptr(new FakeTiledLayerChromium(m_textureManager.get()));
ScopedFakeCCTiledLayerImpl layerImpl2(2);
// For this test we have two layers. layer1 exhausts most texture memory, leaving room for 2 more tiles from
@@ -358,7 +358,7 @@ TEST_F(TiledLayerChromiumTest, pushTilesAfterIdlePaintFailed)
TEST_F(TiledLayerChromiumTest, pushIdlePaintedOccludedTiles)
{
- RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get()));
+ scoped_refptr<FakeTiledLayerChromium> layer = make_scoped_refptr(new FakeTiledLayerChromium(m_textureManager.get()));
ScopedFakeCCTiledLayerImpl layerImpl(1);
TestCCOcclusionTracker occluded;
m_occlusion = &occluded;
@@ -377,7 +377,7 @@ TEST_F(TiledLayerChromiumTest, pushIdlePaintedOccludedTiles)
TEST_F(TiledLayerChromiumTest, pushTilesMarkedDirtyDuringPaint)
{
- RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get()));
+ scoped_refptr<FakeTiledLayerChromium> layer = make_scoped_refptr(new FakeTiledLayerChromium(m_textureManager.get()));
ScopedFakeCCTiledLayerImpl layerImpl(1);
// The tile size is 100x100, so this invalidates and then paints two tiles.
@@ -395,8 +395,8 @@ TEST_F(TiledLayerChromiumTest, pushTilesMarkedDirtyDuringPaint)
TEST_F(TiledLayerChromiumTest, pushTilesLayerMarkedDirtyDuringPaintOnNextLayer)
{
- RefPtr<FakeTiledLayerChromium> layer1 = adoptRef(new FakeTiledLayerChromium(m_textureManager.get()));
- RefPtr<FakeTiledLayerChromium> layer2 = adoptRef(new FakeTiledLayerChromium(m_textureManager.get()));
+ scoped_refptr<FakeTiledLayerChromium> layer1 = make_scoped_refptr(new FakeTiledLayerChromium(m_textureManager.get()));
+ scoped_refptr<FakeTiledLayerChromium> layer2 = make_scoped_refptr(new FakeTiledLayerChromium(m_textureManager.get()));
ScopedFakeCCTiledLayerImpl layer1Impl(1);
ScopedFakeCCTiledLayerImpl layer2Impl(2);
@@ -418,8 +418,8 @@ TEST_F(TiledLayerChromiumTest, pushTilesLayerMarkedDirtyDuringPaintOnNextLayer)
TEST_F(TiledLayerChromiumTest, pushTilesLayerMarkedDirtyDuringPaintOnPreviousLayer)
{
- RefPtr<FakeTiledLayerChromium> layer1 = adoptRef(new FakeTiledLayerChromium(m_textureManager.get()));
- RefPtr<FakeTiledLayerChromium> layer2 = adoptRef(new FakeTiledLayerChromium(m_textureManager.get()));
+ scoped_refptr<FakeTiledLayerChromium> layer1 = make_scoped_refptr(new FakeTiledLayerChromium(m_textureManager.get()));
+ scoped_refptr<FakeTiledLayerChromium> layer2 = make_scoped_refptr(new FakeTiledLayerChromium(m_textureManager.get()));
ScopedFakeCCTiledLayerImpl layer1Impl(1);
ScopedFakeCCTiledLayerImpl layer2Impl(2);
@@ -460,7 +460,7 @@ TEST_F(TiledLayerChromiumTest, paintSmallAnimatedLayersImmediately)
m_textureManager->setMaxMemoryLimitBytes(memoryForLayer);
- RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get()));
+ scoped_refptr<FakeTiledLayerChromium> layer = make_scoped_refptr(new FakeTiledLayerChromium(m_textureManager.get()));
ScopedFakeCCTiledLayerImpl layerImpl(1);
// Full size layer with half being visible.
@@ -502,7 +502,7 @@ TEST_F(TiledLayerChromiumTest, paintSmallAnimatedLayersImmediately)
TEST_F(TiledLayerChromiumTest, idlePaintOutOfMemory)
{
- RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get()));
+ scoped_refptr<FakeTiledLayerChromium> layer = make_scoped_refptr(new FakeTiledLayerChromium(m_textureManager.get()));
ScopedFakeCCTiledLayerImpl layerImpl(1);
// We have enough memory for only the visible rect, so we will run out of memory in first idle paint.
@@ -525,7 +525,7 @@ TEST_F(TiledLayerChromiumTest, idlePaintOutOfMemory)
TEST_F(TiledLayerChromiumTest, idlePaintZeroSizedLayer)
{
- RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get()));
+ scoped_refptr<FakeTiledLayerChromium> layer = make_scoped_refptr(new FakeTiledLayerChromium(m_textureManager.get()));
ScopedFakeCCTiledLayerImpl layerImpl(1);
bool animating[2] = {false, true};
@@ -552,7 +552,7 @@ TEST_F(TiledLayerChromiumTest, idlePaintZeroSizedLayer)
TEST_F(TiledLayerChromiumTest, idlePaintNonVisibleLayers)
{
- RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get()));
+ scoped_refptr<FakeTiledLayerChromium> layer = make_scoped_refptr(new FakeTiledLayerChromium(m_textureManager.get()));
ScopedFakeCCTiledLayerImpl layerImpl(1);
// Alternate between not visible and visible.
@@ -582,7 +582,7 @@ TEST_F(TiledLayerChromiumTest, idlePaintNonVisibleLayers)
TEST_F(TiledLayerChromiumTest, invalidateFromPrepare)
{
- RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get()));
+ scoped_refptr<FakeTiledLayerChromium> layer = make_scoped_refptr(new FakeTiledLayerChromium(m_textureManager.get()));
ScopedFakeCCTiledLayerImpl layerImpl(1);
// The tile size is 100x100, so this invalidates and then paints two tiles.
@@ -617,7 +617,7 @@ TEST_F(TiledLayerChromiumTest, verifyUpdateRectWhenContentBoundsAreScaled)
{
// The updateRect (that indicates what was actually painted) should be in
// layer space, not the content space.
- RefPtr<FakeTiledLayerWithScaledBounds> layer = adoptRef(new FakeTiledLayerWithScaledBounds(m_textureManager.get()));
+ scoped_refptr<FakeTiledLayerWithScaledBounds> layer = make_scoped_refptr(new FakeTiledLayerWithScaledBounds(m_textureManager.get()));
IntRect layerBounds(0, 0, 300, 200);
IntRect contentBounds(0, 0, 200, 250);
@@ -655,7 +655,7 @@ TEST_F(TiledLayerChromiumTest, verifyUpdateRectWhenContentBoundsAreScaled)
TEST_F(TiledLayerChromiumTest, verifyInvalidationWhenContentsScaleChanges)
{
- RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get()));
+ scoped_refptr<FakeTiledLayerChromium> layer = make_scoped_refptr(new FakeTiledLayerChromium(m_textureManager.get()));
ScopedFakeCCTiledLayerImpl layerImpl(1);
// Create a layer with one tile.
@@ -720,8 +720,8 @@ TEST_F(TiledLayerChromiumTest, skipsDrawGetsReset)
// We have enough memory for only one of the two layers.
int memoryLimit = 4 * 300 * 300; // 4 bytes per pixel.
- RefPtr<FakeTiledLayerChromium> rootLayer = adoptRef(new FakeTiledLayerChromium(ccLayerTreeHost->contentsTextureManager()));
- RefPtr<FakeTiledLayerChromium> childLayer = adoptRef(new FakeTiledLayerChromium(ccLayerTreeHost->contentsTextureManager()));
+ scoped_refptr<FakeTiledLayerChromium> rootLayer = make_scoped_refptr(new FakeTiledLayerChromium(ccLayerTreeHost->contentsTextureManager()));
+ scoped_refptr<FakeTiledLayerChromium> childLayer = make_scoped_refptr(new FakeTiledLayerChromium(ccLayerTreeHost->contentsTextureManager()));
rootLayer->addChild(childLayer);
rootLayer->setBounds(contentBounds);
@@ -756,7 +756,7 @@ TEST_F(TiledLayerChromiumTest, skipsDrawGetsReset)
TEST_F(TiledLayerChromiumTest, resizeToSmaller)
{
- RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get()));
+ scoped_refptr<FakeTiledLayerChromium> layer = make_scoped_refptr(new FakeTiledLayerChromium(m_textureManager.get()));
layer->setBounds(IntSize(700, 700));
layer->setVisibleContentRect(IntRect(0, 0, 700, 700));
@@ -772,7 +772,7 @@ TEST_F(TiledLayerChromiumTest, resizeToSmaller)
TEST_F(TiledLayerChromiumTest, hugeLayerUpdateCrash)
{
- RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get()));
+ scoped_refptr<FakeTiledLayerChromium> layer = make_scoped_refptr(new FakeTiledLayerChromium(m_textureManager.get()));
int size = 1 << 30;
layer->setBounds(IntSize(size, size));
@@ -798,7 +798,7 @@ TEST_F(TiledLayerChromiumTest, partialUpdates)
IntSize contentBounds(300, 200);
IntRect contentRect(IntPoint::zero(), contentBounds);
- RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(ccLayerTreeHost->contentsTextureManager()));
+ scoped_refptr<FakeTiledLayerChromium> layer = make_scoped_refptr(new FakeTiledLayerChromium(ccLayerTreeHost->contentsTextureManager()));
layer->setBounds(contentBounds);
layer->setPosition(FloatPoint(0, 0));
layer->setVisibleContentRect(contentRect);
@@ -896,7 +896,7 @@ TEST_F(TiledLayerChromiumTest, partialUpdates)
TEST_F(TiledLayerChromiumTest, tilesPaintedWithoutOcclusion)
{
- RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get()));
+ scoped_refptr<FakeTiledLayerChromium> layer = make_scoped_refptr(new FakeTiledLayerChromium(m_textureManager.get()));
// The tile size is 100x100, so this invalidates and then paints two tiles.
layer->setBounds(IntSize(100, 200));
@@ -912,7 +912,7 @@ TEST_F(TiledLayerChromiumTest, tilesPaintedWithoutOcclusion)
TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusion)
{
- RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get()));
+ scoped_refptr<FakeTiledLayerChromium> layer = make_scoped_refptr(new FakeTiledLayerChromium(m_textureManager.get()));
TestCCOcclusionTracker occluded;
// The tile size is 100x100.
@@ -962,7 +962,7 @@ TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusion)
TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndVisiblityConstraints)
{
- RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get()));
+ scoped_refptr<FakeTiledLayerChromium> layer = make_scoped_refptr(new FakeTiledLayerChromium(m_textureManager.get()));
TestCCOcclusionTracker occluded;
// The tile size is 100x100.
@@ -1020,7 +1020,7 @@ TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndVisiblityConstraints)
TEST_F(TiledLayerChromiumTest, tilesNotPaintedWithoutInvalidation)
{
- RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get()));
+ scoped_refptr<FakeTiledLayerChromium> layer = make_scoped_refptr(new FakeTiledLayerChromium(m_textureManager.get()));
TestCCOcclusionTracker occluded;
// The tile size is 100x100.
@@ -1058,7 +1058,7 @@ TEST_F(TiledLayerChromiumTest, tilesNotPaintedWithoutInvalidation)
TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndTransforms)
{
- RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get()));
+ scoped_refptr<FakeTiledLayerChromium> layer = make_scoped_refptr(new FakeTiledLayerChromium(m_textureManager.get()));
TestCCOcclusionTracker occluded;
// The tile size is 100x100.
@@ -1087,7 +1087,7 @@ TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndTransforms)
TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndScaling)
{
- RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get()));
+ scoped_refptr<FakeTiledLayerChromium> layer = make_scoped_refptr(new FakeTiledLayerChromium(m_textureManager.get()));
TestCCOcclusionTracker occluded;
// The tile size is 100x100.
@@ -1160,7 +1160,7 @@ TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndScaling)
TEST_F(TiledLayerChromiumTest, visibleContentOpaqueRegion)
{
- RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get()));
+ scoped_refptr<FakeTiledLayerChromium> layer = make_scoped_refptr(new FakeTiledLayerChromium(m_textureManager.get()));
TestCCOcclusionTracker occluded;
// The tile size is 100x100, so this invalidates and then paints two tiles in various ways.
@@ -1252,7 +1252,7 @@ TEST_F(TiledLayerChromiumTest, visibleContentOpaqueRegion)
TEST_F(TiledLayerChromiumTest, pixelsPaintedMetrics)
{
- RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get()));
+ scoped_refptr<FakeTiledLayerChromium> layer = make_scoped_refptr(new FakeTiledLayerChromium(m_textureManager.get()));
TestCCOcclusionTracker occluded;
// The tile size is 100x100, so this invalidates and then paints two tiles in various ways.
@@ -1314,10 +1314,10 @@ TEST_F(TiledLayerChromiumTest, dontAllocateContentsWhenTargetSurfaceCantBeAlloca
scoped_ptr<CCLayerTreeHost> ccLayerTreeHost = CCLayerTreeHost::create(&fakeCCLayerTreeHostClient, settings);
ASSERT_TRUE(ccLayerTreeHost->initializeRendererIfNeeded());
- RefPtr<FakeTiledLayerChromium> root = adoptRef(new FakeTiledLayerChromium(ccLayerTreeHost->contentsTextureManager()));
- RefPtr<LayerChromium> surface = LayerChromium::create();
- RefPtr<FakeTiledLayerChromium> child = adoptRef(new FakeTiledLayerChromium(ccLayerTreeHost->contentsTextureManager()));
- RefPtr<FakeTiledLayerChromium> child2 = adoptRef(new FakeTiledLayerChromium(ccLayerTreeHost->contentsTextureManager()));
+ scoped_refptr<FakeTiledLayerChromium> root = make_scoped_refptr(new FakeTiledLayerChromium(ccLayerTreeHost->contentsTextureManager()));
+ scoped_refptr<LayerChromium> surface = LayerChromium::create();
+ scoped_refptr<FakeTiledLayerChromium> child = make_scoped_refptr(new FakeTiledLayerChromium(ccLayerTreeHost->contentsTextureManager()));
+ scoped_refptr<FakeTiledLayerChromium> child2 = make_scoped_refptr(new FakeTiledLayerChromium(ccLayerTreeHost->contentsTextureManager()));
root->setBounds(rootRect.size());
root->setAnchorPoint(FloatPoint());
@@ -1481,11 +1481,12 @@ public:
m_trackingLayerPainter = trackingLayerPainter.get();
m_layerTextureUpdater = BitmapCanvasLayerTextureUpdater::create(trackingLayerPainter.release());
}
- virtual ~UpdateTrackingTiledLayerChromium() { }
TrackingLayerPainter* trackingLayerPainter() const { return m_trackingLayerPainter; }
protected:
+ virtual ~UpdateTrackingTiledLayerChromium() { }
+
virtual LayerTextureUpdater* textureUpdater() const OVERRIDE { return m_layerTextureUpdater.get(); }
private:
@@ -1495,7 +1496,7 @@ private:
TEST_F(TiledLayerChromiumTest, nonIntegerContentsScaleIsNotDistortedDuringPaint)
{
- RefPtr<UpdateTrackingTiledLayerChromium> layer = adoptRef(new UpdateTrackingTiledLayerChromium(m_textureManager.get()));
+ scoped_refptr<UpdateTrackingTiledLayerChromium> layer = make_scoped_refptr(new UpdateTrackingTiledLayerChromium(m_textureManager.get()));
IntRect layerRect(0, 0, 30, 31);
layer->setPosition(layerRect.location());
@@ -1526,7 +1527,7 @@ TEST_F(TiledLayerChromiumTest, nonIntegerContentsScaleIsNotDistortedDuringPaint)
TEST_F(TiledLayerChromiumTest, nonIntegerContentsScaleIsNotDistortedDuringInvalidation)
{
- RefPtr<UpdateTrackingTiledLayerChromium> layer = adoptRef(new UpdateTrackingTiledLayerChromium(m_textureManager.get()));
+ scoped_refptr<UpdateTrackingTiledLayerChromium> layer = make_scoped_refptr(new UpdateTrackingTiledLayerChromium(m_textureManager.get()));
IntRect layerRect(0, 0, 30, 31);
layer->setPosition(layerRect.location());
diff --git a/cc/TreeSynchronizer.cpp b/cc/TreeSynchronizer.cpp
index 9559cc2..e12d32d 100644
--- a/cc/TreeSynchronizer.cpp
+++ b/cc/TreeSynchronizer.cpp
@@ -11,7 +11,6 @@
#include "CCScrollbarLayerImpl.h"
#include "LayerChromium.h"
#include "ScrollbarLayerChromium.h"
-#include <wtf/RefPtr.h>
namespace cc {
@@ -66,7 +65,7 @@ PassOwnPtr<CCLayerImpl> TreeSynchronizer::synchronizeTreeRecursive(RawPtrCCLayer
OwnPtr<CCLayerImpl> ccLayerImpl = reuseOrCreateCCLayerImpl(newLayers, oldLayers, layer);
ccLayerImpl->clearChildList();
- const Vector<RefPtr<LayerChromium> >& children = layer->children();
+ const std::vector<scoped_refptr<LayerChromium> >& children = layer->children();
for (size_t i = 0; i < children.size(); ++i)
ccLayerImpl->addChild(synchronizeTreeRecursive(newLayers, oldLayers, children[i].get(), hostImpl));
@@ -90,7 +89,7 @@ void TreeSynchronizer::updateScrollbarLayerPointersRecursive(const RawPtrCCLayer
if (!layer)
return;
- const Vector<RefPtr<LayerChromium> >& children = layer->children();
+ const std::vector<scoped_refptr<LayerChromium> >& children = layer->children();
for (size_t i = 0; i < children.size(); ++i)
updateScrollbarLayerPointersRecursive(newLayers, children[i].get());
diff --git a/cc/TreeSynchronizerTest.cpp b/cc/TreeSynchronizerTest.cpp
index 42eb87b..e1c811b8 100644
--- a/cc/TreeSynchronizerTest.cpp
+++ b/cc/TreeSynchronizerTest.cpp
@@ -46,13 +46,11 @@ private:
class MockLayerChromium : public LayerChromium {
public:
- static PassRefPtr<MockLayerChromium> create(Vector<int>* ccLayerDestructionList)
+ static scoped_refptr<MockLayerChromium> create(Vector<int>* ccLayerDestructionList)
{
- return adoptRef(new MockLayerChromium(ccLayerDestructionList));
+ return make_scoped_refptr(new MockLayerChromium(ccLayerDestructionList));
}
- virtual ~MockLayerChromium() { }
-
virtual PassOwnPtr<CCLayerImpl> createCCLayerImpl() OVERRIDE
{
return MockCCLayerImpl::create(m_layerId);
@@ -65,12 +63,14 @@ public:
MockCCLayerImpl* mockCCLayer = static_cast<MockCCLayerImpl*>(ccLayer);
mockCCLayer->setCCLayerDestructionList(m_ccLayerDestructionList);
}
+
private:
MockLayerChromium(Vector<int>* ccLayerDestructionList)
: LayerChromium()
, m_ccLayerDestructionList(ccLayerDestructionList)
{
}
+ virtual ~MockLayerChromium() { }
Vector<int>* m_ccLayerDestructionList;
};
@@ -118,7 +118,7 @@ void expectTreesAreIdentical(LayerChromium* layer, CCLayerImpl* ccLayer, CCLayer
if (layer->replicaLayer())
expectTreesAreIdentical(layer->replicaLayer(), ccLayer->replicaLayer(), hostImpl);
- const Vector<RefPtr<LayerChromium> >& layerChildren = layer->children();
+ const std::vector<scoped_refptr<LayerChromium> >& layerChildren = layer->children();
const OwnPtrVector<CCLayerImpl>& ccLayerChildren = ccLayer->children();
ASSERT_EQ(layerChildren.size(), ccLayerChildren.size());
@@ -146,7 +146,7 @@ TEST(TreeSynchronizerTest, syncSimpleTreeFromEmpty)
CCLayerTreeSettings settings;
scoped_ptr<CCLayerTreeHostImpl> hostImpl = CCLayerTreeHostImpl::create(settings, 0);
- RefPtr<LayerChromium> layerTreeRoot = LayerChromium::create();
+ scoped_refptr<LayerChromium> layerTreeRoot = LayerChromium::create();
layerTreeRoot->addChild(LayerChromium::create());
layerTreeRoot->addChild(LayerChromium::create());
@@ -164,7 +164,7 @@ TEST(TreeSynchronizerTest, syncSimpleTreeReusingLayers)
CCLayerTreeSettings settings;
scoped_ptr<CCLayerTreeHostImpl> hostImpl = CCLayerTreeHostImpl::create(settings, 0);
- RefPtr<LayerChromium> layerTreeRoot = MockLayerChromium::create(&ccLayerDestructionList);
+ scoped_refptr<LayerChromium> layerTreeRoot = MockLayerChromium::create(&ccLayerDestructionList);
layerTreeRoot->addChild(MockLayerChromium::create(&ccLayerDestructionList));
layerTreeRoot->addChild(MockLayerChromium::create(&ccLayerDestructionList));
@@ -196,8 +196,8 @@ TEST(TreeSynchronizerTest, syncSimpleTreeAndTrackStackingOrderChange)
// Set up the tree and sync once. child2 needs to be synced here, too, even though we
// remove it to set up the intended scenario.
- RefPtr<LayerChromium> layerTreeRoot = MockLayerChromium::create(&ccLayerDestructionList);
- RefPtr<LayerChromium> child2 = MockLayerChromium::create(&ccLayerDestructionList);
+ scoped_refptr<LayerChromium> layerTreeRoot = MockLayerChromium::create(&ccLayerDestructionList);
+ scoped_refptr<LayerChromium> child2 = MockLayerChromium::create(&ccLayerDestructionList);
layerTreeRoot->addChild(MockLayerChromium::create(&ccLayerDestructionList));
layerTreeRoot->addChild(child2);
OwnPtr<CCLayerImpl> ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), nullptr, hostImpl.get());
@@ -223,7 +223,7 @@ TEST(TreeSynchronizerTest, syncSimpleTreeAndProperties)
CCLayerTreeSettings settings;
scoped_ptr<CCLayerTreeHostImpl> hostImpl = CCLayerTreeHostImpl::create(settings, 0);
- RefPtr<LayerChromium> layerTreeRoot = LayerChromium::create();
+ scoped_refptr<LayerChromium> layerTreeRoot = LayerChromium::create();
layerTreeRoot->addChild(LayerChromium::create());
layerTreeRoot->addChild(LayerChromium::create());
@@ -264,18 +264,18 @@ TEST(TreeSynchronizerTest, reuseCCLayersAfterStructuralChange)
// root --- A --- B ---+--- C
// |
// +--- D
- RefPtr<LayerChromium> layerTreeRoot = MockLayerChromium::create(&ccLayerDestructionList);
+ scoped_refptr<LayerChromium> layerTreeRoot = MockLayerChromium::create(&ccLayerDestructionList);
layerTreeRoot->addChild(MockLayerChromium::create(&ccLayerDestructionList));
- RefPtr<LayerChromium> layerA = layerTreeRoot->children()[0].get();
+ scoped_refptr<LayerChromium> layerA = layerTreeRoot->children()[0].get();
layerA->addChild(MockLayerChromium::create(&ccLayerDestructionList));
- RefPtr<LayerChromium> layerB = layerA->children()[0].get();
+ scoped_refptr<LayerChromium> layerB = layerA->children()[0].get();
layerB->addChild(MockLayerChromium::create(&ccLayerDestructionList));
- RefPtr<LayerChromium> layerC = layerB->children()[0].get();
+ scoped_refptr<LayerChromium> layerC = layerB->children()[0].get();
layerB->addChild(MockLayerChromium::create(&ccLayerDestructionList));
- RefPtr<LayerChromium> layerD = layerB->children()[1].get();
+ scoped_refptr<LayerChromium> layerD = layerB->children()[1].get();
OwnPtr<CCLayerImpl> ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), nullptr, hostImpl.get());
expectTreesAreIdentical(layerTreeRoot.get(), ccLayerTreeRoot.get(), hostImpl.get());
@@ -310,7 +310,7 @@ TEST(TreeSynchronizerTest, syncSimpleTreeThenDestroy)
CCLayerTreeSettings settings;
scoped_ptr<CCLayerTreeHostImpl> hostImpl = CCLayerTreeHostImpl::create(settings, 0);
- RefPtr<LayerChromium> oldLayerTreeRoot = MockLayerChromium::create(&ccLayerDestructionList);
+ scoped_refptr<LayerChromium> oldLayerTreeRoot = MockLayerChromium::create(&ccLayerDestructionList);
oldLayerTreeRoot->addChild(MockLayerChromium::create(&ccLayerDestructionList));
oldLayerTreeRoot->addChild(MockLayerChromium::create(&ccLayerDestructionList));
@@ -325,7 +325,7 @@ TEST(TreeSynchronizerTest, syncSimpleTreeThenDestroy)
oldLayerTreeRoot->removeAllChildren();
// Synchronize again. After the sync all CCLayerImpls from the old tree should be deleted.
- RefPtr<LayerChromium> newLayerTreeRoot = LayerChromium::create();
+ scoped_refptr<LayerChromium> newLayerTreeRoot = LayerChromium::create();
ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(newLayerTreeRoot.get(), ccLayerTreeRoot.release(), hostImpl.get());
expectTreesAreIdentical(newLayerTreeRoot.get(), ccLayerTreeRoot.get(), hostImpl.get());
@@ -343,22 +343,22 @@ TEST(TreeSynchronizerTest, syncMaskReplicaAndReplicaMaskLayers)
CCLayerTreeSettings settings;
scoped_ptr<CCLayerTreeHostImpl> hostImpl = CCLayerTreeHostImpl::create(settings, 0);
- RefPtr<LayerChromium> layerTreeRoot = LayerChromium::create();
+ scoped_refptr<LayerChromium> layerTreeRoot = LayerChromium::create();
layerTreeRoot->addChild(LayerChromium::create());
layerTreeRoot->addChild(LayerChromium::create());
layerTreeRoot->addChild(LayerChromium::create());
// First child gets a mask layer.
- RefPtr<LayerChromium> maskLayer = LayerChromium::create();
+ scoped_refptr<LayerChromium> maskLayer = LayerChromium::create();
layerTreeRoot->children()[0]->setMaskLayer(maskLayer.get());
// Second child gets a replica layer.
- RefPtr<LayerChromium> replicaLayer = LayerChromium::create();
+ scoped_refptr<LayerChromium> replicaLayer = LayerChromium::create();
layerTreeRoot->children()[1]->setReplicaLayer(replicaLayer.get());
// Third child gets a replica layer with a mask layer.
- RefPtr<LayerChromium> replicaLayerWithMask = LayerChromium::create();
- RefPtr<LayerChromium> replicaMaskLayer = LayerChromium::create();
+ scoped_refptr<LayerChromium> replicaLayerWithMask = LayerChromium::create();
+ scoped_refptr<LayerChromium> replicaMaskLayer = LayerChromium::create();
replicaLayerWithMask->setMaskLayer(replicaMaskLayer.get());
layerTreeRoot->children()[2]->setReplicaLayer(replicaLayerWithMask.get());
@@ -389,7 +389,7 @@ TEST(TreeSynchronizerTest, synchronizeAnimations)
CCLayerTreeSettings settings;
scoped_ptr<CCLayerTreeHostImpl> hostImpl = CCLayerTreeHostImpl::create(settings, 0);
- RefPtr<LayerChromium> layerTreeRoot = LayerChromium::create();
+ scoped_refptr<LayerChromium> layerTreeRoot = LayerChromium::create();
FakeLayerAnimationControllerClient dummy;
layerTreeRoot->setLayerAnimationController(FakeLayerAnimationController::create(&dummy));
diff --git a/cc/VideoLayerChromium.cpp b/cc/VideoLayerChromium.cpp
index ac0ba87..03ecbca 100644
--- a/cc/VideoLayerChromium.cpp
+++ b/cc/VideoLayerChromium.cpp
@@ -11,9 +11,9 @@
namespace cc {
-PassRefPtr<VideoLayerChromium> VideoLayerChromium::create(WebKit::WebVideoFrameProvider* provider)
+scoped_refptr<VideoLayerChromium> VideoLayerChromium::create(WebKit::WebVideoFrameProvider* provider)
{
- return adoptRef(new VideoLayerChromium(provider));
+ return make_scoped_refptr(new VideoLayerChromium(provider));
}
VideoLayerChromium::VideoLayerChromium(WebKit::WebVideoFrameProvider* provider)
diff --git a/cc/VideoLayerChromium.h b/cc/VideoLayerChromium.h
index 2712a29..0ecdd0f 100644
--- a/cc/VideoLayerChromium.h
+++ b/cc/VideoLayerChromium.h
@@ -21,14 +21,13 @@ class CCVideoLayerImpl;
// A Layer that contains a Video element.
class VideoLayerChromium : public LayerChromium {
public:
-
- static PassRefPtr<VideoLayerChromium> create(WebKit::WebVideoFrameProvider*);
- virtual ~VideoLayerChromium();
+ static scoped_refptr<VideoLayerChromium> create(WebKit::WebVideoFrameProvider*);
virtual PassOwnPtr<CCLayerImpl> createCCLayerImpl() OVERRIDE;
private:
explicit VideoLayerChromium(WebKit::WebVideoFrameProvider*);
+ virtual ~VideoLayerChromium();
// This pointer is only for passing to CCVideoLayerImpl's constructor. It should never be dereferenced by this class.
WebKit::WebVideoFrameProvider* m_provider;
diff --git a/cc/test/CCTiledLayerTestCommon.cpp b/cc/test/CCTiledLayerTestCommon.cpp
index 15d79aa..58ff0a5 100644
--- a/cc/test/CCTiledLayerTestCommon.cpp
+++ b/cc/test/CCTiledLayerTestCommon.cpp
@@ -49,7 +49,7 @@ void FakeLayerTextureUpdater::prepareToUpdate(const IntRect& contentRect, const
if (!m_rectToInvalidate.isEmpty()) {
m_layer->invalidateContentRect(m_rectToInvalidate);
m_rectToInvalidate = IntRect();
- m_layer = 0;
+ m_layer = NULL;
}
resultingOpaqueRect = m_opaquePaintRect;
}
@@ -95,6 +95,10 @@ FakeTiledLayerWithScaledBounds::FakeTiledLayerWithScaledBounds(CCPrioritizedText
{
}
+FakeTiledLayerWithScaledBounds::~FakeTiledLayerWithScaledBounds()
+{
+}
+
FakeTiledLayerChromium::~FakeTiledLayerChromium()
{
}
diff --git a/cc/test/CCTiledLayerTestCommon.h b/cc/test/CCTiledLayerTestCommon.h
index 99613c0..a3547ee 100644
--- a/cc/test/CCTiledLayerTestCommon.h
+++ b/cc/test/CCTiledLayerTestCommon.h
@@ -72,7 +72,7 @@ private:
cc::IntRect m_rectToInvalidate;
cc::IntRect m_lastUpdateRect;
cc::IntRect m_opaquePaintRect;
- RefPtr<FakeTiledLayerChromium> m_layer;
+ scoped_refptr<FakeTiledLayerChromium> m_layer;
};
class FakeCCTiledLayerImpl : public cc::CCTiledLayerImpl {
@@ -87,7 +87,6 @@ public:
class FakeTiledLayerChromium : public cc::TiledLayerChromium {
public:
explicit FakeTiledLayerChromium(cc::CCPrioritizedTextureManager*);
- virtual ~FakeTiledLayerChromium();
static cc::IntSize tileSize() { return cc::IntSize(100, 100); }
@@ -109,6 +108,7 @@ public:
protected:
virtual cc::LayerTextureUpdater* textureUpdater() const OVERRIDE;
virtual void createTextureUpdaterIfNeeded() OVERRIDE { }
+ virtual ~FakeTiledLayerChromium();
private:
RefPtr<FakeLayerTextureUpdater> m_fakeTextureUpdater;
@@ -124,6 +124,7 @@ public:
virtual cc::IntSize contentBounds() const OVERRIDE;
protected:
+ virtual ~FakeTiledLayerWithScaledBounds();
cc::IntSize m_forcedContentBounds;
};
diff --git a/webkit/compositor_bindings/WebExternalTextureLayerImpl.cpp b/webkit/compositor_bindings/WebExternalTextureLayerImpl.cpp
index b3cdadf..3ddc75f 100644
--- a/webkit/compositor_bindings/WebExternalTextureLayerImpl.cpp
+++ b/webkit/compositor_bindings/WebExternalTextureLayerImpl.cpp
@@ -25,13 +25,13 @@ WebExternalTextureLayer* WebExternalTextureLayer::create(WebExternalTextureLayer
WebExternalTextureLayerImpl::WebExternalTextureLayerImpl(WebExternalTextureLayerClient* client)
: m_client(client)
{
- RefPtr<TextureLayerChromium> layer;
+ scoped_refptr<TextureLayerChromium> layer;
if (m_client)
layer = TextureLayerChromium::create(this);
else
layer = TextureLayerChromium::create(0);
layer->setIsDrawable(true);
- m_layer = adoptPtr(new WebLayerImpl(layer.release()));
+ m_layer = adoptPtr(new WebLayerImpl(layer));
}
WebExternalTextureLayerImpl::~WebExternalTextureLayerImpl()
diff --git a/webkit/compositor_bindings/WebLayerImpl.cpp b/webkit/compositor_bindings/WebLayerImpl.cpp
index fc0c640..7a8e254 100644
--- a/webkit/compositor_bindings/WebLayerImpl.cpp
+++ b/webkit/compositor_bindings/WebLayerImpl.cpp
@@ -70,7 +70,7 @@ WebLayerImpl::WebLayerImpl()
{
}
-WebLayerImpl::WebLayerImpl(PassRefPtr<LayerChromium> layer)
+WebLayerImpl::WebLayerImpl(scoped_refptr<LayerChromium> layer)
: m_layer(layer)
{
}
diff --git a/webkit/compositor_bindings/WebLayerImpl.h b/webkit/compositor_bindings/WebLayerImpl.h
index 013d7a9..fd07e53 100644
--- a/webkit/compositor_bindings/WebLayerImpl.h
+++ b/webkit/compositor_bindings/WebLayerImpl.h
@@ -5,9 +5,8 @@
#ifndef WebLayerImpl_h
#define WebLayerImpl_h
+#include "base/memory/ref_counted.h"
#include <public/WebLayer.h>
-#include <wtf/PassRefPtr.h>
-#include <wtf/RefPtr.h>
namespace cc {
class LayerChromium;
@@ -18,7 +17,7 @@ namespace WebKit {
class WebLayerImpl : public WebLayer {
public:
WebLayerImpl();
- explicit WebLayerImpl(PassRefPtr<cc::LayerChromium>);
+ explicit WebLayerImpl(scoped_refptr<cc::LayerChromium>);
virtual ~WebLayerImpl();
// WebLayer implementation.
@@ -93,7 +92,7 @@ public:
cc::LayerChromium* layer() const;
protected:
- RefPtr<cc::LayerChromium> m_layer;
+ scoped_refptr<cc::LayerChromium> m_layer;
};
} // namespace WebKit
diff --git a/webkit/compositor_bindings/WebLayerTreeViewImpl.cpp b/webkit/compositor_bindings/WebLayerTreeViewImpl.cpp
index e74651b..c7b4d31 100644
--- a/webkit/compositor_bindings/WebLayerTreeViewImpl.cpp
+++ b/webkit/compositor_bindings/WebLayerTreeViewImpl.cpp
@@ -71,7 +71,7 @@ void WebLayerTreeViewImpl::setRootLayer(const WebLayer& root)
void WebLayerTreeViewImpl::clearRootLayer()
{
- m_layerTreeHost->setRootLayer(PassRefPtr<LayerChromium>());
+ m_layerTreeHost->setRootLayer(scoped_refptr<LayerChromium>());
}
void WebLayerTreeViewImpl::setViewportSize(const WebSize& layoutViewportSize, const WebSize& deviceViewportSize)