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_TREES_LAYER_TREE_HOST_IMPL_H_ | 5 #ifndef CC_TREES_LAYER_TREE_HOST_IMPL_H_ |
6 #define CC_TREES_LAYER_TREE_HOST_IMPL_H_ | 6 #define CC_TREES_LAYER_TREE_HOST_IMPL_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 13 matching lines...) Expand all Loading... |
24 #include "cc/input/top_controls_manager_client.h" | 24 #include "cc/input/top_controls_manager_client.h" |
25 #include "cc/layers/layer_lists.h" | 25 #include "cc/layers/layer_lists.h" |
26 #include "cc/layers/render_pass_sink.h" | 26 #include "cc/layers/render_pass_sink.h" |
27 #include "cc/output/begin_frame_args.h" | 27 #include "cc/output/begin_frame_args.h" |
28 #include "cc/output/managed_memory_policy.h" | 28 #include "cc/output/managed_memory_policy.h" |
29 #include "cc/output/output_surface_client.h" | 29 #include "cc/output/output_surface_client.h" |
30 #include "cc/output/renderer.h" | 30 #include "cc/output/renderer.h" |
31 #include "cc/quads/render_pass.h" | 31 #include "cc/quads/render_pass.h" |
32 #include "cc/resources/resource_provider.h" | 32 #include "cc/resources/resource_provider.h" |
33 #include "cc/resources/tile_manager.h" | 33 #include "cc/resources/tile_manager.h" |
| 34 #include "cc/scheduler/begin_frame_source.h" |
34 #include "cc/scheduler/draw_result.h" | 35 #include "cc/scheduler/draw_result.h" |
35 #include "skia/ext/refptr.h" | 36 #include "skia/ext/refptr.h" |
36 #include "third_party/skia/include/core/SkColor.h" | 37 #include "third_party/skia/include/core/SkColor.h" |
37 #include "ui/gfx/rect.h" | 38 #include "ui/gfx/rect.h" |
38 | 39 |
39 namespace cc { | 40 namespace cc { |
40 | 41 |
41 class CompletionEvent; | 42 class CompletionEvent; |
42 class CompositorFrameMetadata; | 43 class CompositorFrameMetadata; |
43 class DebugRectHistory; | 44 class DebugRectHistory; |
(...skipping 22 matching lines...) Expand all Loading... |
66 class LayerTreeHostImplClient { | 67 class LayerTreeHostImplClient { |
67 public: | 68 public: |
68 virtual void UpdateRendererCapabilitiesOnImplThread() = 0; | 69 virtual void UpdateRendererCapabilitiesOnImplThread() = 0; |
69 virtual void DidLoseOutputSurfaceOnImplThread() = 0; | 70 virtual void DidLoseOutputSurfaceOnImplThread() = 0; |
70 virtual void CommitVSyncParameters(base::TimeTicks timebase, | 71 virtual void CommitVSyncParameters(base::TimeTicks timebase, |
71 base::TimeDelta interval) = 0; | 72 base::TimeDelta interval) = 0; |
72 virtual void SetEstimatedParentDrawTime(base::TimeDelta draw_time) = 0; | 73 virtual void SetEstimatedParentDrawTime(base::TimeDelta draw_time) = 0; |
73 virtual void SetMaxSwapsPendingOnImplThread(int max) = 0; | 74 virtual void SetMaxSwapsPendingOnImplThread(int max) = 0; |
74 virtual void DidSwapBuffersOnImplThread() = 0; | 75 virtual void DidSwapBuffersOnImplThread() = 0; |
75 virtual void DidSwapBuffersCompleteOnImplThread() = 0; | 76 virtual void DidSwapBuffersCompleteOnImplThread() = 0; |
76 virtual void BeginFrame(const BeginFrameArgs& args) = 0; | |
77 virtual void OnCanDrawStateChanged(bool can_draw) = 0; | 77 virtual void OnCanDrawStateChanged(bool can_draw) = 0; |
78 virtual void NotifyReadyToActivate() = 0; | 78 virtual void NotifyReadyToActivate() = 0; |
79 // Please call these 3 functions through | 79 // Please call these 3 functions through |
80 // LayerTreeHostImpl's SetNeedsRedraw(), SetNeedsRedrawRect() and | 80 // LayerTreeHostImpl's SetNeedsRedraw(), SetNeedsRedrawRect() and |
81 // SetNeedsAnimate(). | 81 // SetNeedsAnimate(). |
82 virtual void SetNeedsRedrawOnImplThread() = 0; | 82 virtual void SetNeedsRedrawOnImplThread() = 0; |
83 virtual void SetNeedsRedrawRectOnImplThread(const gfx::Rect& damage_rect) = 0; | 83 virtual void SetNeedsRedrawRectOnImplThread(const gfx::Rect& damage_rect) = 0; |
84 virtual void SetNeedsAnimateOnImplThread() = 0; | 84 virtual void SetNeedsAnimateOnImplThread() = 0; |
85 virtual void DidInitializeVisibleTileOnImplThread() = 0; | 85 virtual void DidInitializeVisibleTileOnImplThread() = 0; |
86 virtual void SetNeedsCommitOnImplThread() = 0; | 86 virtual void SetNeedsCommitOnImplThread() = 0; |
(...skipping 18 matching lines...) Expand all Loading... |
105 | 105 |
106 // LayerTreeHostImpl owns the LayerImpl trees as well as associated rendering | 106 // LayerTreeHostImpl owns the LayerImpl trees as well as associated rendering |
107 // state. | 107 // state. |
108 class CC_EXPORT LayerTreeHostImpl | 108 class CC_EXPORT LayerTreeHostImpl |
109 : public InputHandler, | 109 : public InputHandler, |
110 public RendererClient, | 110 public RendererClient, |
111 public TileManagerClient, | 111 public TileManagerClient, |
112 public OutputSurfaceClient, | 112 public OutputSurfaceClient, |
113 public TopControlsManagerClient, | 113 public TopControlsManagerClient, |
114 public ScrollbarAnimationControllerClient, | 114 public ScrollbarAnimationControllerClient, |
| 115 public BeginFrameSource, |
115 public base::SupportsWeakPtr<LayerTreeHostImpl> { | 116 public base::SupportsWeakPtr<LayerTreeHostImpl> { |
116 public: | 117 public: |
117 static scoped_ptr<LayerTreeHostImpl> Create( | 118 static scoped_ptr<LayerTreeHostImpl> Create( |
118 const LayerTreeSettings& settings, | 119 const LayerTreeSettings& settings, |
119 LayerTreeHostImplClient* client, | 120 LayerTreeHostImplClient* client, |
120 Proxy* proxy, | 121 Proxy* proxy, |
121 RenderingStatsInstrumentation* rendering_stats_instrumentation, | 122 RenderingStatsInstrumentation* rendering_stats_instrumentation, |
122 SharedBitmapManager* manager, | 123 SharedBitmapManager* manager, |
123 int id); | 124 int id); |
124 virtual ~LayerTreeHostImpl(); | 125 virtual ~LayerTreeHostImpl(); |
125 | 126 |
| 127 // BeginFrameSource implementation |
| 128 virtual bool NeedsBeginFrames() const OVERRIDE; |
| 129 virtual void SetNeedsBeginFrames(bool needs_begin_frames) OVERRIDE; |
| 130 virtual void DidFinishFrame(size_t remaining_frames) OVERRIDE{}; |
| 131 |
126 // InputHandler implementation | 132 // InputHandler implementation |
127 virtual void BindToClient(InputHandlerClient* client) OVERRIDE; | 133 virtual void BindToClient(InputHandlerClient* client) OVERRIDE; |
128 virtual InputHandler::ScrollStatus ScrollBegin( | 134 virtual InputHandler::ScrollStatus ScrollBegin( |
129 const gfx::Point& viewport_point, | 135 const gfx::Point& viewport_point, |
130 InputHandler::ScrollInputType type) OVERRIDE; | 136 InputHandler::ScrollInputType type) OVERRIDE; |
131 virtual InputHandler::ScrollStatus ScrollAnimated( | 137 virtual InputHandler::ScrollStatus ScrollAnimated( |
132 const gfx::Point& viewport_point, | 138 const gfx::Point& viewport_point, |
133 const gfx::Vector2dF& scroll_delta) OVERRIDE; | 139 const gfx::Vector2dF& scroll_delta) OVERRIDE; |
134 virtual bool ScrollBy(const gfx::Point& viewport_point, | 140 virtual bool ScrollBy(const gfx::Point& viewport_point, |
135 const gfx::Vector2dF& scroll_delta) OVERRIDE; | 141 const gfx::Vector2dF& scroll_delta) OVERRIDE; |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 void SetUseGpuRasterization(bool use_gpu); | 295 void SetUseGpuRasterization(bool use_gpu); |
290 bool use_gpu_rasterization() const { return use_gpu_rasterization_; } | 296 bool use_gpu_rasterization() const { return use_gpu_rasterization_; } |
291 bool create_low_res_tiling() const { | 297 bool create_low_res_tiling() const { |
292 return settings_.create_low_res_tiling && !use_gpu_rasterization_; | 298 return settings_.create_low_res_tiling && !use_gpu_rasterization_; |
293 } | 299 } |
294 ResourcePool* resource_pool() { return resource_pool_.get(); } | 300 ResourcePool* resource_pool() { return resource_pool_.get(); } |
295 Renderer* renderer() { return renderer_.get(); } | 301 Renderer* renderer() { return renderer_.get(); } |
296 const RendererCapabilitiesImpl& GetRendererCapabilities() const; | 302 const RendererCapabilitiesImpl& GetRendererCapabilities() const; |
297 | 303 |
298 virtual bool SwapBuffers(const FrameData& frame); | 304 virtual bool SwapBuffers(const FrameData& frame); |
299 void SetNeedsBeginFrame(bool enable); | |
300 virtual void WillBeginImplFrame(const BeginFrameArgs& args); | 305 virtual void WillBeginImplFrame(const BeginFrameArgs& args); |
301 void DidModifyTilePriorities(); | 306 void DidModifyTilePriorities(); |
302 | 307 |
303 LayerTreeImpl* active_tree() { return active_tree_.get(); } | 308 LayerTreeImpl* active_tree() { return active_tree_.get(); } |
304 const LayerTreeImpl* active_tree() const { return active_tree_.get(); } | 309 const LayerTreeImpl* active_tree() const { return active_tree_.get(); } |
305 LayerTreeImpl* pending_tree() { return pending_tree_.get(); } | 310 LayerTreeImpl* pending_tree() { return pending_tree_.get(); } |
306 const LayerTreeImpl* pending_tree() const { return pending_tree_.get(); } | 311 const LayerTreeImpl* pending_tree() const { return pending_tree_.get(); } |
307 LayerTreeImpl* recycle_tree() { return recycle_tree_.get(); } | 312 LayerTreeImpl* recycle_tree() { return recycle_tree_.get(); } |
308 const LayerTreeImpl* recycle_tree() const { return recycle_tree_.get(); } | 313 const LayerTreeImpl* recycle_tree() const { return recycle_tree_.get(); } |
309 // Returns the tree LTH synchronizes with. | 314 // Returns the tree LTH synchronizes with. |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
421 | 426 |
422 void UpdateCurrentBeginFrameArgs(const BeginFrameArgs& args); | 427 void UpdateCurrentBeginFrameArgs(const BeginFrameArgs& args); |
423 void ResetCurrentBeginFrameArgsForNextFrame(); | 428 void ResetCurrentBeginFrameArgsForNextFrame(); |
424 virtual BeginFrameArgs CurrentBeginFrameArgs() const; | 429 virtual BeginFrameArgs CurrentBeginFrameArgs() const; |
425 | 430 |
426 // Expected time between two begin impl frame calls. | 431 // Expected time between two begin impl frame calls. |
427 base::TimeDelta begin_impl_frame_interval() const { | 432 base::TimeDelta begin_impl_frame_interval() const { |
428 return begin_impl_frame_interval_; | 433 return begin_impl_frame_interval_; |
429 } | 434 } |
430 | 435 |
431 void AsValueInto(base::debug::TracedValue* value) const { | 436 virtual void AsValueInto(base::debug::TracedValue* value) const OVERRIDE; |
432 return AsValueWithFrameInto(NULL, value); | |
433 } | |
434 void AsValueWithFrameInto(FrameData* frame, | 437 void AsValueWithFrameInto(FrameData* frame, |
435 base::debug::TracedValue* value) const; | 438 base::debug::TracedValue* value) const; |
436 scoped_refptr<base::debug::ConvertableToTraceFormat> AsValue() const; | 439 scoped_refptr<base::debug::ConvertableToTraceFormat> AsValue() const; |
437 scoped_refptr<base::debug::ConvertableToTraceFormat> AsValueWithFrame( | 440 scoped_refptr<base::debug::ConvertableToTraceFormat> AsValueWithFrame( |
438 FrameData* frame) const; | 441 FrameData* frame) const; |
439 scoped_refptr<base::debug::ConvertableToTraceFormat> ActivationStateAsValue() | 442 scoped_refptr<base::debug::ConvertableToTraceFormat> ActivationStateAsValue() |
440 const; | 443 const; |
441 void ActivationStateAsValueInto(base::debug::TracedValue* value) const; | 444 void ActivationStateAsValueInto(base::debug::TracedValue* value) const; |
442 | 445 |
443 bool page_scale_animation_active() const { return !!page_scale_animation_; } | 446 bool page_scale_animation_active() const { return !!page_scale_animation_; } |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
503 | 506 |
504 const AnimationRegistrar::AnimationControllerMap& | 507 const AnimationRegistrar::AnimationControllerMap& |
505 active_animation_controllers() const { | 508 active_animation_controllers() const { |
506 return animation_registrar_->active_animation_controllers(); | 509 return animation_registrar_->active_animation_controllers(); |
507 } | 510 } |
508 | 511 |
509 bool manage_tiles_needed() const { return tile_priorities_dirty_; } | 512 bool manage_tiles_needed() const { return tile_priorities_dirty_; } |
510 | 513 |
511 LayerTreeHostImplClient* client_; | 514 LayerTreeHostImplClient* client_; |
512 Proxy* proxy_; | 515 Proxy* proxy_; |
| 516 bool needs_begin_frames_; |
513 | 517 |
514 private: | 518 private: |
515 void CreateAndSetRenderer(); | 519 void CreateAndSetRenderer(); |
516 void CreateAndSetTileManager(); | 520 void CreateAndSetTileManager(); |
517 void DestroyTileManager(); | 521 void DestroyTileManager(); |
518 void ReleaseTreeResources(); | 522 void ReleaseTreeResources(); |
519 void EnforceZeroBudget(bool zero_budget); | 523 void EnforceZeroBudget(bool zero_budget); |
520 | 524 |
521 bool UsePendingTreeForSync() const; | 525 bool UsePendingTreeForSync() const; |
522 bool UseZeroCopyRasterizer() const; | 526 bool UseZeroCopyRasterizer() const; |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
700 | 704 |
701 std::vector<PictureLayerImpl*> picture_layers_; | 705 std::vector<PictureLayerImpl*> picture_layers_; |
702 std::vector<PictureLayerImpl::Pair> picture_layer_pairs_; | 706 std::vector<PictureLayerImpl::Pair> picture_layer_pairs_; |
703 | 707 |
704 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); | 708 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); |
705 }; | 709 }; |
706 | 710 |
707 } // namespace cc | 711 } // namespace cc |
708 | 712 |
709 #endif // CC_TREES_LAYER_TREE_HOST_IMPL_H_ | 713 #endif // CC_TREES_LAYER_TREE_HOST_IMPL_H_ |
OLD | NEW |