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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 class TopControlsManager; | 61 class TopControlsManager; |
62 class UIResourceBitmap; | 62 class UIResourceBitmap; |
63 class UIResourceRequest; | 63 class UIResourceRequest; |
64 struct RendererCapabilitiesImpl; | 64 struct RendererCapabilitiesImpl; |
65 | 65 |
66 // LayerTreeHost->Proxy callback interface. | 66 // LayerTreeHost->Proxy callback interface. |
67 class LayerTreeHostImplClient { | 67 class LayerTreeHostImplClient { |
68 public: | 68 public: |
69 virtual void UpdateRendererCapabilitiesOnImplThread() = 0; | 69 virtual void UpdateRendererCapabilitiesOnImplThread() = 0; |
70 virtual void DidLoseOutputSurfaceOnImplThread() = 0; | 70 virtual void DidLoseOutputSurfaceOnImplThread() = 0; |
71 virtual void CommitVSyncParameters(base::TimeTicks timebase, | |
72 base::TimeDelta interval) = 0; | |
73 virtual void SetEstimatedParentDrawTime(base::TimeDelta draw_time) = 0; | 71 virtual void SetEstimatedParentDrawTime(base::TimeDelta draw_time) = 0; |
74 virtual void SetMaxSwapsPendingOnImplThread(int max) = 0; | 72 virtual void SetMaxSwapsPendingOnImplThread(int max) = 0; |
75 virtual void DidSwapBuffersOnImplThread() = 0; | 73 virtual void DidSwapBuffersOnImplThread() = 0; |
76 virtual void DidSwapBuffersCompleteOnImplThread() = 0; | 74 virtual void DidSwapBuffersCompleteOnImplThread() = 0; |
77 virtual void OnCanDrawStateChanged(bool can_draw) = 0; | 75 virtual void OnCanDrawStateChanged(bool can_draw) = 0; |
78 virtual void NotifyReadyToActivate() = 0; | 76 virtual void NotifyReadyToActivate() = 0; |
79 // Please call these 3 functions through | 77 // Please call these 3 functions through |
80 // LayerTreeHostImpl's SetNeedsRedraw(), SetNeedsRedrawRect() and | 78 // LayerTreeHostImpl's SetNeedsRedraw(), SetNeedsRedrawRect() and |
81 // SetNeedsAnimate(). | 79 // SetNeedsAnimate(). |
82 virtual void SetNeedsRedrawOnImplThread() = 0; | 80 virtual void SetNeedsRedrawOnImplThread() = 0; |
(...skipping 22 matching lines...) Expand all Loading... |
105 | 103 |
106 // LayerTreeHostImpl owns the LayerImpl trees as well as associated rendering | 104 // LayerTreeHostImpl owns the LayerImpl trees as well as associated rendering |
107 // state. | 105 // state. |
108 class CC_EXPORT LayerTreeHostImpl | 106 class CC_EXPORT LayerTreeHostImpl |
109 : public InputHandler, | 107 : public InputHandler, |
110 public RendererClient, | 108 public RendererClient, |
111 public TileManagerClient, | 109 public TileManagerClient, |
112 public OutputSurfaceClient, | 110 public OutputSurfaceClient, |
113 public TopControlsManagerClient, | 111 public TopControlsManagerClient, |
114 public ScrollbarAnimationControllerClient, | 112 public ScrollbarAnimationControllerClient, |
115 public BeginFrameSource, | |
116 public base::SupportsWeakPtr<LayerTreeHostImpl> { | 113 public base::SupportsWeakPtr<LayerTreeHostImpl> { |
117 public: | 114 public: |
118 static scoped_ptr<LayerTreeHostImpl> Create( | 115 static scoped_ptr<LayerTreeHostImpl> Create( |
119 const LayerTreeSettings& settings, | 116 const LayerTreeSettings& settings, |
120 LayerTreeHostImplClient* client, | 117 LayerTreeHostImplClient* client, |
121 Proxy* proxy, | 118 Proxy* proxy, |
122 RenderingStatsInstrumentation* rendering_stats_instrumentation, | 119 RenderingStatsInstrumentation* rendering_stats_instrumentation, |
123 SharedBitmapManager* manager, | 120 SharedBitmapManager* manager, |
124 int id); | 121 int id); |
125 virtual ~LayerTreeHostImpl(); | 122 virtual ~LayerTreeHostImpl(); |
126 | 123 |
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 | |
132 // InputHandler implementation | 124 // InputHandler implementation |
133 virtual void BindToClient(InputHandlerClient* client) OVERRIDE; | 125 virtual void BindToClient(InputHandlerClient* client) OVERRIDE; |
134 virtual InputHandler::ScrollStatus ScrollBegin( | 126 virtual InputHandler::ScrollStatus ScrollBegin( |
135 const gfx::Point& viewport_point, | 127 const gfx::Point& viewport_point, |
136 InputHandler::ScrollInputType type) OVERRIDE; | 128 InputHandler::ScrollInputType type) OVERRIDE; |
137 virtual InputHandler::ScrollStatus ScrollAnimated( | 129 virtual InputHandler::ScrollStatus ScrollAnimated( |
138 const gfx::Point& viewport_point, | 130 const gfx::Point& viewport_point, |
139 const gfx::Vector2dF& scroll_delta) OVERRIDE; | 131 const gfx::Vector2dF& scroll_delta) OVERRIDE; |
140 virtual bool ScrollBy(const gfx::Point& viewport_point, | 132 virtual bool ScrollBy(const gfx::Point& viewport_point, |
141 const gfx::Vector2dF& scroll_delta) OVERRIDE; | 133 const gfx::Vector2dF& scroll_delta) OVERRIDE; |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 TreePriority tree_priority) OVERRIDE; | 242 TreePriority tree_priority) OVERRIDE; |
251 | 243 |
252 // ScrollbarAnimationControllerClient implementation. | 244 // ScrollbarAnimationControllerClient implementation. |
253 virtual void PostDelayedScrollbarFade(const base::Closure& start_fade, | 245 virtual void PostDelayedScrollbarFade(const base::Closure& start_fade, |
254 base::TimeDelta delay) OVERRIDE; | 246 base::TimeDelta delay) OVERRIDE; |
255 virtual void SetNeedsScrollbarAnimationFrame() OVERRIDE; | 247 virtual void SetNeedsScrollbarAnimationFrame() OVERRIDE; |
256 | 248 |
257 // OutputSurfaceClient implementation. | 249 // OutputSurfaceClient implementation. |
258 virtual void DeferredInitialize() OVERRIDE; | 250 virtual void DeferredInitialize() OVERRIDE; |
259 virtual void ReleaseGL() OVERRIDE; | 251 virtual void ReleaseGL() OVERRIDE; |
260 virtual void CommitVSyncParameters(base::TimeTicks timebase, | |
261 base::TimeDelta interval) OVERRIDE; | |
262 virtual void SetNeedsRedrawRect(const gfx::Rect& rect) OVERRIDE; | 252 virtual void SetNeedsRedrawRect(const gfx::Rect& rect) OVERRIDE; |
263 virtual void BeginFrame(const BeginFrameArgs& args) OVERRIDE; | |
264 | 253 |
265 virtual void SetExternalDrawConstraints( | 254 virtual void SetExternalDrawConstraints( |
266 const gfx::Transform& transform, | 255 const gfx::Transform& transform, |
267 const gfx::Rect& viewport, | 256 const gfx::Rect& viewport, |
268 const gfx::Rect& clip, | 257 const gfx::Rect& clip, |
269 const gfx::Rect& viewport_rect_for_tile_priority, | 258 const gfx::Rect& viewport_rect_for_tile_priority, |
270 const gfx::Transform& transform_for_tile_priority, | 259 const gfx::Transform& transform_for_tile_priority, |
271 bool resourceless_software_draw) OVERRIDE; | 260 bool resourceless_software_draw) OVERRIDE; |
272 virtual void DidLoseOutputSurface() OVERRIDE; | 261 virtual void DidLoseOutputSurface() OVERRIDE; |
273 virtual void DidSwapBuffers() OVERRIDE; | 262 virtual void DidSwapBuffers() OVERRIDE; |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
426 | 415 |
427 void UpdateCurrentBeginFrameArgs(const BeginFrameArgs& args); | 416 void UpdateCurrentBeginFrameArgs(const BeginFrameArgs& args); |
428 void ResetCurrentBeginFrameArgsForNextFrame(); | 417 void ResetCurrentBeginFrameArgsForNextFrame(); |
429 virtual BeginFrameArgs CurrentBeginFrameArgs() const; | 418 virtual BeginFrameArgs CurrentBeginFrameArgs() const; |
430 | 419 |
431 // Expected time between two begin impl frame calls. | 420 // Expected time between two begin impl frame calls. |
432 base::TimeDelta begin_impl_frame_interval() const { | 421 base::TimeDelta begin_impl_frame_interval() const { |
433 return begin_impl_frame_interval_; | 422 return begin_impl_frame_interval_; |
434 } | 423 } |
435 | 424 |
436 virtual void AsValueInto(base::debug::TracedValue* value) const OVERRIDE; | 425 virtual void AsValueInto(base::debug::TracedValue* value) const; |
437 void AsValueWithFrameInto(FrameData* frame, | 426 void AsValueWithFrameInto(FrameData* frame, |
438 base::debug::TracedValue* value) const; | 427 base::debug::TracedValue* value) const; |
439 scoped_refptr<base::debug::ConvertableToTraceFormat> AsValue() const; | 428 scoped_refptr<base::debug::ConvertableToTraceFormat> AsValue() const; |
440 scoped_refptr<base::debug::ConvertableToTraceFormat> AsValueWithFrame( | 429 scoped_refptr<base::debug::ConvertableToTraceFormat> AsValueWithFrame( |
441 FrameData* frame) const; | 430 FrameData* frame) const; |
442 scoped_refptr<base::debug::ConvertableToTraceFormat> ActivationStateAsValue() | 431 scoped_refptr<base::debug::ConvertableToTraceFormat> ActivationStateAsValue() |
443 const; | 432 const; |
444 void ActivationStateAsValueInto(base::debug::TracedValue* value) const; | 433 void ActivationStateAsValueInto(base::debug::TracedValue* value) const; |
445 | 434 |
446 bool page_scale_animation_active() const { return !!page_scale_animation_; } | 435 bool page_scale_animation_active() const { return !!page_scale_animation_; } |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
706 | 695 |
707 std::vector<PictureLayerImpl*> picture_layers_; | 696 std::vector<PictureLayerImpl*> picture_layers_; |
708 std::vector<PictureLayerImpl::Pair> picture_layer_pairs_; | 697 std::vector<PictureLayerImpl::Pair> picture_layer_pairs_; |
709 | 698 |
710 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); | 699 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); |
711 }; | 700 }; |
712 | 701 |
713 } // namespace cc | 702 } // namespace cc |
714 | 703 |
715 #endif // CC_TREES_LAYER_TREE_HOST_IMPL_H_ | 704 #endif // CC_TREES_LAYER_TREE_HOST_IMPL_H_ |
OLD | NEW |