From 0023e8b1d2b5cf906e320267ab38d909b1700660 Mon Sep 17 00:00:00 2001 From: "tfarina@chromium.org" Date: Mon, 15 Oct 2012 12:52:45 +0000 Subject: cc: Remove OwnPtr from CCFrameRateCounter. Instead use scoped_ptr from base/ library. BUG=154451 R=enne@chromium.org,jamesr@chromium.org Review URL: https://codereview.chromium.org/11150007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@161850 0039d316-1c4b-4281-b951-d872f2087c98 --- cc/debug_rect_history.cc | 7 ++++++- cc/debug_rect_history.h | 9 +++------ cc/frame_rate_counter.cc | 5 +++++ cc/frame_rate_counter.h | 9 +++------ cc/layer_tree_host_impl.cc | 6 +++--- cc/layer_tree_host_impl.h | 13 +++++++------ cc/page_scale_animation.cc | 7 +++---- cc/page_scale_animation.h | 6 +++--- 8 files changed, 33 insertions(+), 29 deletions(-) (limited to 'cc') diff --git a/cc/debug_rect_history.cc b/cc/debug_rect_history.cc index 7f3c2ea..d6f6133 100644 --- a/cc/debug_rect_history.cc +++ b/cc/debug_rect_history.cc @@ -14,6 +14,11 @@ namespace cc { +// static +scoped_ptr CCDebugRectHistory::create() { + return make_scoped_ptr(new CCDebugRectHistory()); +} + CCDebugRectHistory::CCDebugRectHistory() { } @@ -115,6 +120,6 @@ void CCDebugRectHistory::saveOccludingRects(const Vector& occludingRect m_debugRects.append(CCDebugRect(OccludingRectType, occludingRects[i])); } -} // namespace cc +} // namespace cc #endif // USE(ACCELERATED_COMPOSITING) diff --git a/cc/debug_rect_history.h b/cc/debug_rect_history.h index 1b03f34..d9ca449 100644 --- a/cc/debug_rect_history.h +++ b/cc/debug_rect_history.h @@ -8,9 +8,9 @@ #if USE(ACCELERATED_COMPOSITING) #include "base/basictypes.h" +#include "base/memory/scoped_ptr.h" #include "FloatRect.h" #include "IntRect.h" -#include #include #include @@ -54,10 +54,7 @@ struct CCDebugRect { // the appropriate CCLayerTreeSettings are enabled. class CCDebugRectHistory { public: - static PassOwnPtr create() - { - return adoptPtr(new CCDebugRectHistory()); - } + static scoped_ptr create(); ~CCDebugRectHistory(); @@ -80,7 +77,7 @@ private: DISALLOW_COPY_AND_ASSIGN(CCDebugRectHistory); }; -} // namespace cc +} // namespace cc #endif // USE(ACCELERATED_COMPOSITING) diff --git a/cc/frame_rate_counter.cc b/cc/frame_rate_counter.cc index d30aeed..e145c87 100644 --- a/cc/frame_rate_counter.cc +++ b/cc/frame_rate_counter.cc @@ -24,6 +24,11 @@ static inline int safeMod(int number, int modulus) return (number + modulus) % modulus; } +// static +scoped_ptr CCFrameRateCounter::create() { + return make_scoped_ptr(new CCFrameRateCounter()); +} + inline base::TimeDelta CCFrameRateCounter::frameInterval(int frameNumber) const { return m_timeStampHistory[frameIndex(frameNumber)] - diff --git a/cc/frame_rate_counter.h b/cc/frame_rate_counter.h index e4a954d..d3247a3 100644 --- a/cc/frame_rate_counter.h +++ b/cc/frame_rate_counter.h @@ -8,8 +8,8 @@ #if USE(ACCELERATED_COMPOSITING) #include "base/basictypes.h" +#include "base/memory/scoped_ptr.h" #include "base/time.h" -#include namespace cc { @@ -17,10 +17,7 @@ namespace cc { // intelligently compute average frames per second (and standard deviation). class CCFrameRateCounter { public: - static PassOwnPtr create() - { - return adoptPtr(new CCFrameRateCounter()); - } + static scoped_ptr create(); void markBeginningOfFrame(base::TimeTicks timestamp); void markEndOfFrame(); @@ -66,7 +63,7 @@ private: DISALLOW_COPY_AND_ASSIGN(CCFrameRateCounter); }; -} // namespace cc +} // namespace cc #endif // USE(ACCELERATED_COMPOSITING) diff --git a/cc/layer_tree_host_impl.cc b/cc/layer_tree_host_impl.cc index b738e8b..f650538 100644 --- a/cc/layer_tree_host_impl.cc +++ b/cc/layer_tree_host_impl.cc @@ -158,9 +158,9 @@ WebTransformationMatrix CCPinchZoomViewport::implTransform() const class CCLayerTreeHostImplTimeSourceAdapter : public CCTimeSourceClient { public: - static PassOwnPtr create(CCLayerTreeHostImpl* layerTreeHostImpl, PassRefPtr timeSource) + static scoped_ptr create(CCLayerTreeHostImpl* layerTreeHostImpl, PassRefPtr timeSource) { - return adoptPtr(new CCLayerTreeHostImplTimeSourceAdapter(layerTreeHostImpl, timeSource)); + return make_scoped_ptr(new CCLayerTreeHostImplTimeSourceAdapter(layerTreeHostImpl, timeSource)); } virtual ~CCLayerTreeHostImplTimeSourceAdapter() { @@ -1351,7 +1351,7 @@ void CCLayerTreeHostImpl::animatePageScale(double monotonicTime) m_client->setNeedsRedrawOnImplThread(); if (m_pageScaleAnimation->isAnimationCompleteAtTime(monotonicTime)) { - m_pageScaleAnimation.clear(); + m_pageScaleAnimation.reset(); m_client->setNeedsCommitOnImplThread(); } } diff --git a/cc/layer_tree_host_impl.h b/cc/layer_tree_host_impl.h index 297f619..3e81230 100644 --- a/cc/layer_tree_host_impl.h +++ b/cc/layer_tree_host_impl.h @@ -6,13 +6,14 @@ #define CCLayerTreeHostImpl_h #include "base/basictypes.h" +#include "base/memory/scoped_ptr.h" #include "base/time.h" #include "CCAnimationEvents.h" #include "CCInputHandler.h" #include "CCLayerSorter.h" +#include "CCRenderer.h" #include "CCRenderPass.h" #include "CCRenderPassSink.h" -#include "CCRenderer.h" #include "SkColor.h" #include #include @@ -329,10 +330,10 @@ private: bool m_pinchGestureActive; IntPoint m_previousPinchAnchor; - OwnPtr m_pageScaleAnimation; + scoped_ptr m_pageScaleAnimation; // This is used for ticking animations slowly when hidden. - OwnPtr m_timeSourceClientAdapter; + scoped_ptr m_timeSourceClientAdapter; CCLayerSorter m_layerSorter; @@ -342,8 +343,8 @@ private: CCPinchZoomViewport m_pinchZoomViewport; - OwnPtr m_fpsCounter; - OwnPtr m_debugRectHistory; + scoped_ptr m_fpsCounter; + scoped_ptr m_debugRectHistory; size_t m_numImplThreadScrolls; size_t m_numMainThreadScrolls; @@ -351,6 +352,6 @@ private: DISALLOW_COPY_AND_ASSIGN(CCLayerTreeHostImpl); }; -}; +} // namespace cc #endif diff --git a/cc/page_scale_animation.cc b/cc/page_scale_animation.cc index 12dda09..7a7ebfe 100644 --- a/cc/page_scale_animation.cc +++ b/cc/page_scale_animation.cc @@ -13,12 +13,11 @@ namespace cc { -PassOwnPtr CCPageScaleAnimation::create(const IntSize& scrollStart, float pageScaleStart, const IntSize& windowSize, const IntSize& contentSize, double startTime) +scoped_ptr CCPageScaleAnimation::create(const IntSize& scrollStart, float pageScaleStart, const IntSize& windowSize, const IntSize& contentSize, double startTime) { - return adoptPtr(new CCPageScaleAnimation(scrollStart, pageScaleStart, windowSize, contentSize, startTime)); + return make_scoped_ptr(new CCPageScaleAnimation(scrollStart, pageScaleStart, windowSize, contentSize, startTime)); } - CCPageScaleAnimation::CCPageScaleAnimation(const IntSize& scrollStart, float pageScaleStart, const IntSize& windowSize, const IntSize& contentSize, double startTime) : m_scrollStart(scrollStart) , m_pageScaleStart(pageScaleStart) @@ -156,4 +155,4 @@ float CCPageScaleAnimation::pageScaleAtRatio(float ratio) const return m_pageScaleStart * diff; } -} // namespace cc +} // namespace cc diff --git a/cc/page_scale_animation.h b/cc/page_scale_animation.h index f597026..a3634f3 100644 --- a/cc/page_scale_animation.h +++ b/cc/page_scale_animation.h @@ -5,8 +5,8 @@ #ifndef CCPageScaleAnimation_h #define CCPageScaleAnimation_h +#include "base/memory/scoped_ptr.h" #include "IntSize.h" -#include namespace cc { @@ -19,7 +19,7 @@ public: // Construct with the starting page scale and scroll offset (which is in // pageScaleStart space). The window size is the user-viewable area // in pixels. - static PassOwnPtr create(const IntSize& scrollStart, float pageScaleStart, const IntSize& windowSize, const IntSize& contentSize, double startTime); + static scoped_ptr create(const IntSize& scrollStart, float pageScaleStart, const IntSize& windowSize, const IntSize& contentSize, double startTime); // The following methods initialize the animation. Call one of them // immediately after construction to set the final scroll and page scale. @@ -69,6 +69,6 @@ private: double m_duration; }; -} // namespace cc +} // namespace cc #endif -- cgit v1.1