Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(188)

Side by Side Diff: cc/layer_tree_host_impl.h

Issue 12519006: cc:: Add RenderingStatsInstrumentation to manage collection of RenderingStats (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Early out in methods, pass raw pointers, updated tests Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CC_LAYER_TREE_HOST_IMPL_H_ 5 #ifndef CC_LAYER_TREE_HOST_IMPL_H_
6 #define CC_LAYER_TREE_HOST_IMPL_H_ 6 #define CC_LAYER_TREE_HOST_IMPL_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/time.h" 10 #include "base/time.h"
11 #include "cc/animation_events.h" 11 #include "cc/animation_events.h"
12 #include "cc/animation_registrar.h" 12 #include "cc/animation_registrar.h"
13 #include "cc/cc_export.h" 13 #include "cc/cc_export.h"
14 #include "cc/input_handler.h" 14 #include "cc/input_handler.h"
15 #include "cc/output_surface_client.h" 15 #include "cc/output_surface_client.h"
16 #include "cc/render_pass.h" 16 #include "cc/render_pass.h"
17 #include "cc/render_pass_sink.h" 17 #include "cc/render_pass_sink.h"
18 #include "cc/renderer.h" 18 #include "cc/renderer.h"
19 #include "cc/rendering_stats_recorder.h"
19 #include "cc/tile_manager.h" 20 #include "cc/tile_manager.h"
20 #include "cc/top_controls_manager_client.h" 21 #include "cc/top_controls_manager_client.h"
21 #include "skia/ext/refptr.h" 22 #include "skia/ext/refptr.h"
22 #include "third_party/skia/include/core/SkColor.h" 23 #include "third_party/skia/include/core/SkColor.h"
23 #include "third_party/skia/include/core/SkPicture.h" 24 #include "third_party/skia/include/core/SkPicture.h"
24 #include "ui/gfx/rect.h" 25 #include "ui/gfx/rect.h"
25 26
26 namespace cc { 27 namespace cc {
27 28
28 class CompletionEvent; 29 class CompletionEvent;
29 class CompositorFrameMetadata; 30 class CompositorFrameMetadata;
30 class DebugRectHistory; 31 class DebugRectHistory;
31 class FrameRateCounter; 32 class FrameRateCounter;
32 class LayerImpl; 33 class LayerImpl;
33 class LayerTreeHostImplTimeSourceAdapter; 34 class LayerTreeHostImplTimeSourceAdapter;
34 class LayerTreeImpl; 35 class LayerTreeImpl;
35 class PageScaleAnimation; 36 class PageScaleAnimation;
36 class PaintTimeCounter; 37 class PaintTimeCounter;
37 class MemoryHistory; 38 class MemoryHistory;
38 class RenderPassDrawQuad; 39 class RenderPassDrawQuad;
39 class ResourceProvider; 40 class ResourceProvider;
40 class TopControlsManager; 41 class TopControlsManager;
41 struct RendererCapabilities; 42 struct RendererCapabilities;
42 struct RenderingStats;
43 43
44 // LayerTreeHost->Proxy callback interface. 44 // LayerTreeHost->Proxy callback interface.
45 class LayerTreeHostImplClient { 45 class LayerTreeHostImplClient {
46 public: 46 public:
47 virtual void didLoseOutputSurfaceOnImplThread() = 0; 47 virtual void didLoseOutputSurfaceOnImplThread() = 0;
48 virtual void onSwapBuffersCompleteOnImplThread() = 0; 48 virtual void onSwapBuffersCompleteOnImplThread() = 0;
49 virtual void onVSyncParametersChanged(base::TimeTicks timebase, base::TimeDe lta interval) = 0; 49 virtual void onVSyncParametersChanged(base::TimeTicks timebase, base::TimeDe lta interval) = 0;
50 virtual void onCanDrawStateChanged(bool canDraw) = 0; 50 virtual void onCanDrawStateChanged(bool canDraw) = 0;
51 virtual void onHasPendingTreeStateChanged(bool hasPendingTree) = 0; 51 virtual void onHasPendingTreeStateChanged(bool hasPendingTree) = 0;
52 virtual void setNeedsRedrawOnImplThread() = 0; 52 virtual void setNeedsRedrawOnImplThread() = 0;
(...skipping 11 matching lines...) Expand all
64 64
65 // LayerTreeHostImpl owns the LayerImpl tree as well as associated rendering sta te 65 // LayerTreeHostImpl owns the LayerImpl tree as well as associated rendering sta te
66 class CC_EXPORT LayerTreeHostImpl : public InputHandlerClient, 66 class CC_EXPORT LayerTreeHostImpl : public InputHandlerClient,
67 public RendererClient, 67 public RendererClient,
68 public TileManagerClient, 68 public TileManagerClient,
69 public OutputSurfaceClient, 69 public OutputSurfaceClient,
70 public TopControlsManagerClient { 70 public TopControlsManagerClient {
71 typedef std::vector<LayerImpl*> LayerList; 71 typedef std::vector<LayerImpl*> LayerList;
72 72
73 public: 73 public:
74 static scoped_ptr<LayerTreeHostImpl> create(const LayerTreeSettings&, LayerT reeHostImplClient*, Proxy*); 74 static scoped_ptr<LayerTreeHostImpl> create(const LayerTreeSettings&, LayerT reeHostImplClient*, Proxy*, RenderingStatsRecorder*);
75 virtual ~LayerTreeHostImpl(); 75 virtual ~LayerTreeHostImpl();
76 76
77 // InputHandlerClient implementation 77 // InputHandlerClient implementation
78 virtual InputHandlerClient::ScrollStatus scrollBegin(gfx::Point, InputHandle rClient::ScrollInputType) OVERRIDE; 78 virtual InputHandlerClient::ScrollStatus scrollBegin(gfx::Point, InputHandle rClient::ScrollInputType) OVERRIDE;
79 virtual bool scrollBy(const gfx::Point&, const gfx::Vector2dF&) OVERRIDE; 79 virtual bool scrollBy(const gfx::Point&, const gfx::Vector2dF&) OVERRIDE;
80 virtual void scrollEnd() OVERRIDE; 80 virtual void scrollEnd() OVERRIDE;
81 virtual void pinchGestureBegin() OVERRIDE; 81 virtual void pinchGestureBegin() OVERRIDE;
82 virtual void pinchGestureUpdate(float, gfx::Point) OVERRIDE; 82 virtual void pinchGestureUpdate(float, gfx::Point) OVERRIDE;
83 virtual void pinchGestureEnd() OVERRIDE; 83 virtual void pinchGestureEnd() OVERRIDE;
84 virtual void startPageScaleAnimation(gfx::Vector2d targetOffset, bool anchor Point, float pageScale, base::TimeTicks startTime, base::TimeDelta duration) OVE RRIDE; 84 virtual void startPageScaleAnimation(gfx::Vector2d targetOffset, bool anchor Point, float pageScale, base::TimeTicks startTime, base::TimeDelta duration) OVE RRIDE;
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 190
191 float deviceScaleFactor() const { return m_deviceScaleFactor; } 191 float deviceScaleFactor() const { return m_deviceScaleFactor; }
192 void setDeviceScaleFactor(float); 192 void setDeviceScaleFactor(float);
193 193
194 scoped_ptr<ScrollAndScaleSet> processScrollDeltas(); 194 scoped_ptr<ScrollAndScaleSet> processScrollDeltas();
195 195
196 void startPageScaleAnimation(gfx::Vector2d targetOffset, bool useAnchor, flo at scale, base::TimeDelta duration); 196 void startPageScaleAnimation(gfx::Vector2d targetOffset, bool useAnchor, flo at scale, base::TimeDelta duration);
197 197
198 bool needsAnimateLayers() const { return !m_animationRegistrar->active_anima tion_controllers().empty(); } 198 bool needsAnimateLayers() const { return !m_animationRegistrar->active_anima tion_controllers().empty(); }
199 199
200 void renderingStats(RenderingStats*) const;
201
202 void sendManagedMemoryStats( 200 void sendManagedMemoryStats(
203 size_t memoryVisibleBytes, 201 size_t memoryVisibleBytes,
204 size_t memoryVisibleAndNearbyBytes, 202 size_t memoryVisibleAndNearbyBytes,
205 size_t memoryUseBytes); 203 size_t memoryUseBytes);
206 204
207 FrameRateCounter* fpsCounter() const { return m_fpsCounter.get(); } 205 FrameRateCounter* fpsCounter() const { return m_fpsCounter.get(); }
208 PaintTimeCounter* paintTimeCounter() const { return m_paintTimeCounter.get() ; } 206 PaintTimeCounter* paintTimeCounter() const { return m_paintTimeCounter.get() ; }
209 MemoryHistory* memoryHistory() const { return m_memoryHistory.get(); } 207 MemoryHistory* memoryHistory() const { return m_memoryHistory.get(); }
210 DebugRectHistory* debugRectHistory() const { return m_debugRectHistory.get() ; } 208 DebugRectHistory* debugRectHistory() const { return m_debugRectHistory.get() ; }
211 ResourceProvider* resourceProvider() const { return m_resourceProvider.get() ; } 209 ResourceProvider* resourceProvider() const { return m_resourceProvider.get() ; }
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 void beginNextFrame(); 257 void beginNextFrame();
260 base::TimeTicks currentFrameTime(); 258 base::TimeTicks currentFrameTime();
261 259
262 scoped_ptr<base::Value> asValue() const; 260 scoped_ptr<base::Value> asValue() const;
263 scoped_ptr<base::Value> activationStateAsValue() const; 261 scoped_ptr<base::Value> activationStateAsValue() const;
264 scoped_ptr<base::Value> frameStateAsValue() const; 262 scoped_ptr<base::Value> frameStateAsValue() const;
265 263
266 bool pageScaleAnimationActive() const { return !!m_pageScaleAnimation; } 264 bool pageScaleAnimationActive() const { return !!m_pageScaleAnimation; }
267 265
268 protected: 266 protected:
269 LayerTreeHostImpl(const LayerTreeSettings&, LayerTreeHostImplClient*, Proxy* ); 267 LayerTreeHostImpl(const LayerTreeSettings&, LayerTreeHostImplClient*, Proxy* , RenderingStatsRecorder*);
egraether 2013/03/12 19:31:42 Passing to the constructor needs more changes in t
270 void activatePendingTree(); 268 void activatePendingTree();
271 269
272 // Virtual for testing. 270 // Virtual for testing.
273 virtual void animateLayers(base::TimeTicks monotonicTime, base::Time wallClo ckTime); 271 virtual void animateLayers(base::TimeTicks monotonicTime, base::Time wallClo ckTime);
274 virtual void updateAnimationState(); 272 virtual void updateAnimationState();
275 273
276 // Virtual for testing. 274 // Virtual for testing.
277 virtual base::TimeDelta lowFrequencyAnimationInterval() const; 275 virtual base::TimeDelta lowFrequencyAnimationInterval() const;
278 276
279 const AnimationRegistrar::AnimationControllerMap& activeAnimationControllers () const { return m_animationRegistrar->active_animation_controllers(); } 277 const AnimationRegistrar::AnimationControllerMap& activeAnimationControllers () const { return m_animationRegistrar->active_animation_controllers(); }
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 scoped_ptr<PageScaleAnimation> m_pageScaleAnimation; 346 scoped_ptr<PageScaleAnimation> m_pageScaleAnimation;
349 347
350 // This is used for ticking animations slowly when hidden. 348 // This is used for ticking animations slowly when hidden.
351 scoped_ptr<LayerTreeHostImplTimeSourceAdapter> m_timeSourceClientAdapter; 349 scoped_ptr<LayerTreeHostImplTimeSourceAdapter> m_timeSourceClientAdapter;
352 350
353 scoped_ptr<FrameRateCounter> m_fpsCounter; 351 scoped_ptr<FrameRateCounter> m_fpsCounter;
354 scoped_ptr<PaintTimeCounter> m_paintTimeCounter; 352 scoped_ptr<PaintTimeCounter> m_paintTimeCounter;
355 scoped_ptr<MemoryHistory> m_memoryHistory; 353 scoped_ptr<MemoryHistory> m_memoryHistory;
356 scoped_ptr<DebugRectHistory> m_debugRectHistory; 354 scoped_ptr<DebugRectHistory> m_debugRectHistory;
357 355
358 int64 m_numImplThreadScrolls;
359 int64 m_numMainThreadScrolls;
360
361 int64 m_cumulativeNumLayersDrawn;
362
363 int64 m_cumulativeNumMissingTiles;
364
365 size_t m_lastSentMemoryVisibleBytes; 356 size_t m_lastSentMemoryVisibleBytes;
366 size_t m_lastSentMemoryVisibleAndNearbyBytes; 357 size_t m_lastSentMemoryVisibleAndNearbyBytes;
367 size_t m_lastSentMemoryUseBytes; 358 size_t m_lastSentMemoryUseBytes;
368 359
369 base::TimeTicks m_currentFrameTime; 360 base::TimeTicks m_currentFrameTime;
370 361
371 scoped_ptr<AnimationRegistrar> m_animationRegistrar; 362 scoped_ptr<AnimationRegistrar> m_animationRegistrar;
372 363
364 RenderingStatsRecorder* m_renderingStatsRecorder;
365
373 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); 366 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl);
374 }; 367 };
375 368
376 } // namespace cc 369 } // namespace cc
377 370
378 #endif // CC_LAYER_TREE_HOST_IMPL_H_ 371 #endif // CC_LAYER_TREE_HOST_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698