| OLD | NEW |
| 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_instrumentation.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, | 49 virtual void OnVSyncParametersChanged(base::TimeTicks timebase, |
| 50 base::TimeDelta interval) = 0; | 50 base::TimeDelta interval) = 0; |
| 51 virtual void OnCanDrawStateChanged(bool can_draw) = 0; | 51 virtual void OnCanDrawStateChanged(bool can_draw) = 0; |
| 52 virtual void OnHasPendingTreeStateChanged(bool has_pending_tree) = 0; | 52 virtual void OnHasPendingTreeStateChanged(bool has_pending_tree) = 0; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 73 public RendererClient, | 73 public RendererClient, |
| 74 public TileManagerClient, | 74 public TileManagerClient, |
| 75 public OutputSurfaceClient, | 75 public OutputSurfaceClient, |
| 76 public TopControlsManagerClient { | 76 public TopControlsManagerClient { |
| 77 typedef std::vector<LayerImpl*> LayerList; | 77 typedef std::vector<LayerImpl*> LayerList; |
| 78 | 78 |
| 79 public: | 79 public: |
| 80 static scoped_ptr<LayerTreeHostImpl> Create( | 80 static scoped_ptr<LayerTreeHostImpl> Create( |
| 81 const LayerTreeSettings& settings, | 81 const LayerTreeSettings& settings, |
| 82 LayerTreeHostImplClient* client, | 82 LayerTreeHostImplClient* client, |
| 83 Proxy* proxy); | 83 Proxy* proxy, |
| 84 RenderingStatsInstrumentation* rendering_stats_instrumentation); |
| 84 virtual ~LayerTreeHostImpl(); | 85 virtual ~LayerTreeHostImpl(); |
| 85 | 86 |
| 86 // InputHandlerClient implementation | 87 // InputHandlerClient implementation |
| 87 virtual InputHandlerClient::ScrollStatus ScrollBegin( | 88 virtual InputHandlerClient::ScrollStatus ScrollBegin( |
| 88 gfx::Point viewport_point, | 89 gfx::Point viewport_point, |
| 89 InputHandlerClient::ScrollInputType type) OVERRIDE; | 90 InputHandlerClient::ScrollInputType type) OVERRIDE; |
| 90 virtual bool ScrollBy(gfx::Point viewport_point, | 91 virtual bool ScrollBy(gfx::Point viewport_point, |
| 91 gfx::Vector2dF scroll_delta) OVERRIDE; | 92 gfx::Vector2dF scroll_delta) OVERRIDE; |
| 92 virtual void ScrollEnd() OVERRIDE; | 93 virtual void ScrollEnd() OVERRIDE; |
| 93 virtual void PinchGestureBegin() OVERRIDE; | 94 virtual void PinchGestureBegin() OVERRIDE; |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 | 225 |
| 225 void StartPageScaleAnimation(gfx::Vector2d target_offset, | 226 void StartPageScaleAnimation(gfx::Vector2d target_offset, |
| 226 bool use_anchor, | 227 bool use_anchor, |
| 227 float scale, | 228 float scale, |
| 228 base::TimeDelta duration); | 229 base::TimeDelta duration); |
| 229 | 230 |
| 230 bool needs_animate_layers() const { | 231 bool needs_animate_layers() const { |
| 231 return !animation_registrar_->active_animation_controllers().empty(); | 232 return !animation_registrar_->active_animation_controllers().empty(); |
| 232 } | 233 } |
| 233 | 234 |
| 234 void CollectRenderingStats(RenderingStats* stats) const; | |
| 235 | |
| 236 void SendManagedMemoryStats( | 235 void SendManagedMemoryStats( |
| 237 size_t memory_visible_bytes, | 236 size_t memory_visible_bytes, |
| 238 size_t memory_visible_and_nearby_bytes, | 237 size_t memory_visible_and_nearby_bytes, |
| 239 size_t memoryUseBytes); | 238 size_t memoryUseBytes); |
| 240 | 239 |
| 241 FrameRateCounter* fps_counter() { | 240 FrameRateCounter* fps_counter() { |
| 242 return fps_counter_.get(); | 241 return fps_counter_.get(); |
| 243 } | 242 } |
| 244 PaintTimeCounter* paint_time_counter() { | 243 PaintTimeCounter* paint_time_counter() { |
| 245 return paint_time_counter_.get(); | 244 return paint_time_counter_.get(); |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 void BeginNextFrame(); | 314 void BeginNextFrame(); |
| 316 base::TimeTicks CurrentFrameTime(); | 315 base::TimeTicks CurrentFrameTime(); |
| 317 | 316 |
| 318 scoped_ptr<base::Value> AsValue() const; | 317 scoped_ptr<base::Value> AsValue() const; |
| 319 scoped_ptr<base::Value> ActivationStateAsValue() const; | 318 scoped_ptr<base::Value> ActivationStateAsValue() const; |
| 320 scoped_ptr<base::Value> FrameStateAsValue() const; | 319 scoped_ptr<base::Value> FrameStateAsValue() const; |
| 321 | 320 |
| 322 bool page_scale_animation_active() const { return !!page_scale_animation_; } | 321 bool page_scale_animation_active() const { return !!page_scale_animation_; } |
| 323 | 322 |
| 324 protected: | 323 protected: |
| 325 LayerTreeHostImpl(const LayerTreeSettings& settings, | 324 LayerTreeHostImpl( |
| 326 LayerTreeHostImplClient* client, | 325 const LayerTreeSettings& settings, |
| 327 Proxy* proxy); | 326 LayerTreeHostImplClient* client, |
| 327 Proxy* proxy, |
| 328 RenderingStatsInstrumentation* rendering_stats_instrumentation); |
| 328 void ActivatePendingTree(); | 329 void ActivatePendingTree(); |
| 329 | 330 |
| 330 // Virtual for testing. | 331 // Virtual for testing. |
| 331 virtual void AnimateLayers(base::TimeTicks monotonic_time, | 332 virtual void AnimateLayers(base::TimeTicks monotonic_time, |
| 332 base::Time wall_clock_time); | 333 base::Time wall_clock_time); |
| 333 virtual void UpdateAnimationState(); | 334 virtual void UpdateAnimationState(); |
| 334 | 335 |
| 335 // Virtual for testing. | 336 // Virtual for testing. |
| 336 virtual base::TimeDelta LowFrequencyAnimationInterval() const; | 337 virtual base::TimeDelta LowFrequencyAnimationInterval() const; |
| 337 | 338 |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 431 int64 cumulative_num_missing_tiles_; | 432 int64 cumulative_num_missing_tiles_; |
| 432 | 433 |
| 433 size_t last_sent_memory_visible_bytes_; | 434 size_t last_sent_memory_visible_bytes_; |
| 434 size_t last_sent_memory_visible_and_nearby_bytes_; | 435 size_t last_sent_memory_visible_and_nearby_bytes_; |
| 435 size_t last_sent_memory_use_bytes_; | 436 size_t last_sent_memory_use_bytes_; |
| 436 | 437 |
| 437 base::TimeTicks current_frame_time_; | 438 base::TimeTicks current_frame_time_; |
| 438 | 439 |
| 439 scoped_ptr<AnimationRegistrar> animation_registrar_; | 440 scoped_ptr<AnimationRegistrar> animation_registrar_; |
| 440 | 441 |
| 442 RenderingStatsInstrumentation* rendering_stats_instrumentation_; |
| 443 |
| 441 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); | 444 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); |
| 442 }; | 445 }; |
| 443 | 446 |
| 444 } // namespace cc | 447 } // namespace cc |
| 445 | 448 |
| 446 #endif // CC_LAYER_TREE_HOST_IMPL_H_ | 449 #endif // CC_LAYER_TREE_HOST_IMPL_H_ |
| OLD | NEW |