diff options
author | enne@chromium.org <enne@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-18 17:39:33 +0000 |
---|---|---|
committer | enne@chromium.org <enne@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-18 17:39:33 +0000 |
commit | 357b51741519bad4cf3afc7a1603b9bb46556fe7 (patch) | |
tree | 6037f10401c5946064e1f1518b6ffa46194eb2c0 /cc | |
parent | e986988c0c50e3479d316d1b24fcb7758f5d5ce5 (diff) | |
download | chromium_src-357b51741519bad4cf3afc7a1603b9bb46556fe7.zip chromium_src-357b51741519bad4cf3afc7a1603b9bb46556fe7.tar.gz chromium_src-357b51741519bad4cf3afc7a1603b9bb46556fe7.tar.bz2 |
cc: Remove wtf usage from test code
This incidentally cleans up time source and layer sorter.
R=jamesr@chromium.org
BUG=154451
Review URL: https://codereview.chromium.org/11188011
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@162731 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc')
40 files changed, 222 insertions, 233 deletions
diff --git a/cc/damage_tracker_unittest.cc b/cc/damage_tracker_unittest.cc index 1302539..6278003 100644 --- a/cc/damage_tracker_unittest.cc +++ b/cc/damage_tracker_unittest.cc @@ -18,7 +18,6 @@ using namespace cc; using namespace WebKit; -using namespace WTF; using namespace WebKitTests; namespace { diff --git a/cc/delay_based_time_source.cc b/cc/delay_based_time_source.cc index 56a2e04..d828379d 100644 --- a/cc/delay_based_time_source.cc +++ b/cc/delay_based_time_source.cc @@ -28,9 +28,9 @@ const double phaseChangeThreshold = 0.25; } // namespace -PassRefPtr<CCDelayBasedTimeSource> CCDelayBasedTimeSource::create(base::TimeDelta interval, CCThread* thread) +scoped_refptr<CCDelayBasedTimeSource> CCDelayBasedTimeSource::create(base::TimeDelta interval, CCThread* thread) { - return adoptRef(new CCDelayBasedTimeSource(interval, thread)); + return make_scoped_refptr(new CCDelayBasedTimeSource(interval, thread)); } CCDelayBasedTimeSource::CCDelayBasedTimeSource(base::TimeDelta interval, CCThread* thread) @@ -41,7 +41,6 @@ CCDelayBasedTimeSource::CCDelayBasedTimeSource(base::TimeDelta interval, CCThrea , m_state(STATE_INACTIVE) , m_timer(thread, this) { - turnOffVerifier(); } CCDelayBasedTimeSource::~CCDelayBasedTimeSource() diff --git a/cc/delay_based_time_source.h b/cc/delay_based_time_source.h index c82963d..8469ea1 100644 --- a/cc/delay_based_time_source.h +++ b/cc/delay_based_time_source.h @@ -7,7 +7,6 @@ #include "CCTimeSource.h" #include "CCTimer.h" -#include <wtf/PassRefPtr.h> namespace cc { @@ -17,9 +16,7 @@ class CCThread; // in face of millisecond-precision delayed callbacks and random queueing delays. class CCDelayBasedTimeSource : public CCTimeSource, CCTimerClient { public: - static PassRefPtr<CCDelayBasedTimeSource> create(base::TimeDelta interval, CCThread*); - - virtual ~CCDelayBasedTimeSource(); + static scoped_refptr<CCDelayBasedTimeSource> create(base::TimeDelta interval, CCThread*); virtual void setClient(CCTimeSourceClient* client) OVERRIDE; @@ -42,6 +39,8 @@ public: protected: CCDelayBasedTimeSource(base::TimeDelta interval, CCThread*); + virtual ~CCDelayBasedTimeSource(); + base::TimeTicks nextTickTarget(base::TimeTicks now); void postNextTickTask(base::TimeTicks now); diff --git a/cc/delay_based_time_source_unittest.cc b/cc/delay_based_time_source_unittest.cc index d03df23..f8976ae 100644 --- a/cc/delay_based_time_source_unittest.cc +++ b/cc/delay_based_time_source_unittest.cc @@ -9,10 +9,8 @@ #include "CCThread.h" #include "cc/test/scheduler_test_common.h" #include "testing/gtest/include/gtest/gtest.h" -#include <wtf/RefPtr.h> using namespace cc; -using namespace WTF; using namespace WebKitTests; namespace { @@ -26,7 +24,7 @@ TEST(CCDelayBasedTimeSourceTest, TaskPostedAndTickCalled) { FakeCCThread thread; FakeCCTimeSourceClient client; - RefPtr<FakeCCDelayBasedTimeSource> timer = FakeCCDelayBasedTimeSource::create(interval(), &thread); + scoped_refptr<FakeCCDelayBasedTimeSource> timer = FakeCCDelayBasedTimeSource::create(interval(), &thread); timer->setClient(&client); timer->setActive(true); @@ -43,7 +41,7 @@ TEST(CCDelayBasedTimeSource, TickNotCalledWithTaskPosted) { FakeCCThread thread; FakeCCTimeSourceClient client; - RefPtr<FakeCCDelayBasedTimeSource> timer = FakeCCDelayBasedTimeSource::create(interval(), &thread); + scoped_refptr<FakeCCDelayBasedTimeSource> timer = FakeCCDelayBasedTimeSource::create(interval(), &thread); timer->setClient(&client); timer->setActive(true); EXPECT_TRUE(thread.hasPendingTask()); @@ -56,7 +54,7 @@ TEST(CCDelayBasedTimeSource, StartTwiceEnqueuesOneTask) { FakeCCThread thread; FakeCCTimeSourceClient client; - RefPtr<FakeCCDelayBasedTimeSource> timer = FakeCCDelayBasedTimeSource::create(interval(), &thread); + scoped_refptr<FakeCCDelayBasedTimeSource> timer = FakeCCDelayBasedTimeSource::create(interval(), &thread); timer->setClient(&client); timer->setActive(true); EXPECT_TRUE(thread.hasPendingTask()); @@ -69,7 +67,7 @@ TEST(CCDelayBasedTimeSource, StartWhenRunningDoesntTick) { FakeCCThread thread; FakeCCTimeSourceClient client; - RefPtr<FakeCCDelayBasedTimeSource> timer = FakeCCDelayBasedTimeSource::create(interval(), &thread); + scoped_refptr<FakeCCDelayBasedTimeSource> timer = FakeCCDelayBasedTimeSource::create(interval(), &thread); timer->setClient(&client); timer->setActive(true); thread.runPendingTask(); @@ -84,7 +82,7 @@ TEST(CCDelayBasedTimeSource, NextDelaySaneWhenExactlyOnRequestedTime) { FakeCCThread thread; FakeCCTimeSourceClient client; - RefPtr<FakeCCDelayBasedTimeSource> timer = FakeCCDelayBasedTimeSource::create(interval(), &thread); + scoped_refptr<FakeCCDelayBasedTimeSource> timer = FakeCCDelayBasedTimeSource::create(interval(), &thread); timer->setClient(&client); timer->setActive(true); // Run the first task, as that activates the timer and picks up a timebase. @@ -104,7 +102,7 @@ TEST(CCDelayBasedTimeSource, NextDelaySaneWhenSlightlyAfterRequestedTime) { FakeCCThread thread; FakeCCTimeSourceClient client; - RefPtr<FakeCCDelayBasedTimeSource> timer = FakeCCDelayBasedTimeSource::create(interval(), &thread); + scoped_refptr<FakeCCDelayBasedTimeSource> timer = FakeCCDelayBasedTimeSource::create(interval(), &thread); timer->setClient(&client); timer->setActive(true); // Run the first task, as that activates the timer and picks up a timebase. @@ -124,7 +122,7 @@ TEST(CCDelayBasedTimeSource, NextDelaySaneWhenExactlyTwiceAfterRequestedTime) { FakeCCThread thread; FakeCCTimeSourceClient client; - RefPtr<FakeCCDelayBasedTimeSource> timer = FakeCCDelayBasedTimeSource::create(interval(), &thread); + scoped_refptr<FakeCCDelayBasedTimeSource> timer = FakeCCDelayBasedTimeSource::create(interval(), &thread); timer->setClient(&client); timer->setActive(true); // Run the first task, as that activates the timer and picks up a timebase. @@ -144,7 +142,7 @@ TEST(CCDelayBasedTimeSource, NextDelaySaneWhenSlightlyAfterTwiceRequestedTime) { FakeCCThread thread; FakeCCTimeSourceClient client; - RefPtr<FakeCCDelayBasedTimeSource> timer = FakeCCDelayBasedTimeSource::create(interval(), &thread); + scoped_refptr<FakeCCDelayBasedTimeSource> timer = FakeCCDelayBasedTimeSource::create(interval(), &thread); timer->setClient(&client); timer->setActive(true); // Run the first task, as that activates the timer and picks up a timebase. @@ -164,7 +162,7 @@ TEST(CCDelayBasedTimeSource, NextDelaySaneWhenHalfAfterRequestedTime) { FakeCCThread thread; FakeCCTimeSourceClient client; - RefPtr<FakeCCDelayBasedTimeSource> timer = FakeCCDelayBasedTimeSource::create(interval(), &thread); + scoped_refptr<FakeCCDelayBasedTimeSource> timer = FakeCCDelayBasedTimeSource::create(interval(), &thread); timer->setClient(&client); timer->setActive(true); // Run the first task, as that activates the timer and picks up a timebase. @@ -184,7 +182,7 @@ TEST(CCDelayBasedTimeSource, SaneHandlingOfJitteryTimebase) { FakeCCThread thread; FakeCCTimeSourceClient client; - RefPtr<FakeCCDelayBasedTimeSource> timer = FakeCCDelayBasedTimeSource::create(interval(), &thread); + scoped_refptr<FakeCCDelayBasedTimeSource> timer = FakeCCDelayBasedTimeSource::create(interval(), &thread); timer->setClient(&client); timer->setActive(true); // Run the first task, as that activates the timer and picks up a timebase. @@ -212,7 +210,7 @@ TEST(CCDelayBasedTimeSource, HandlesSignificantTimebaseChangesImmediately) { FakeCCThread thread; FakeCCTimeSourceClient client; - RefPtr<FakeCCDelayBasedTimeSource> timer = FakeCCDelayBasedTimeSource::create(interval(), &thread); + scoped_refptr<FakeCCDelayBasedTimeSource> timer = FakeCCDelayBasedTimeSource::create(interval(), &thread); timer->setClient(&client); timer->setActive(true); // Run the first task, as that activates the timer and picks up a timebase. @@ -254,7 +252,7 @@ TEST(CCDelayBasedTimeSource, HanldlesSignificantIntervalChangesImmediately) { FakeCCThread thread; FakeCCTimeSourceClient client; - RefPtr<FakeCCDelayBasedTimeSource> timer = FakeCCDelayBasedTimeSource::create(interval(), &thread); + scoped_refptr<FakeCCDelayBasedTimeSource> timer = FakeCCDelayBasedTimeSource::create(interval(), &thread); timer->setClient(&client); timer->setActive(true); // Run the first task, as that activates the timer and picks up a timebase. @@ -297,7 +295,7 @@ TEST(CCDelayBasedTimeSourceTest, AchievesTargetRateWithNoNoise) FakeCCThread thread; FakeCCTimeSourceClient client; - RefPtr<FakeCCDelayBasedTimeSource> timer = FakeCCDelayBasedTimeSource::create(interval(), &thread); + scoped_refptr<FakeCCDelayBasedTimeSource> timer = FakeCCDelayBasedTimeSource::create(interval(), &thread); timer->setClient(&client); timer->setActive(true); @@ -320,11 +318,11 @@ TEST(CCDelayBasedTimeSource, TestDeactivateWhilePending) { FakeCCThread thread; FakeCCTimeSourceClient client; - RefPtr<FakeCCDelayBasedTimeSource> timer = FakeCCDelayBasedTimeSource::create(interval(), &thread); + scoped_refptr<FakeCCDelayBasedTimeSource> timer = FakeCCDelayBasedTimeSource::create(interval(), &thread); timer->setClient(&client); timer->setActive(true); // Should post a task. timer->setActive(false); - timer.clear(); + timer = NULL; thread.runPendingTask(); // Should run the posted task without crashing. } @@ -332,7 +330,7 @@ TEST(CCDelayBasedTimeSource, TestDeactivateAndReactivateBeforeNextTickTime) { FakeCCThread thread; FakeCCTimeSourceClient client; - RefPtr<FakeCCDelayBasedTimeSource> timer = FakeCCDelayBasedTimeSource::create(interval(), &thread); + scoped_refptr<FakeCCDelayBasedTimeSource> timer = FakeCCDelayBasedTimeSource::create(interval(), &thread); timer->setClient(&client); // Should run the activate task, and pick up a new timebase. @@ -356,7 +354,7 @@ TEST(CCDelayBasedTimeSource, TestDeactivateAndReactivateAfterNextTickTime) { FakeCCThread thread; FakeCCTimeSourceClient client; - RefPtr<FakeCCDelayBasedTimeSource> timer = FakeCCDelayBasedTimeSource::create(interval(), &thread); + scoped_refptr<FakeCCDelayBasedTimeSource> timer = FakeCCDelayBasedTimeSource::create(interval(), &thread); timer->setClient(&client); // Should run the activate task, and pick up a new timebase. diff --git a/cc/delegated_renderer_layer_impl.h b/cc/delegated_renderer_layer_impl.h index 4ed842e..5487d02 100644 --- a/cc/delegated_renderer_layer_impl.h +++ b/cc/delegated_renderer_layer_impl.h @@ -37,8 +37,6 @@ private: void appendRenderPassQuads(CCQuadSink&, CCAppendQuadsData&, CCRenderPass* fromDelegatedRenderPass) const; - PassOwnPtr<CCDrawQuad> createCopyOfQuad(const CCDrawQuad*); - virtual const char* layerTypeAsString() const OVERRIDE; ScopedPtrVector<CCRenderPass> m_renderPassesInDrawOrder; diff --git a/cc/delegated_renderer_layer_impl_unittest.cc b/cc/delegated_renderer_layer_impl_unittest.cc index 4073d48c..1fc22bf 100644 --- a/cc/delegated_renderer_layer_impl_unittest.cc +++ b/cc/delegated_renderer_layer_impl_unittest.cc @@ -56,7 +56,7 @@ public: protected: scoped_ptr<CCGraphicsContext> createContext() { - return FakeWebCompositorOutputSurface::create(adoptPtr(new FakeWebGraphicsContext3D)).PassAs<CCGraphicsContext>(); + return FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new FakeWebGraphicsContext3D)).PassAs<CCGraphicsContext>(); } DebugScopedSetImplThread m_alwaysImplThread; diff --git a/cc/frame_rate_controller.cc b/cc/frame_rate_controller.cc index 8d4ff8e..fb29e2e 100644 --- a/cc/frame_rate_controller.cc +++ b/cc/frame_rate_controller.cc @@ -39,7 +39,7 @@ private: CCFrameRateController* m_frameRateController; }; -CCFrameRateController::CCFrameRateController(PassRefPtr<CCTimeSource> timer) +CCFrameRateController::CCFrameRateController(scoped_refptr<CCTimeSource> timer) : m_client(0) , m_numFramesPending(0) , m_maxFramesPending(defaultMaxFramesPending) diff --git a/cc/frame_rate_controller.h b/cc/frame_rate_controller.h index 2aeeae1..2352482 100644 --- a/cc/frame_rate_controller.h +++ b/cc/frame_rate_controller.h @@ -5,11 +5,10 @@ #ifndef CCFrameRateController_h #define CCFrameRateController_h +#include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" #include "base/time.h" #include "CCTimer.h" -#include <wtf/PassRefPtr.h> -#include <wtf/RefPtr.h> namespace cc { @@ -29,7 +28,7 @@ class CCFrameRateControllerTimeSourceAdapter; class CCFrameRateController : public CCTimerClient { public: - explicit CCFrameRateController(PassRefPtr<CCTimeSource>); + explicit CCFrameRateController(scoped_refptr<CCTimeSource>); // Alternate form of CCFrameRateController with unthrottled frame-rate. explicit CCFrameRateController(CCThread*); virtual ~CCFrameRateController(); @@ -67,7 +66,7 @@ protected: CCFrameRateControllerClient* m_client; int m_numFramesPending; int m_maxFramesPending; - RefPtr<CCTimeSource> m_timeSource; + scoped_refptr<CCTimeSource> m_timeSource; scoped_ptr<CCFrameRateControllerTimeSourceAdapter> m_timeSourceClientAdapter; bool m_active; bool m_swapBuffersCompleteSupported; diff --git a/cc/frame_rate_controller_unittest.cc b/cc/frame_rate_controller_unittest.cc index 888b343..b0a6bd1 100644 --- a/cc/frame_rate_controller_unittest.cc +++ b/cc/frame_rate_controller_unittest.cc @@ -11,7 +11,6 @@ using namespace cc; using namespace WebKitTests; -using namespace WTF; namespace { @@ -34,7 +33,7 @@ TEST(CCFrameRateControllerTest, TestFrameThrottling_ImmediateAck) FakeCCThread thread; FakeCCFrameRateControllerClient client; base::TimeDelta interval = base::TimeDelta::FromMicroseconds(base::Time::kMicrosecondsPerSecond / 60); - RefPtr<FakeCCDelayBasedTimeSource> timeSource = FakeCCDelayBasedTimeSource::create(interval, &thread); + scoped_refptr<FakeCCDelayBasedTimeSource> timeSource = FakeCCDelayBasedTimeSource::create(interval, &thread); CCFrameRateController controller(timeSource); controller.setClient(&client); @@ -69,7 +68,7 @@ TEST(CCFrameRateControllerTest, TestFrameThrottling_TwoFramesInFlight) FakeCCThread thread; FakeCCFrameRateControllerClient client; base::TimeDelta interval = base::TimeDelta::FromMicroseconds(base::Time::kMicrosecondsPerSecond / 60); - RefPtr<FakeCCDelayBasedTimeSource> timeSource = FakeCCDelayBasedTimeSource::create(interval, &thread); + scoped_refptr<FakeCCDelayBasedTimeSource> timeSource = FakeCCDelayBasedTimeSource::create(interval, &thread); CCFrameRateController controller(timeSource); controller.setClient(&client); diff --git a/cc/gl_renderer_unittest.cc b/cc/gl_renderer_unittest.cc index 0802f36..3a7c534 100644 --- a/cc/gl_renderer_unittest.cc +++ b/cc/gl_renderer_unittest.cc @@ -111,7 +111,7 @@ protected: : m_suggestHaveBackbufferYes(1, true) , m_suggestHaveBackbufferNo(1, false) , m_compositorInitializer(0) - , m_context(FakeWebCompositorOutputSurface::create(adoptPtr(new FrameCountingMemoryAllocationSettingContext()))) + , m_context(FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new FrameCountingMemoryAllocationSettingContext()))) , m_resourceProvider(CCResourceProvider::create(m_context.get())) , m_renderer(&m_mockClient, m_resourceProvider.get()) { @@ -296,7 +296,7 @@ TEST(CCRendererGLTest2, initializationDoesNotMakeSynchronousCalls) { CCScopedSettings scopedSettings; FakeCCRendererClient mockClient; - scoped_ptr<CCGraphicsContext> context(FakeWebCompositorOutputSurface::create(adoptPtr(new ForbidSynchronousCallContext))); + scoped_ptr<CCGraphicsContext> context(FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new ForbidSynchronousCallContext))); scoped_ptr<CCResourceProvider> resourceProvider(CCResourceProvider::create(context.get())); FakeCCRendererGL renderer(&mockClient, resourceProvider.get()); @@ -340,7 +340,7 @@ TEST(CCRendererGLTest2, initializationWithQuicklyLostContextDoesNotAssert) { CCScopedSettings scopedSettings; FakeCCRendererClient mockClient; - scoped_ptr<CCGraphicsContext> context(FakeWebCompositorOutputSurface::create(adoptPtr(new LoseContextOnFirstGetContext))); + scoped_ptr<CCGraphicsContext> context(FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new LoseContextOnFirstGetContext))); scoped_ptr<CCResourceProvider> resourceProvider(CCResourceProvider::create(context.get())); FakeCCRendererGL renderer(&mockClient, resourceProvider.get()); @@ -362,7 +362,7 @@ public: TEST(CCRendererGLTest2, initializationWithoutGpuMemoryManagerExtensionSupportShouldDefaultToNonZeroAllocation) { FakeCCRendererClient mockClient; - scoped_ptr<CCGraphicsContext> context(FakeWebCompositorOutputSurface::create(adoptPtr(new ContextThatDoesNotSupportMemoryManagmentExtensions))); + scoped_ptr<CCGraphicsContext> context(FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new ContextThatDoesNotSupportMemoryManagmentExtensions))); scoped_ptr<CCResourceProvider> resourceProvider(CCResourceProvider::create(context.get())); FakeCCRendererGL renderer(&mockClient, resourceProvider.get()); @@ -389,7 +389,7 @@ private: TEST(CCRendererGLTest2, opaqueBackground) { FakeCCRendererClient mockClient; - scoped_ptr<CCGraphicsContext> ccContext(FakeWebCompositorOutputSurface::create(adoptPtr(new ClearCountingContext))); + scoped_ptr<CCGraphicsContext> ccContext(FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new ClearCountingContext))); ClearCountingContext* context = static_cast<ClearCountingContext*>(ccContext->context3D()); scoped_ptr<CCResourceProvider> resourceProvider(CCResourceProvider::create(ccContext.get())); FakeCCRendererGL renderer(&mockClient, resourceProvider.get()); @@ -412,7 +412,7 @@ TEST(CCRendererGLTest2, opaqueBackground) TEST(CCRendererGLTest2, transparentBackground) { FakeCCRendererClient mockClient; - scoped_ptr<CCGraphicsContext> ccContext(FakeWebCompositorOutputSurface::create(adoptPtr(new ClearCountingContext))); + scoped_ptr<CCGraphicsContext> ccContext(FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new ClearCountingContext))); ClearCountingContext* context = static_cast<ClearCountingContext*>(ccContext->context3D()); scoped_ptr<CCResourceProvider> resourceProvider(CCResourceProvider::create(ccContext.get())); FakeCCRendererGL renderer(&mockClient, resourceProvider.get()); diff --git a/cc/input_handler.h b/cc/input_handler.h index 7188cab..7767134 100644 --- a/cc/input_handler.h +++ b/cc/input_handler.h @@ -6,7 +6,6 @@ #define CCInputHandler_h #include "base/basictypes.h" -#include <wtf/PassOwnPtr.h> namespace cc { diff --git a/cc/layer_sorter.cc b/cc/layer_sorter.cc index a02f2115..0344e80 100644 --- a/cc/layer_sorter.cc +++ b/cc/layer_sorter.cc @@ -53,13 +53,13 @@ static bool edgeEdgeTest(const FloatPoint& a, const FloatPoint& b, const FloatPo return true; } -CCLayerSorter::GraphNode::GraphNode(CCLayerImpl* cclayer) +GraphNode::GraphNode(CCLayerImpl* cclayer) : layer(cclayer) , incomingEdgeWeight(0) { } -CCLayerSorter::GraphNode::~GraphNode() +GraphNode::~GraphNode() { } @@ -142,11 +142,11 @@ CCLayerSorter::ABCompareResult CCLayerSorter::checkOverlap(LayerShape* a, LayerS return BBeforeA; } -CCLayerSorter::LayerShape::LayerShape() +LayerShape::LayerShape() { } -CCLayerSorter::LayerShape::LayerShape(float width, float height, const WebTransformationMatrix& drawTransform) +LayerShape::LayerShape(float width, float height, const WebTransformationMatrix& drawTransform) { FloatQuad layerQuad(FloatRect(0, 0, width, height)); @@ -193,7 +193,7 @@ CCLayerSorter::LayerShape::LayerShape(float width, float height, const WebTransf // to point p which lies on the z = 0 plane. It does it by computing the // intersection of a line starting from p along the Z axis and the plane // of the layer. -float CCLayerSorter::LayerShape::layerZFromProjectedPoint(const FloatPoint& p) const +float LayerShape::layerZFromProjectedPoint(const FloatPoint& p) const { const FloatPoint3D zAxis(0, 0, 1); FloatPoint3D w = FloatPoint3D(p) - transformOrigin; @@ -218,7 +218,7 @@ void CCLayerSorter::createGraphNodes(LayerList::iterator first, LayerList::itera float minZ = FLT_MAX; float maxZ = -FLT_MAX; for (LayerList::const_iterator it = first; it < last; it++) { - m_nodes.append(GraphNode(*it)); + m_nodes.push_back(GraphNode(*it)); GraphNode& node = m_nodes.at(m_nodes.size() - 1); CCRenderSurface* renderSurface = node.layer->renderSurface(); if (!node.layer->drawsContent() && !renderSurface) @@ -277,35 +277,27 @@ void CCLayerSorter::createGraphEdges() if (startNode) { DVLOG(2) << startNode->layer->id() << " -> " << endNode->layer->id(); - m_edges.append(GraphEdge(startNode, endNode, weight)); + m_edges.push_back(GraphEdge(startNode, endNode, weight)); } } } for (unsigned i = 0; i < m_edges.size(); i++) { GraphEdge& edge = m_edges[i]; - m_activeEdges.add(&edge, &edge); - edge.from->outgoing.append(&edge); - edge.to->incoming.append(&edge); + m_activeEdges[&edge] = &edge; + edge.from->outgoing.push_back(&edge); + edge.to->incoming.push_back(&edge); edge.to->incomingEdgeWeight += edge.weight; } } // Finds and removes an edge from the list by doing a swap with the // last element of the list. -void CCLayerSorter::removeEdgeFromList(GraphEdge* edge, Vector<GraphEdge*>& list) +void CCLayerSorter::removeEdgeFromList(GraphEdge* edge, std::vector<GraphEdge*>& list) { - size_t edgeIndex = list.find(edge); - ASSERT(edgeIndex != notFound); - if (list.size() == 1) { - ASSERT(!edgeIndex); - list.clear(); - return; - } - if (edgeIndex != list.size() - 1) - list[edgeIndex] = list[list.size() - 1]; - - list.removeLast(); + std::vector<GraphEdge*>::iterator iter = std::find(list.begin(), list.end(), edge); + ASSERT(iter != list.end()); + list.erase(iter); } // Sorts the given list of layers such that they can be painted in a back-to-front @@ -340,7 +332,7 @@ void CCLayerSorter::sort(LayerList::iterator first, LayerList::iterator last) // Find all the nodes that don't have incoming edges. for (NodeList::iterator la = m_nodes.begin(); la < m_nodes.end(); la++) { if (!la->incoming.size()) - noIncomingEdgeNodeList.push_back(la); + noIncomingEdgeNodeList.push_back(&(*la)); } DVLOG(2) << "Sorted list: "; @@ -363,7 +355,7 @@ void CCLayerSorter::sort(LayerList::iterator first, LayerList::iterator last) for (unsigned i = 0; i < fromNode->outgoing.size(); i++) { GraphEdge* outgoingEdge = fromNode->outgoing[i]; - m_activeEdges.remove(outgoingEdge); + m_activeEdges.erase(outgoingEdge); removeEdgeFromList(outgoingEdge, outgoingEdge->to->incoming); outgoingEdge->to->incomingEdgeWeight -= outgoingEdge->weight; @@ -394,7 +386,7 @@ void CCLayerSorter::sort(LayerList::iterator first, LayerList::iterator last) for (unsigned e = 0; e < nextNode->incoming.size(); e++) { GraphEdge* incomingEdge = nextNode->incoming[e]; - m_activeEdges.remove(incomingEdge); + m_activeEdges.erase(incomingEdge); removeEdgeFromList(incomingEdge, incomingEdge->from->outgoing); } nextNode->incoming.clear(); diff --git a/cc/layer_sorter.h b/cc/layer_sorter.h index d4ca664..587df1e 100644 --- a/cc/layer_sorter.h +++ b/cc/layer_sorter.h @@ -6,13 +6,27 @@ #define CCLayerSorter_h #include "base/basictypes.h" +#include "base/hash_tables.h" #include "CCLayerImpl.h" #include "FloatPoint3D.h" #include "FloatQuad.h" #include "FloatRect.h" -#include <vector> -#include <wtf/HashMap.h> -#include <wtf/Vector.h> + +#if defined(COMPILER_GCC) +namespace cc +{ + struct GraphEdge; +}; + +namespace BASE_HASH_NAMESPACE { +template<> +struct hash<cc::GraphEdge*> { + size_t operator()(cc::GraphEdge* ptr) const { + return hash<size_t>()(reinterpret_cast<size_t>(ptr)); + } +}; +} // namespace BASE_HASH_NAMESPACE +#endif // COMPILER namespace WebKit { class WebTransformationMatrix; @@ -20,6 +34,47 @@ class WebTransformationMatrix; namespace cc { +struct GraphEdge; + +// Holds various useful properties derived from a layer's 3D outline. +struct LayerShape { + LayerShape(); + LayerShape(float width, float height, const WebKit::WebTransformationMatrix& drawTransform); + + float layerZFromProjectedPoint(const FloatPoint&) const; + + FloatPoint3D layerNormal; + FloatPoint3D transformOrigin; + FloatQuad projectedQuad; + FloatRect projectedBounds; +}; + +struct GraphNode { + explicit GraphNode(CCLayerImpl* cclayer); + ~GraphNode(); + + CCLayerImpl* layer; + LayerShape shape; + std::vector<GraphEdge*> incoming; + std::vector<GraphEdge*> outgoing; + float incomingEdgeWeight; +}; + +struct GraphEdge { + GraphEdge(GraphNode* fromNode, GraphNode* toNode, float weight) + : from(fromNode) + , to(toNode) + , weight(weight) + { + } + + GraphNode* from; + GraphNode* to; + float weight; +}; + + + class CCLayerSorter { public: CCLayerSorter(); @@ -29,19 +84,6 @@ public: void sort(LayerList::iterator first, LayerList::iterator last); - // Holds various useful properties derived from a layer's 3D outline. - struct LayerShape { - LayerShape(); - LayerShape(float width, float height, const WebKit::WebTransformationMatrix& drawTransform); - - float layerZFromProjectedPoint(const FloatPoint&) const; - - FloatPoint3D layerNormal; - FloatPoint3D transformOrigin; - FloatQuad projectedQuad; - FloatRect projectedBounds; - }; - enum ABCompareResult { ABeforeB, BBeforeA, @@ -51,39 +93,18 @@ public: static ABCompareResult checkOverlap(LayerShape*, LayerShape*, float zThreshold, float& weight); private: - struct GraphEdge; - - struct GraphNode { - explicit GraphNode(CCLayerImpl* cclayer); - ~GraphNode(); - - CCLayerImpl* layer; - LayerShape shape; - Vector<GraphEdge*> incoming; - Vector<GraphEdge*> outgoing; - float incomingEdgeWeight; - }; - - struct GraphEdge { - GraphEdge(GraphNode* fromNode, GraphNode* toNode, float weight) : from(fromNode), to(toNode), weight(weight) { }; - - GraphNode* from; - GraphNode* to; - float weight; - }; - - typedef Vector<GraphNode> NodeList; - typedef Vector<GraphEdge> EdgeList; + typedef std::vector<GraphNode> NodeList; + typedef std::vector<GraphEdge> EdgeList; NodeList m_nodes; EdgeList m_edges; float m_zRange; - typedef HashMap<GraphEdge*, GraphEdge*> EdgeMap; + typedef base::hash_map<GraphEdge*, GraphEdge*> EdgeMap; EdgeMap m_activeEdges; void createGraphNodes(LayerList::iterator first, LayerList::iterator last); void createGraphEdges(); - void removeEdgeFromList(GraphEdge*, Vector<GraphEdge*>&); + void removeEdgeFromList(GraphEdge*, std::vector<GraphEdge*>&); DISALLOW_COPY_AND_ASSIGN(CCLayerSorter); }; diff --git a/cc/layer_sorter_unittest.cc b/cc/layer_sorter_unittest.cc index e2bb912..40729d1 100644 --- a/cc/layer_sorter_unittest.cc +++ b/cc/layer_sorter_unittest.cc @@ -30,11 +30,11 @@ TEST(CCLayerSorterTest, BasicOverlap) // Trivial test, with one layer directly obscuring the other. WebTransformationMatrix neg4Translate; neg4Translate.translate3d(0, 0, -4); - CCLayerSorter::LayerShape front(2, 2, neg4Translate); + LayerShape front(2, 2, neg4Translate); WebTransformationMatrix neg5Translate; neg5Translate.translate3d(0, 0, -5); - CCLayerSorter::LayerShape back(2, 2, neg5Translate); + LayerShape back(2, 2, neg5Translate); overlapResult = CCLayerSorter::checkOverlap(&front, &back, zThreshold, weight); EXPECT_EQ(CCLayerSorter::BBeforeA, overlapResult); @@ -47,7 +47,7 @@ TEST(CCLayerSorterTest, BasicOverlap) // One layer translated off to the right. No overlap should be detected. WebTransformationMatrix rightTranslate; rightTranslate.translate3d(10, 0, -5); - CCLayerSorter::LayerShape backRight(2, 2, rightTranslate); + LayerShape backRight(2, 2, rightTranslate); overlapResult = CCLayerSorter::checkOverlap(&front, &backRight, zThreshold, weight); EXPECT_EQ(CCLayerSorter::None, overlapResult); @@ -70,11 +70,11 @@ TEST(CCLayerSorterTest, RightAngleOverlap) leftFaceMatrix.rotate3d(0, 1, 0, -90); leftFaceMatrix.translateRight3d(-1, 0, -5); leftFaceMatrix.translate(-1, -1); - CCLayerSorter::LayerShape leftFace(2, 2, perspectiveMatrix * leftFaceMatrix); + LayerShape leftFace(2, 2, perspectiveMatrix * leftFaceMatrix); WebTransformationMatrix frontFaceMatrix; frontFaceMatrix.translate3d(0, 0, -4); frontFaceMatrix.translate(-1, -1); - CCLayerSorter::LayerShape frontFace(2, 2, perspectiveMatrix * frontFaceMatrix); + LayerShape frontFace(2, 2, perspectiveMatrix * frontFaceMatrix); overlapResult = CCLayerSorter::checkOverlap(&frontFace, &leftFace, zThreshold, weight); EXPECT_EQ(CCLayerSorter::BBeforeA, overlapResult); @@ -94,13 +94,13 @@ TEST(CCLayerSorterTest, IntersectingLayerOverlap) WebTransformationMatrix frontFaceMatrix; frontFaceMatrix.translate3d(0, 0, -4); frontFaceMatrix.translate(-1, -1); - CCLayerSorter::LayerShape frontFace(2, 2, perspectiveMatrix * frontFaceMatrix); + LayerShape frontFace(2, 2, perspectiveMatrix * frontFaceMatrix); WebTransformationMatrix throughMatrix; throughMatrix.rotate3d(0, 1, 0, 45); throughMatrix.translateRight3d(0, 0, -4); throughMatrix.translate(-1, -1); - CCLayerSorter::LayerShape rotatedFace(2, 2, perspectiveMatrix * throughMatrix); + LayerShape rotatedFace(2, 2, perspectiveMatrix * throughMatrix); overlapResult = CCLayerSorter::checkOverlap(&frontFace, &rotatedFace, zThreshold, weight); EXPECT_NE(CCLayerSorter::None, overlapResult); EXPECT_EQ(0, weight); @@ -127,17 +127,17 @@ TEST(CCLayerSorterTest, LayersAtAngleOverlap) WebTransformationMatrix transformA; transformA.translate3d(-6, 0, 1); transformA.translate(-4, -10); - CCLayerSorter::LayerShape layerA(8, 20, transformA); + LayerShape layerA(8, 20, transformA); WebTransformationMatrix transformB; transformB.translate3d(6, 0, -1); transformB.translate(-4, -10); - CCLayerSorter::LayerShape layerB(8, 20, transformB); + LayerShape layerB(8, 20, transformB); WebTransformationMatrix transformC; transformC.rotate3d(0, 1, 0, 40); transformC.translate(-4, -10); - CCLayerSorter::LayerShape layerC(8, 20, transformC); + LayerShape layerC(8, 20, transformC); overlapResult = CCLayerSorter::checkOverlap(&layerA, &layerC, zThreshold, weight); EXPECT_EQ(CCLayerSorter::ABeforeB, overlapResult); @@ -164,7 +164,7 @@ TEST(CCLayerSorterTest, LayersUnderPathologicalPerspectiveTransform) WebTransformationMatrix transformA; transformA.translate3d(-15, 0, -2); transformA.translate(-5, -5); - CCLayerSorter::LayerShape layerA(10, 10, perspectiveMatrix * transformA); + LayerShape layerA(10, 10, perspectiveMatrix * transformA); // With this sequence of transforms, when layer B is correctly clipped, it will be // visible on the left half of the projection plane, in front of layerA. When it is @@ -174,7 +174,7 @@ TEST(CCLayerSorterTest, LayersUnderPathologicalPerspectiveTransform) transformB.translate3d(0, 0, 0.7); transformB.rotate3d(0, 45, 0); transformB.translate(-5, -5); - CCLayerSorter::LayerShape layerB(10, 10, perspectiveMatrix * transformB); + LayerShape layerB(10, 10, perspectiveMatrix * transformB); // Sanity check that the test case actually covers the intended scenario, where part // of layer B go behind the w = 0 plane. diff --git a/cc/layer_tree_host_impl.cc b/cc/layer_tree_host_impl.cc index a499656..b0cd9d7 100644 --- a/cc/layer_tree_host_impl.cc +++ b/cc/layer_tree_host_impl.cc @@ -158,7 +158,7 @@ WebTransformationMatrix CCPinchZoomViewport::implTransform() const class CCLayerTreeHostImplTimeSourceAdapter : public CCTimeSourceClient { public: - static scoped_ptr<CCLayerTreeHostImplTimeSourceAdapter> create(CCLayerTreeHostImpl* layerTreeHostImpl, PassRefPtr<CCDelayBasedTimeSource> timeSource) + static scoped_ptr<CCLayerTreeHostImplTimeSourceAdapter> create(CCLayerTreeHostImpl* layerTreeHostImpl, scoped_refptr<CCDelayBasedTimeSource> timeSource) { return make_scoped_ptr(new CCLayerTreeHostImplTimeSourceAdapter(layerTreeHostImpl, timeSource)); } @@ -185,7 +185,7 @@ public: } private: - CCLayerTreeHostImplTimeSourceAdapter(CCLayerTreeHostImpl* layerTreeHostImpl, PassRefPtr<CCDelayBasedTimeSource> timeSource) + CCLayerTreeHostImplTimeSourceAdapter(CCLayerTreeHostImpl* layerTreeHostImpl, scoped_refptr<CCDelayBasedTimeSource> timeSource) : m_layerTreeHostImpl(layerTreeHostImpl) , m_timeSource(timeSource) { @@ -193,7 +193,7 @@ private: } CCLayerTreeHostImpl* m_layerTreeHostImpl; - RefPtr<CCDelayBasedTimeSource> m_timeSource; + scoped_refptr<CCDelayBasedTimeSource> m_timeSource; DISALLOW_COPY_AND_ASSIGN(CCLayerTreeHostImplTimeSourceAdapter); }; diff --git a/cc/layer_tree_host_impl.h b/cc/layer_tree_host_impl.h index b6f57e5..2ec01be 100644 --- a/cc/layer_tree_host_impl.h +++ b/cc/layer_tree_host_impl.h @@ -16,8 +16,6 @@ #include "CCRenderPassSink.h" #include "third_party/skia/include/core/SkColor.h" #include <public/WebCompositorOutputSurfaceClient.h> -#include <wtf/PassOwnPtr.h> -#include <wtf/RefPtr.h> namespace cc { diff --git a/cc/layer_tree_host_impl_unittest.cc b/cc/layer_tree_host_impl_unittest.cc index 9f0b3c4..029c296 100644 --- a/cc/layer_tree_host_impl_unittest.cc +++ b/cc/layer_tree_host_impl_unittest.cc @@ -179,7 +179,7 @@ public: protected: scoped_ptr<CCGraphicsContext> createContext() { - return FakeWebCompositorOutputSurface::create(adoptPtr(new FakeWebGraphicsContext3D)).PassAs<CCGraphicsContext>(); + return FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new FakeWebGraphicsContext3D)).PassAs<CCGraphicsContext>(); } DebugScopedSetImplThread m_alwaysImplThread; @@ -348,7 +348,7 @@ TEST_P(CCLayerTreeHostImplTest, scrollWithoutRenderer) m_hostImpl = CCLayerTreeHostImpl::create(settings, this); // Initialization will fail here. - m_hostImpl->initializeRenderer(FakeWebCompositorOutputSurface::create(adoptPtr(new FakeWebGraphicsContext3DMakeCurrentFails)).PassAs<CCGraphicsContext>()); + m_hostImpl->initializeRenderer(FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new FakeWebGraphicsContext3DMakeCurrentFails)).PassAs<CCGraphicsContext>()); m_hostImpl->setViewportSize(IntSize(10, 10), IntSize(10, 10)); setupScrollAndContentsLayers(IntSize(100, 100)); @@ -1891,7 +1891,7 @@ protected: // viewport size is never set. TEST_P(CCLayerTreeHostImplTest, reshapeNotCalledUntilDraw) { - scoped_ptr<CCGraphicsContext> ccContext = FakeWebCompositorOutputSurface::create(adoptPtr(new ReshapeTrackerContext)).PassAs<CCGraphicsContext>(); + scoped_ptr<CCGraphicsContext> ccContext = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new ReshapeTrackerContext)).PassAs<CCGraphicsContext>(); ReshapeTrackerContext* reshapeTracker = static_cast<ReshapeTrackerContext*>(ccContext->context3D()); m_hostImpl->initializeRenderer(ccContext.Pass()); @@ -1934,7 +1934,7 @@ private: // where it should request to swap only the subBuffer that is damaged. TEST_P(CCLayerTreeHostImplTest, partialSwapReceivesDamageRect) { - scoped_ptr<CCGraphicsContext> ccContext = FakeWebCompositorOutputSurface::create(adoptPtr(new PartialSwapTrackerContext)).PassAs<CCGraphicsContext>(); + scoped_ptr<CCGraphicsContext> ccContext = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapTrackerContext)).PassAs<CCGraphicsContext>(); PartialSwapTrackerContext* partialSwapTracker = static_cast<PartialSwapTrackerContext*>(ccContext->context3D()); // This test creates its own CCLayerTreeHostImpl, so @@ -2148,7 +2148,7 @@ public: TEST_P(CCLayerTreeHostImplTest, noPartialSwap) { - scoped_ptr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::create(adoptPtr(new MockContext)).PassAs<CCGraphicsContext>(); + scoped_ptr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::create(scoped_ptr<WebGraphicsContext3D>(new MockContext)).PassAs<CCGraphicsContext>(); MockContext* mockContext = static_cast<MockContext*>(context->context3D()); MockContextHarness harness(mockContext); @@ -2167,7 +2167,7 @@ TEST_P(CCLayerTreeHostImplTest, noPartialSwap) TEST_P(CCLayerTreeHostImplTest, partialSwap) { - scoped_ptr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::create(adoptPtr(new MockContext)).PassAs<CCGraphicsContext>(); + scoped_ptr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new MockContext)).PassAs<CCGraphicsContext>(); MockContext* mockContext = static_cast<MockContext*>(context->context3D()); MockContextHarness harness(mockContext); @@ -2225,7 +2225,7 @@ static scoped_ptr<CCLayerTreeHostImpl> setupLayersForOpacity(bool partialSwap, C { CCSettings::setPartialSwapEnabled(partialSwap); - scoped_ptr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::create(adoptPtr(new PartialSwapContext)).PassAs<CCGraphicsContext>(); + scoped_ptr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapContext)).PassAs<CCGraphicsContext>(); CCLayerTreeSettings settings; scoped_ptr<CCLayerTreeHostImpl> myHostImpl = CCLayerTreeHostImpl::create(settings, client); @@ -2381,7 +2381,7 @@ TEST_P(CCLayerTreeHostImplTest, finishAllRenderingAfterContextLost) m_hostImpl = CCLayerTreeHostImpl::create(settings, this); // The context initialization will fail, but we should still be able to call finishAllRendering() without any ill effects. - m_hostImpl->initializeRenderer(FakeWebCompositorOutputSurface::create(adoptPtr(new FakeWebGraphicsContext3DMakeCurrentFails)).PassAs<CCGraphicsContext>()); + m_hostImpl->initializeRenderer(FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new FakeWebGraphicsContext3DMakeCurrentFails)).PassAs<CCGraphicsContext>()); m_hostImpl->finishAllRendering(); } @@ -2419,14 +2419,14 @@ TEST_P(CCLayerTreeHostImplTest, contextLostDuringInitialize) for (unsigned i = 0; i < kMakeCurrentSuccessesNeededForSuccessfulInitialization; ++i) { // The context will get lost during initialization, we shouldn't crash. We // should also be in a consistent state. - EXPECT_FALSE(m_hostImpl->initializeRenderer(FakeWebCompositorOutputSurface::create(adoptPtr(new FakeWebGraphicsContext3DMakeCurrentFailsEventually(i))).PassAs<CCGraphicsContext>())); + EXPECT_FALSE(m_hostImpl->initializeRenderer(FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new FakeWebGraphicsContext3DMakeCurrentFailsEventually(i))).PassAs<CCGraphicsContext>())); EXPECT_EQ(0, m_hostImpl->context()); EXPECT_EQ(0, m_hostImpl->renderer()); EXPECT_EQ(0, m_hostImpl->resourceProvider()); EXPECT_TRUE(m_hostImpl->initializeRenderer(createContext())); } - EXPECT_TRUE(m_hostImpl->initializeRenderer(FakeWebCompositorOutputSurface::create(adoptPtr(new FakeWebGraphicsContext3DMakeCurrentFailsEventually(kMakeCurrentSuccessesNeededForSuccessfulInitialization))).PassAs<CCGraphicsContext>())); + EXPECT_TRUE(m_hostImpl->initializeRenderer(FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new FakeWebGraphicsContext3DMakeCurrentFailsEventually(kMakeCurrentSuccessesNeededForSuccessfulInitialization))).PassAs<CCGraphicsContext>())); EXPECT_TRUE(m_hostImpl->context()); EXPECT_TRUE(m_hostImpl->renderer()); EXPECT_TRUE(m_hostImpl->resourceProvider()); @@ -2754,7 +2754,7 @@ TEST_P(CCLayerTreeHostImplTest, dontUseOldResourcesAfterLostContext) rootLayer->addChild(delegatedRendererLayer.PassAs<CCLayerImpl>()); // Use a context that supports IOSurfaces - m_hostImpl->initializeRenderer(FakeWebCompositorOutputSurface::create(adoptPtr(new FakeWebGraphicsContext3DWithIOSurface)).PassAs<CCGraphicsContext>()); + m_hostImpl->initializeRenderer(FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new FakeWebGraphicsContext3DWithIOSurface)).PassAs<CCGraphicsContext>()); hwVideoFrame.setTextureId(m_hostImpl->resourceProvider()->graphicsContext3D()->createTexture()); @@ -2770,7 +2770,7 @@ TEST_P(CCLayerTreeHostImplTest, dontUseOldResourcesAfterLostContext) // Lose the context, replacing it with a StrictWebGraphicsContext3DWithIOSurface, // that will warn if any resource from the previous context gets used. - m_hostImpl->initializeRenderer(FakeWebCompositorOutputSurface::create(adoptPtr(new StrictWebGraphicsContext3DWithIOSurface)).PassAs<CCGraphicsContext>()); + m_hostImpl->initializeRenderer(FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new StrictWebGraphicsContext3DWithIOSurface)).PassAs<CCGraphicsContext>()); // Create dummy resources so that looking up an old resource will get an // invalid texture id mapping. @@ -2807,17 +2807,17 @@ public: { WebGLId id = FakeWebGraphicsContext3D::createTexture(); - m_textures.set(id, true); + m_textures[id] = true; ++m_numTextures; return id; } virtual void deleteTexture(WebGLId id) OVERRIDE { - if (!m_textures.get(id)) + if (m_textures.find(id) == m_textures.end()) return; - m_textures.set(id, false); + m_textures[id] = false; --m_numTextures; } @@ -2832,7 +2832,7 @@ public: unsigned numTextures() const { return m_numTextures; } private: - HashMap<WebGLId, bool> m_textures; + base::hash_map<WebGLId, bool> m_textures; unsigned m_numTextures; }; @@ -2881,7 +2881,7 @@ TEST_P(CCLayerTreeHostImplTest, layersFreeTextures) rootLayer->addChild(ioSurfaceLayer.PassAs<CCLayerImpl>()); // Lose the context, replacing it with a TrackingWebGraphicsContext3D (which the CCLayerTreeHostImpl takes ownership of). - scoped_ptr<CCGraphicsContext> ccContext(FakeWebCompositorOutputSurface::create(adoptPtr(new TrackingWebGraphicsContext3D))); + scoped_ptr<CCGraphicsContext> ccContext(FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new TrackingWebGraphicsContext3D))); TrackingWebGraphicsContext3D* trackingWebGraphicsContext = static_cast<TrackingWebGraphicsContext3D*>(ccContext->context3D()); m_hostImpl->initializeRenderer(ccContext.Pass()); @@ -2909,7 +2909,7 @@ public: TEST_P(CCLayerTreeHostImplTest, hasTransparentBackground) { - scoped_ptr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::create(adoptPtr(new MockDrawQuadsToFillScreenContext)).PassAs<CCGraphicsContext>(); + scoped_ptr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new MockDrawQuadsToFillScreenContext)).PassAs<CCGraphicsContext>(); MockDrawQuadsToFillScreenContext* mockContext = static_cast<MockDrawQuadsToFillScreenContext*>(context->context3D()); // Run test case @@ -2953,7 +2953,7 @@ static void addDrawingLayerTo(CCLayerImpl* parent, int id, const IntRect& layerR static void setupLayersForTextureCaching(CCLayerTreeHostImpl* layerTreeHostImpl, CCLayerImpl*& rootPtr, CCLayerImpl*& intermediateLayerPtr, CCLayerImpl*& surfaceLayerPtr, CCLayerImpl*& childPtr, const IntSize& rootSize) { - scoped_ptr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::create(adoptPtr(new PartialSwapContext)).PassAs<CCGraphicsContext>(); + scoped_ptr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapContext)).PassAs<CCGraphicsContext>(); layerTreeHostImpl->initializeRenderer(context.Pass()); layerTreeHostImpl->setViewportSize(rootSize, rootSize); @@ -2997,7 +2997,7 @@ TEST_P(CCLayerTreeHostImplTest, textureCachingWithClipping) CCLayerImpl* rootPtr; CCLayerImpl* surfaceLayerPtr; - scoped_ptr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::create(adoptPtr(new PartialSwapContext)).PassAs<CCGraphicsContext>(); + scoped_ptr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapContext)).PassAs<CCGraphicsContext>(); IntSize rootSize(100, 100); @@ -3109,7 +3109,7 @@ TEST_P(CCLayerTreeHostImplTest, textureCachingWithOcclusion) CCLayerImpl* layerS1Ptr; CCLayerImpl* layerS2Ptr; - scoped_ptr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::create(adoptPtr(new PartialSwapContext)).PassAs<CCGraphicsContext>(); + scoped_ptr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapContext)).PassAs<CCGraphicsContext>(); IntSize rootSize(1000, 1000); @@ -3222,7 +3222,7 @@ TEST_P(CCLayerTreeHostImplTest, textureCachingWithOcclusionEarlyOut) CCLayerImpl* layerS1Ptr; CCLayerImpl* layerS2Ptr; - scoped_ptr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::create(adoptPtr(new PartialSwapContext)).PassAs<CCGraphicsContext>(); + scoped_ptr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapContext)).PassAs<CCGraphicsContext>(); IntSize rootSize(1000, 1000); @@ -3336,7 +3336,7 @@ TEST_P(CCLayerTreeHostImplTest, textureCachingWithOcclusionExternalOverInternal) CCLayerImpl* layerS1Ptr; CCLayerImpl* layerS2Ptr; - scoped_ptr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::create(adoptPtr(new PartialSwapContext)).PassAs<CCGraphicsContext>(); + scoped_ptr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapContext)).PassAs<CCGraphicsContext>(); IntSize rootSize(1000, 1000); @@ -3419,7 +3419,7 @@ TEST_P(CCLayerTreeHostImplTest, textureCachingWithOcclusionExternalNotAligned) CCLayerImpl* rootPtr; CCLayerImpl* layerS1Ptr; - scoped_ptr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::create(adoptPtr(new PartialSwapContext)).PassAs<CCGraphicsContext>(); + scoped_ptr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapContext)).PassAs<CCGraphicsContext>(); IntSize rootSize(1000, 1000); @@ -3504,7 +3504,7 @@ TEST_P(CCLayerTreeHostImplTest, textureCachingWithOcclusionPartialSwap) CCLayerImpl* layerS1Ptr; CCLayerImpl* layerS2Ptr; - scoped_ptr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::create(adoptPtr(new PartialSwapContext)).PassAs<CCGraphicsContext>(); + scoped_ptr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapContext)).PassAs<CCGraphicsContext>(); IntSize rootSize(1000, 1000); @@ -3625,7 +3625,7 @@ TEST_P(CCLayerTreeHostImplTest, textureCachingWithScissor) IntRect childRect(10, 10, 50, 50); IntRect grandChildRect(5, 5, 150, 150); - scoped_ptr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::create(adoptPtr(new PartialSwapContext)).PassAs<CCGraphicsContext>(); + scoped_ptr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapContext)).PassAs<CCGraphicsContext>(); myHostImpl->initializeRenderer(context.Pass()); root->setAnchorPoint(FloatPoint(0, 0)); diff --git a/cc/layer_tree_host_unittest.cc b/cc/layer_tree_host_unittest.cc index 83ae7de..26a810e 100644 --- a/cc/layer_tree_host_unittest.cc +++ b/cc/layer_tree_host_unittest.cc @@ -2717,9 +2717,9 @@ SINGLE_AND_MULTI_THREAD_TEST_F(CCLayerTreeHostTestLostContextAfterEvictTextures) class CompositorFakeWebGraphicsContext3DWithEndQueryCausingLostContext : public WebKit::CompositorFakeWebGraphicsContext3D { public: - static PassOwnPtr<CompositorFakeWebGraphicsContext3DWithEndQueryCausingLostContext> create(Attributes attrs) + static scoped_ptr<CompositorFakeWebGraphicsContext3DWithEndQueryCausingLostContext> create(Attributes attrs) { - return adoptPtr(new CompositorFakeWebGraphicsContext3DWithEndQueryCausingLostContext(attrs)); + return make_scoped_ptr(new CompositorFakeWebGraphicsContext3DWithEndQueryCausingLostContext(attrs)); } virtual void setContextLostCallback(WebGraphicsContextLostCallback* callback) { m_contextLostCallback = callback; } @@ -2763,7 +2763,7 @@ public: virtual scoped_ptr<WebKit::WebCompositorOutputSurface> createOutputSurface() { - return FakeWebCompositorOutputSurface::create(CompositorFakeWebGraphicsContext3DWithEndQueryCausingLostContext::create(WebGraphicsContext3D::Attributes())).PassAs<WebKit::WebCompositorOutputSurface>(); + return FakeWebCompositorOutputSurface::create(CompositorFakeWebGraphicsContext3DWithEndQueryCausingLostContext::create(WebGraphicsContext3D::Attributes()).PassAs<WebKit::WebGraphicsContext3D>()).PassAs<WebKit::WebCompositorOutputSurface>(); } virtual void beginTest() diff --git a/cc/prioritized_texture_unittest.cc b/cc/prioritized_texture_unittest.cc index 362b707..f00544b 100644 --- a/cc/prioritized_texture_unittest.cc +++ b/cc/prioritized_texture_unittest.cc @@ -16,7 +16,6 @@ using namespace cc; using namespace WebKitTests; -using namespace WTF; namespace cc { diff --git a/cc/proxy.cc b/cc/proxy.cc index bc5ae69..c3c6a11 100644 --- a/cc/proxy.cc +++ b/cc/proxy.cc @@ -8,8 +8,6 @@ #include "CCThreadTask.h" -using namespace WTF; - namespace cc { namespace { diff --git a/cc/rate_limiter.cc b/cc/rate_limiter.cc index 4e1f511..5e15cd68 100644 --- a/cc/rate_limiter.cc +++ b/cc/rate_limiter.cc @@ -10,7 +10,6 @@ #include "CCThread.h" #include "base/debug/trace_event.h" #include <public/WebGraphicsContext3D.h> -#include <wtf/RefPtr.h> namespace cc { diff --git a/cc/render_surface_filters_unittest.cc b/cc/render_surface_filters_unittest.cc index 0c4283d..a793197 100644 --- a/cc/render_surface_filters_unittest.cc +++ b/cc/render_surface_filters_unittest.cc @@ -10,7 +10,6 @@ #include "testing/gtest/include/gtest/gtest.h" #include <public/WebFilterOperation.h> #include <public/WebFilterOperations.h> -#include <wtf/RefPtr.h> using namespace cc; using namespace WebKit; diff --git a/cc/resource_provider_unittest.cc b/cc/resource_provider_unittest.cc index 6a494ed..a72f45b 100644 --- a/cc/resource_provider_unittest.cc +++ b/cc/resource_provider_unittest.cc @@ -45,7 +45,7 @@ struct Texture { // contents as well as information about sync points. class ContextSharedData { public: - static PassOwnPtr<ContextSharedData> create() { return adoptPtr(new ContextSharedData()); } + static scoped_ptr<ContextSharedData> create() { return make_scoped_ptr(new ContextSharedData()); } unsigned insertSyncPoint() { return m_nextSyncPoint++; } @@ -95,7 +95,7 @@ private: class ResourceProviderContext : public CompositorFakeWebGraphicsContext3D { public: - static PassOwnPtr<ResourceProviderContext> create(ContextSharedData* sharedData) { return adoptPtr(new ResourceProviderContext(Attributes(), sharedData)); } + static scoped_ptr<ResourceProviderContext> create(ContextSharedData* sharedData) { return make_scoped_ptr(new ResourceProviderContext(Attributes(), sharedData)); } virtual unsigned insertSyncPoint() { @@ -269,7 +269,7 @@ class CCResourceProviderTest : public testing::TestWithParam<CCResourceProvider: public: CCResourceProviderTest() : m_sharedData(ContextSharedData::create()) - , m_context(FakeWebCompositorOutputSurface::create(ResourceProviderContext::create(m_sharedData.get()))) + , m_context(FakeWebCompositorOutputSurface::create(ResourceProviderContext::create(m_sharedData.get()).PassAs<WebKit::WebGraphicsContext3D>().PassAs<WebKit::WebGraphicsContext3D>())) , m_resourceProvider(CCResourceProvider::create(m_context.get())) { m_resourceProvider->setDefaultResourceType(GetParam()); @@ -299,7 +299,7 @@ public: protected: DebugScopedSetImplThread implThread; - OwnPtr<ContextSharedData> m_sharedData; + scoped_ptr<ContextSharedData> m_sharedData; scoped_ptr<CCGraphicsContext> m_context; scoped_ptr<CCResourceProvider> m_resourceProvider; }; @@ -415,7 +415,7 @@ TEST_P(CCResourceProviderTest, TransferResources) if (GetParam() != CCResourceProvider::GLTexture) return; - scoped_ptr<CCGraphicsContext> childContext(FakeWebCompositorOutputSurface::create(ResourceProviderContext::create(m_sharedData.get()))); + scoped_ptr<CCGraphicsContext> childContext(FakeWebCompositorOutputSurface::create(ResourceProviderContext::create(m_sharedData.get()).PassAs<WebKit::WebGraphicsContext3D>())); scoped_ptr<CCResourceProvider> childResourceProvider(CCResourceProvider::create(childContext.get())); IntSize size(1, 1); @@ -532,7 +532,7 @@ TEST_P(CCResourceProviderTest, DeleteTransferredResources) if (GetParam() != CCResourceProvider::GLTexture) return; - scoped_ptr<CCGraphicsContext> childContext(FakeWebCompositorOutputSurface::create(ResourceProviderContext::create(m_sharedData.get()))); + scoped_ptr<CCGraphicsContext> childContext(FakeWebCompositorOutputSurface::create(ResourceProviderContext::create(m_sharedData.get()).PassAs<WebKit::WebGraphicsContext3D>())); scoped_ptr<CCResourceProvider> childResourceProvider(CCResourceProvider::create(childContext.get())); IntSize size(1, 1); diff --git a/cc/scheduler_state_machine_unittest.cc b/cc/scheduler_state_machine_unittest.cc index 9d4796e..b588913 100644 --- a/cc/scheduler_state_machine_unittest.cc +++ b/cc/scheduler_state_machine_unittest.cc @@ -9,7 +9,6 @@ #include "testing/gtest/include/gtest/gtest.h" using namespace cc; -using namespace WTF; namespace { diff --git a/cc/scheduler_unittest.cc b/cc/scheduler_unittest.cc index 104453d..abdcc15 100644 --- a/cc/scheduler_unittest.cc +++ b/cc/scheduler_unittest.cc @@ -12,7 +12,6 @@ using namespace cc; using namespace WebKitTests; -using namespace WTF; namespace { @@ -71,7 +70,7 @@ protected: TEST(CCSchedulerTest, RequestCommit) { FakeCCSchedulerClient client; - RefPtr<FakeCCTimeSource> timeSource = adoptRef(new FakeCCTimeSource()); + scoped_refptr<FakeCCTimeSource> timeSource(new FakeCCTimeSource()); scoped_ptr<CCScheduler> scheduler = CCScheduler::create(&client, make_scoped_ptr(new CCFrameRateController(timeSource))); scheduler->setCanBeginFrame(true); scheduler->setVisible(true); @@ -105,7 +104,7 @@ TEST(CCSchedulerTest, RequestCommit) TEST(CCSchedulerTest, RequestCommitAfterBeginFrame) { FakeCCSchedulerClient client; - RefPtr<FakeCCTimeSource> timeSource = adoptRef(new FakeCCTimeSource()); + scoped_refptr<FakeCCTimeSource> timeSource(new FakeCCTimeSource()); scoped_ptr<CCScheduler> scheduler = CCScheduler::create(&client, make_scoped_ptr(new CCFrameRateController(timeSource))); scheduler->setCanBeginFrame(true); scheduler->setVisible(true); @@ -139,7 +138,7 @@ TEST(CCSchedulerTest, RequestCommitAfterBeginFrame) TEST(CCSchedulerTest, TextureAcquisitionCollision) { FakeCCSchedulerClient client; - RefPtr<FakeCCTimeSource> timeSource = adoptRef(new FakeCCTimeSource()); + scoped_refptr<FakeCCTimeSource> timeSource(new FakeCCTimeSource()); scoped_ptr<CCScheduler> scheduler = CCScheduler::create(&client, make_scoped_ptr(new CCFrameRateController(timeSource))); scheduler->setCanBeginFrame(true); scheduler->setVisible(true); @@ -178,7 +177,7 @@ TEST(CCSchedulerTest, TextureAcquisitionCollision) TEST(CCSchedulerTest, VisibilitySwitchWithTextureAcquisition) { FakeCCSchedulerClient client; - RefPtr<FakeCCTimeSource> timeSource = adoptRef(new FakeCCTimeSource()); + scoped_refptr<FakeCCTimeSource> timeSource(new FakeCCTimeSource()); scoped_ptr<CCScheduler> scheduler = CCScheduler::create(&client, make_scoped_ptr(new CCFrameRateController(timeSource))); scheduler->setCanBeginFrame(true); scheduler->setVisible(true); @@ -241,7 +240,7 @@ protected: TEST(CCSchedulerTest, RequestRedrawInsideDraw) { SchedulerClientThatSetNeedsDrawInsideDraw client; - RefPtr<FakeCCTimeSource> timeSource = adoptRef(new FakeCCTimeSource()); + scoped_refptr<FakeCCTimeSource> timeSource(new FakeCCTimeSource()); scoped_ptr<CCScheduler> scheduler = CCScheduler::create(&client, make_scoped_ptr(new CCFrameRateController(timeSource))); client.setScheduler(scheduler.get()); scheduler->setCanBeginFrame(true); @@ -268,7 +267,7 @@ TEST(CCSchedulerTest, RequestRedrawInsideDraw) TEST(CCSchedulerTest, RequestRedrawInsideFailedDraw) { SchedulerClientThatSetNeedsDrawInsideDraw client; - RefPtr<FakeCCTimeSource> timeSource = adoptRef(new FakeCCTimeSource()); + scoped_refptr<FakeCCTimeSource> timeSource(new FakeCCTimeSource()); scoped_ptr<CCScheduler> scheduler = CCScheduler::create(&client, make_scoped_ptr(new CCFrameRateController(timeSource))); client.setScheduler(scheduler.get()); scheduler->setCanBeginFrame(true); @@ -341,7 +340,7 @@ protected: TEST(CCSchedulerTest, RequestCommitInsideDraw) { SchedulerClientThatSetNeedsCommitInsideDraw client; - RefPtr<FakeCCTimeSource> timeSource = adoptRef(new FakeCCTimeSource()); + scoped_refptr<FakeCCTimeSource> timeSource(new FakeCCTimeSource()); scoped_ptr<CCScheduler> scheduler = CCScheduler::create(&client, make_scoped_ptr(new CCFrameRateController(timeSource))); client.setScheduler(scheduler.get()); scheduler->setCanBeginFrame(true); @@ -369,7 +368,7 @@ TEST(CCSchedulerTest, RequestCommitInsideDraw) TEST(CCSchedulerTest, RequestCommitInsideFailedDraw) { SchedulerClientThatSetNeedsDrawInsideDraw client; - RefPtr<FakeCCTimeSource> timeSource = adoptRef(new FakeCCTimeSource()); + scoped_refptr<FakeCCTimeSource> timeSource(new FakeCCTimeSource()); scoped_ptr<CCScheduler> scheduler = CCScheduler::create(&client, make_scoped_ptr(new CCFrameRateController(timeSource))); client.setScheduler(scheduler.get()); scheduler->setCanBeginFrame(true); @@ -409,7 +408,7 @@ TEST(CCSchedulerTest, RequestCommitInsideFailedDraw) TEST(CCSchedulerTest, NoBeginFrameWhenDrawFails) { - RefPtr<FakeCCTimeSource> timeSource = adoptRef(new FakeCCTimeSource()); + scoped_refptr<FakeCCTimeSource> timeSource(new FakeCCTimeSource()); SchedulerClientThatSetNeedsCommitInsideDraw client; scoped_ptr<FakeCCFrameRateController> controller(new FakeCCFrameRateController(timeSource)); FakeCCFrameRateController* controllerPtr = controller.get(); @@ -446,7 +445,7 @@ TEST(CCSchedulerTest, NoBeginFrameWhenDrawFails) TEST(CCSchedulerTest, NoBeginFrameWhenSwapFailsDuringForcedCommit) { - RefPtr<FakeCCTimeSource> timeSource = adoptRef(new FakeCCTimeSource()); + scoped_refptr<FakeCCTimeSource> timeSource(new FakeCCTimeSource()); FakeCCSchedulerClient client; scoped_ptr<FakeCCFrameRateController> controller(new FakeCCFrameRateController(timeSource)); FakeCCFrameRateController* controllerPtr = controller.get(); diff --git a/cc/single_thread_proxy.cc b/cc/single_thread_proxy.cc index d6648d6..93e397a 100644 --- a/cc/single_thread_proxy.cc +++ b/cc/single_thread_proxy.cc @@ -14,8 +14,6 @@ #include "base/debug/trace_event.h" #include <wtf/CurrentTime.h> -using namespace WTF; - namespace cc { scoped_ptr<CCProxy> CCSingleThreadProxy::create(CCLayerTreeHost* layerTreeHost) diff --git a/cc/software_renderer_unittest.cc b/cc/software_renderer_unittest.cc index ed0a038..d77ad7f 100644 --- a/cc/software_renderer_unittest.cc +++ b/cc/software_renderer_unittest.cc @@ -31,7 +31,7 @@ namespace { class CCRendererSoftwareTest : public testing::Test, public CCRendererClient { public: void initializeRenderer() { - m_outputSurface = FakeWebCompositorOutputSurface::createSoftware(adoptPtr(new FakeWebCompositorSoftwareOutputDevice)); + m_outputSurface = FakeWebCompositorOutputSurface::createSoftware(scoped_ptr<WebKit::WebCompositorSoftwareOutputDevice>(new FakeWebCompositorSoftwareOutputDevice)); m_resourceProvider = CCResourceProvider::create(m_outputSurface.get()); m_renderer = CCRendererSoftware::create(this, resourceProvider(), softwareDevice()); } diff --git a/cc/test/compositor_fake_web_graphics_context_3d.h b/cc/test/compositor_fake_web_graphics_context_3d.h index f76b042..839f5d4 100644 --- a/cc/test/compositor_fake_web_graphics_context_3d.h +++ b/cc/test/compositor_fake_web_graphics_context_3d.h @@ -5,17 +5,17 @@ #ifndef CompositorFakeWebGraphicsContext3D_h #define CompositorFakeWebGraphicsContext3D_h +#include "base/memory/scoped_ptr.h" #include "cc/test/fake_web_graphics_context_3d.h" -#include <wtf/PassOwnPtr.h> namespace WebKit { // Test stub for WebGraphicsContext3D. Returns canned values needed for compositor initialization. class CompositorFakeWebGraphicsContext3D : public FakeWebGraphicsContext3D { public: - static PassOwnPtr<CompositorFakeWebGraphicsContext3D> create(Attributes attrs) + static scoped_ptr<CompositorFakeWebGraphicsContext3D> create(Attributes attrs) { - return adoptPtr(new CompositorFakeWebGraphicsContext3D(attrs)); + return make_scoped_ptr(new CompositorFakeWebGraphicsContext3D(attrs)); } virtual bool makeContextCurrent() { return true; } diff --git a/cc/test/fake_graphics_context.h b/cc/test/fake_graphics_context.h index 755ac3d..276e978 100644 --- a/cc/test/fake_graphics_context.h +++ b/cc/test/fake_graphics_context.h @@ -14,7 +14,7 @@ namespace WebKit { static inline scoped_ptr<cc::CCGraphicsContext> createFakeCCGraphicsContext() { - return FakeWebCompositorOutputSurface::create(CompositorFakeWebGraphicsContext3D::create(WebGraphicsContext3D::Attributes())).PassAs<cc::CCGraphicsContext>(); + return FakeWebCompositorOutputSurface::create(CompositorFakeWebGraphicsContext3D::create(WebGraphicsContext3D::Attributes()).PassAs<WebKit::WebGraphicsContext3D>()).PassAs<cc::CCGraphicsContext>(); } } // namespace WebKit diff --git a/cc/test/fake_layer_tree_host_client.cc b/cc/test/fake_layer_tree_host_client.cc index 36b5cc4..fecbb82 100644 --- a/cc/test/fake_layer_tree_host_client.cc +++ b/cc/test/fake_layer_tree_host_client.cc @@ -11,7 +11,7 @@ namespace cc { scoped_ptr<WebKit::WebCompositorOutputSurface> FakeCCLayerTreeHostClient::createOutputSurface() { WebKit::WebGraphicsContext3D::Attributes attrs; - return scoped_ptr<WebKit::WebCompositorOutputSurface>(WebKit::FakeWebCompositorOutputSurface::create(WebKit::CompositorFakeWebGraphicsContext3D::create(attrs))); + return WebKit::FakeWebCompositorOutputSurface::create(WebKit::CompositorFakeWebGraphicsContext3D::create(attrs).PassAs<WebKit::WebGraphicsContext3D>()).PassAs<WebKit::WebCompositorOutputSurface>(); } scoped_ptr<CCInputHandler> FakeCCLayerTreeHostClient::createInputHandler() diff --git a/cc/test/fake_web_compositor_output_surface.h b/cc/test/fake_web_compositor_output_surface.h index 2d3128c..5574e95 100644 --- a/cc/test/fake_web_compositor_output_surface.h +++ b/cc/test/fake_web_compositor_output_surface.h @@ -9,21 +9,19 @@ #include "cc/test/fake_web_compositor_software_output_device.h" #include <public/WebCompositorOutputSurface.h> #include <public/WebGraphicsContext3D.h> -#include <wtf/OwnPtr.h> -#include <wtf/PassOwnPtr.h> namespace WebKit { class FakeWebCompositorOutputSurface : public WebCompositorOutputSurface { public: - static inline scoped_ptr<FakeWebCompositorOutputSurface> create(PassOwnPtr<WebGraphicsContext3D> context3D) + static inline scoped_ptr<FakeWebCompositorOutputSurface> create(scoped_ptr<WebGraphicsContext3D> context3D) { - return make_scoped_ptr(new FakeWebCompositorOutputSurface(context3D)); + return make_scoped_ptr(new FakeWebCompositorOutputSurface(context3D.Pass())); } - static inline scoped_ptr<FakeWebCompositorOutputSurface> createSoftware(PassOwnPtr<WebCompositorSoftwareOutputDevice> softwareDevice) + static inline scoped_ptr<FakeWebCompositorOutputSurface> createSoftware(scoped_ptr<WebCompositorSoftwareOutputDevice> softwareDevice) { - return make_scoped_ptr(new FakeWebCompositorOutputSurface(softwareDevice)); + return make_scoped_ptr(new FakeWebCompositorOutputSurface(softwareDevice.Pass())); } virtual bool bindToClient(WebCompositorOutputSurfaceClient* client) OVERRIDE @@ -56,18 +54,18 @@ public: } private: - explicit FakeWebCompositorOutputSurface(PassOwnPtr<WebGraphicsContext3D> context3D) + explicit FakeWebCompositorOutputSurface(scoped_ptr<WebGraphicsContext3D> context3D) { - m_context3D = context3D; + m_context3D = context3D.Pass(); } - explicit FakeWebCompositorOutputSurface(PassOwnPtr<WebCompositorSoftwareOutputDevice> softwareDevice) + explicit FakeWebCompositorOutputSurface(scoped_ptr<WebCompositorSoftwareOutputDevice> softwareDevice) { - m_softwareDevice = softwareDevice; + m_softwareDevice = softwareDevice.Pass(); } - OwnPtr<WebGraphicsContext3D> m_context3D; - OwnPtr<WebCompositorSoftwareOutputDevice> m_softwareDevice; + scoped_ptr<WebGraphicsContext3D> m_context3D; + scoped_ptr<WebCompositorSoftwareOutputDevice> m_softwareDevice; Capabilities m_capabilities; WebCompositorOutputSurfaceClient* m_client; }; diff --git a/cc/test/scheduler_test_common.h b/cc/test/scheduler_test_common.h index 2f6660b..27ec709 100644 --- a/cc/test/scheduler_test_common.h +++ b/cc/test/scheduler_test_common.h @@ -73,11 +73,8 @@ public: : m_active(false) , m_client(0) { - turnOffVerifier(); } - virtual ~FakeCCTimeSource() { } - virtual void setClient(cc::CCTimeSourceClient* client) OVERRIDE; virtual void setActive(bool b) OVERRIDE; virtual bool active() const OVERRIDE; @@ -95,6 +92,8 @@ public: void setNextTickTime(base::TimeTicks nextTickTime) { m_nextTickTime = nextTickTime; } protected: + virtual ~FakeCCTimeSource() { } + bool m_active; base::TimeTicks m_nextTickTime; cc::CCTimeSourceClient* m_client; @@ -102,9 +101,9 @@ protected: class FakeCCDelayBasedTimeSource : public cc::CCDelayBasedTimeSource { public: - static PassRefPtr<FakeCCDelayBasedTimeSource> create(base::TimeDelta interval, cc::CCThread* thread) + static scoped_refptr<FakeCCDelayBasedTimeSource> create(base::TimeDelta interval, cc::CCThread* thread) { - return adoptRef(new FakeCCDelayBasedTimeSource(interval, thread)); + return make_scoped_refptr(new FakeCCDelayBasedTimeSource(interval, thread)); } void setNow(base::TimeTicks time) { m_now = time; } @@ -115,13 +114,14 @@ protected: : CCDelayBasedTimeSource(interval, thread) { } + virtual ~FakeCCDelayBasedTimeSource() { } base::TimeTicks m_now; }; class FakeCCFrameRateController : public cc::CCFrameRateController { public: - FakeCCFrameRateController(PassRefPtr<cc::CCTimeSource> timer) : cc::CCFrameRateController(timer) { } + FakeCCFrameRateController(scoped_refptr<cc::CCTimeSource> timer) : cc::CCFrameRateController(timer) { } int numFramesPending() const { return m_numFramesPending; } }; diff --git a/cc/texture_copier_unittest.cc b/cc/texture_copier_unittest.cc index 38009d0..e804aaf 100644 --- a/cc/texture_copier_unittest.cc +++ b/cc/texture_copier_unittest.cc @@ -10,7 +10,6 @@ #include "cc/test/fake_web_graphics_context_3d.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" -#include <wtf/RefPtr.h> using namespace cc; using namespace WebKit; diff --git a/cc/texture_layer_unittest.cc b/cc/texture_layer_unittest.cc index f849189..9ca4732 100644 --- a/cc/texture_layer_unittest.cc +++ b/cc/texture_layer_unittest.cc @@ -45,7 +45,7 @@ public: protected: virtual void SetUp() { - m_layerTreeHost = adoptPtr(new MockCCLayerTreeHost); + m_layerTreeHost.reset(new MockCCLayerTreeHost); } virtual void TearDown() @@ -54,10 +54,10 @@ protected: EXPECT_CALL(*m_layerTreeHost, acquireLayerTextures()).Times(AnyNumber()); m_layerTreeHost->setRootLayer(0); - m_layerTreeHost.clear(); + m_layerTreeHost.reset(); } - OwnPtr<MockCCLayerTreeHost> m_layerTreeHost; + scoped_ptr<MockCCLayerTreeHost> m_layerTreeHost; private: WebKitTests::WebCompositorInitializer m_compositorInitializer; }; diff --git a/cc/texture_update_controller_unittest.cc b/cc/texture_update_controller_unittest.cc index 95a7aab..04e3557 100644 --- a/cc/texture_update_controller_unittest.cc +++ b/cc/texture_update_controller_unittest.cc @@ -14,7 +14,6 @@ #include "cc/test/web_compositor_initializer.h" #include "testing/gtest/include/gtest/gtest.h" #include <public/WebThread.h> -#include <wtf/RefPtr.h> using namespace cc; using namespace WebKit; @@ -112,7 +111,7 @@ public: protected: virtual void SetUp() { - m_context = FakeWebCompositorOutputSurface::create(adoptPtr(new WebGraphicsContext3DForUploadTest(this))); + m_context = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new WebGraphicsContext3DForUploadTest(this))); m_bitmap.setConfig(SkBitmap::kARGB_8888_Config, 300, 150); m_bitmap.allocPixels(); DebugScopedSetImplThread implThread; @@ -181,7 +180,7 @@ protected: scoped_ptr<CCTextureUpdateQueue> m_queue; scoped_ptr<CCPrioritizedTexture> m_textures[4]; TextureUploaderForUploadTest m_uploader; - OwnPtr<WebThread> m_thread; + scoped_ptr<WebThread> m_thread; WebCompositorInitializer m_compositorInitializer; SkBitmap m_bitmap; diff --git a/cc/thread_proxy.cc b/cc/thread_proxy.cc index 1469fe3..9c988d4 100644 --- a/cc/thread_proxy.cc +++ b/cc/thread_proxy.cc @@ -19,7 +19,6 @@ #include <public/WebSharedGraphicsContext3D.h> #include <wtf/CurrentTime.h> -using namespace WTF; using WebKit::WebSharedGraphicsContext3D; namespace { diff --git a/cc/threaded_unittest.cc b/cc/threaded_unittest.cc index ebeaa70..1e327bd 100644 --- a/cc/threaded_unittest.cc +++ b/cc/threaded_unittest.cc @@ -36,9 +36,9 @@ using namespace WebKit; namespace WebKitTests { -PassOwnPtr<CompositorFakeWebGraphicsContext3DWithTextureTracking> CompositorFakeWebGraphicsContext3DWithTextureTracking::create(Attributes attrs) +scoped_ptr<CompositorFakeWebGraphicsContext3DWithTextureTracking> CompositorFakeWebGraphicsContext3DWithTextureTracking::create(Attributes attrs) { - return adoptPtr(new CompositorFakeWebGraphicsContext3DWithTextureTracking(attrs)); + return make_scoped_ptr(new CompositorFakeWebGraphicsContext3DWithTextureTracking(attrs)); } WebGLId CompositorFakeWebGraphicsContext3DWithTextureTracking::createTexture() @@ -90,7 +90,7 @@ bool TestHooks::prepareToDrawOnCCThread(cc::CCLayerTreeHostImpl*) scoped_ptr<WebCompositorOutputSurface> TestHooks::createOutputSurface() { - return FakeWebCompositorOutputSurface::create(CompositorFakeWebGraphicsContext3DWithTextureTracking::create(WebGraphicsContext3D::Attributes())).PassAs<WebCompositorOutputSurface>(); + return FakeWebCompositorOutputSurface::create(CompositorFakeWebGraphicsContext3DWithTextureTracking::create(WebGraphicsContext3D::Attributes()).PassAs<WebKit::WebGraphicsContext3D>()).PassAs<WebKit::WebCompositorOutputSurface>(); } scoped_ptr<MockLayerTreeHostImpl> MockLayerTreeHostImpl::create(TestHooks* testHooks, const CCLayerTreeSettings& settings, CCLayerTreeHostImplClient* client) @@ -184,9 +184,9 @@ private: // Implementation of CCLayerTreeHost callback interface. class MockLayerTreeHostClient : public MockCCLayerTreeHostClient { public: - static PassOwnPtr<MockLayerTreeHostClient> create(TestHooks* testHooks) + static scoped_ptr<MockLayerTreeHostClient> create(TestHooks* testHooks) { - return adoptPtr(new MockLayerTreeHostClient(testHooks)); + return make_scoped_ptr(new MockLayerTreeHostClient(testHooks)); } virtual void willBeginFrame() OVERRIDE @@ -529,7 +529,7 @@ void CCThreadedTest::runTest(bool threaded) Platform::current()->compositorSupport()->setAcceleratedAnimationEnabled(true); if (threaded) { - m_webThread = adoptPtr(WebKit::Platform::current()->createThread("CCThreadedTest")); + m_webThread.reset(WebKit::Platform::current()->createThread("CCThreadedTest")); Platform::current()->compositorSupport()->initialize(m_webThread.get()); } else Platform::current()->compositorSupport()->initialize(0); @@ -553,7 +553,7 @@ void CCThreadedTest::runTest(bool threaded) m_timeoutTask->clearTest(); ASSERT_FALSE(m_layerTreeHost.get()); - m_client.clear(); + m_client.reset(); if (m_timedOut) { FAIL() << "Test timed out"; Platform::current()->compositorSupport()->shutdown(); diff --git a/cc/threaded_unittest.h b/cc/threaded_unittest.h index d1638a3..5a241b0 100644 --- a/cc/threaded_unittest.h +++ b/cc/threaded_unittest.h @@ -116,7 +116,7 @@ protected: WebKit::WebThread* webThread() const { return m_webThread.get(); } cc::CCLayerTreeSettings m_settings; - OwnPtr<MockCCLayerTreeHostClient> m_client; + scoped_ptr<MockCCLayerTreeHostClient> m_client; scoped_ptr<cc::CCLayerTreeHost> m_layerTreeHost; protected: @@ -130,7 +130,7 @@ private: bool m_scheduled; bool m_started; - OwnPtr<WebKit::WebThread> m_webThread; + scoped_ptr<WebKit::WebThread> m_webThread; TimeoutTask* m_timeoutTask; BeginTask* m_beginTask; }; @@ -169,7 +169,7 @@ private: class CompositorFakeWebGraphicsContext3DWithTextureTracking : public WebKit::CompositorFakeWebGraphicsContext3D { public: - static PassOwnPtr<CompositorFakeWebGraphicsContext3DWithTextureTracking> create(Attributes); + static scoped_ptr<CompositorFakeWebGraphicsContext3DWithTextureTracking> create(Attributes); virtual ~CompositorFakeWebGraphicsContext3DWithTextureTracking(); virtual WebKit::WebGLId createTexture(); diff --git a/cc/throttled_texture_uploader_unittest.cc b/cc/throttled_texture_uploader_unittest.cc index 6f6a876..fb346da 100644 --- a/cc/throttled_texture_uploader_unittest.cc +++ b/cc/throttled_texture_uploader_unittest.cc @@ -12,9 +12,6 @@ #include "cc/test/fake_web_graphics_context_3d.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" -#include <wtf/OwnPtr.h> -#include <wtf/PassOwnPtr.h> -#include <wtf/RefPtr.h> using namespace cc; using namespace WebKit; @@ -58,7 +55,7 @@ void uploadTexture( TEST(ThrottledTextureUploaderTest, NumBlockingUploads) { - OwnPtr<FakeWebGraphicsContext3DWithQueryTesting> fakeContext(adoptPtr(new FakeWebGraphicsContext3DWithQueryTesting)); + scoped_ptr<FakeWebGraphicsContext3DWithQueryTesting> fakeContext(new FakeWebGraphicsContext3DWithQueryTesting); scoped_ptr<ThrottledTextureUploader> uploader = ThrottledTextureUploader::create(fakeContext.get()); scoped_ptr<CCPrioritizedTexture> texture = CCPrioritizedTexture::create(NULL, IntSize(256, 256), GL_RGBA); @@ -81,7 +78,7 @@ TEST(ThrottledTextureUploaderTest, NumBlockingUploads) TEST(ThrottledTextureUploaderTest, MarkPendingUploadsAsNonBlocking) { - OwnPtr<FakeWebGraphicsContext3DWithQueryTesting> fakeContext(adoptPtr(new FakeWebGraphicsContext3DWithQueryTesting)); + scoped_ptr<FakeWebGraphicsContext3DWithQueryTesting> fakeContext(new FakeWebGraphicsContext3DWithQueryTesting); scoped_ptr<ThrottledTextureUploader> uploader = ThrottledTextureUploader::create(fakeContext.get()); scoped_ptr<CCPrioritizedTexture> texture = CCPrioritizedTexture::create(NULL, IntSize(256, 256), GL_RGBA); diff --git a/cc/time_source.h b/cc/time_source.h index 6f24d35..778be8cd 100644 --- a/cc/time_source.h +++ b/cc/time_source.h @@ -5,8 +5,8 @@ #ifndef CCTimeSource_h #define CCTimeSource_h +#include "base/memory/ref_counted.h" #include "base/time.h" -#include <wtf/RefCounted.h> namespace cc { @@ -25,16 +25,21 @@ protected: // // Be sure to call setActive(false) before releasing your reference to the // timer, or it will keep on ticking! -class CCTimeSource : public RefCounted<CCTimeSource> { +class CCTimeSource : public base::RefCounted<CCTimeSource> { public: - virtual ~CCTimeSource() { } virtual void setClient(CCTimeSourceClient*) = 0; virtual void setActive(bool) = 0; virtual bool active() const = 0; virtual void setTimebaseAndInterval(base::TimeTicks timebase, base::TimeDelta interval) = 0; virtual base::TimeTicks lastTickTime() = 0; virtual base::TimeTicks nextTickTime() = 0; + +protected: + virtual ~CCTimeSource() { } + +private: + friend class base::RefCounted<CCTimeSource>; }; } -#endif // CCSmoothedTimer_h +#endif // CCTimeSource_h |