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 <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 class TopControlsManager; | 47 class TopControlsManager; |
48 struct RendererCapabilities; | 48 struct RendererCapabilities; |
49 | 49 |
50 // LayerTreeHost->Proxy callback interface. | 50 // LayerTreeHost->Proxy callback interface. |
51 class LayerTreeHostImplClient { | 51 class LayerTreeHostImplClient { |
52 public: | 52 public: |
53 virtual void DidLoseOutputSurfaceOnImplThread() = 0; | 53 virtual void DidLoseOutputSurfaceOnImplThread() = 0; |
54 virtual void OnSwapBuffersCompleteOnImplThread() = 0; | 54 virtual void OnSwapBuffersCompleteOnImplThread() = 0; |
55 virtual void OnVSyncParametersChanged(base::TimeTicks timebase, | 55 virtual void OnVSyncParametersChanged(base::TimeTicks timebase, |
56 base::TimeDelta interval) = 0; | 56 base::TimeDelta interval) = 0; |
57 virtual void DidVSync(base::TimeTicks frame_time) = 0; | 57 virtual void DidBeginFrame(base::TimeTicks frame_time) = 0; |
58 virtual void OnCanDrawStateChanged(bool can_draw) = 0; | 58 virtual void OnCanDrawStateChanged(bool can_draw) = 0; |
59 virtual void OnHasPendingTreeStateChanged(bool has_pending_tree) = 0; | 59 virtual void OnHasPendingTreeStateChanged(bool has_pending_tree) = 0; |
60 virtual void SetNeedsRedrawOnImplThread() = 0; | 60 virtual void SetNeedsRedrawOnImplThread() = 0; |
61 virtual void SetNeedsRedrawRectOnImplThread(gfx::Rect damage_rect) = 0; | 61 virtual void SetNeedsRedrawRectOnImplThread(gfx::Rect damage_rect) = 0; |
62 virtual void DidInitializeVisibleTileOnImplThread() = 0; | 62 virtual void DidInitializeVisibleTileOnImplThread() = 0; |
63 virtual void SetNeedsCommitOnImplThread() = 0; | 63 virtual void SetNeedsCommitOnImplThread() = 0; |
64 virtual void SetNeedsManageTilesOnImplThread() = 0; | 64 virtual void SetNeedsManageTilesOnImplThread() = 0; |
65 virtual void PostAnimationEventsToMainThreadOnImplThread( | 65 virtual void PostAnimationEventsToMainThreadOnImplThread( |
66 scoped_ptr<AnimationEventsVector> events, | 66 scoped_ptr<AnimationEventsVector> events, |
67 base::Time wall_clock_time) = 0; | 67 base::Time wall_clock_time) = 0; |
68 // Returns true if resources were deleted by this call. | 68 // Returns true if resources were deleted by this call. |
69 virtual bool ReduceContentsTextureMemoryOnImplThread( | 69 virtual bool ReduceContentsTextureMemoryOnImplThread( |
70 size_t limit_bytes, | 70 size_t limit_bytes, |
71 int priority_cutoff) = 0; | 71 int priority_cutoff) = 0; |
72 virtual void ReduceWastedContentsTextureMemoryOnImplThread() = 0; | 72 virtual void ReduceWastedContentsTextureMemoryOnImplThread() = 0; |
73 virtual void SendManagedMemoryStats() = 0; | 73 virtual void SendManagedMemoryStats() = 0; |
74 virtual bool IsInsideDraw() = 0; | 74 virtual bool IsInsideDraw() = 0; |
75 virtual void RenewTreePriority() = 0; | 75 virtual void RenewTreePriority() = 0; |
76 virtual void RequestScrollbarAnimationOnImplThread(base::TimeDelta delay) = 0; | 76 virtual void RequestScrollbarAnimationOnImplThread(base::TimeDelta delay) = 0; |
77 virtual void DidReceiveLastInputEventForVSync(base::TimeTicks frame_time) = 0; | 77 virtual void DidReceiveLastInputEventForBeginFrame( |
| 78 base::TimeTicks frame_time) = 0; |
78 virtual void DidActivatePendingTree() = 0; | 79 virtual void DidActivatePendingTree() = 0; |
79 | 80 |
80 protected: | 81 protected: |
81 virtual ~LayerTreeHostImplClient() {} | 82 virtual ~LayerTreeHostImplClient() {} |
82 }; | 83 }; |
83 | 84 |
84 // LayerTreeHostImpl owns the LayerImpl trees as well as associated rendering | 85 // LayerTreeHostImpl owns the LayerImpl trees as well as associated rendering |
85 // state. | 86 // state. |
86 class CC_EXPORT LayerTreeHostImpl : public InputHandler, | 87 class CC_EXPORT LayerTreeHostImpl : public InputHandler, |
87 public RendererClient, | 88 public RendererClient, |
(...skipping 27 matching lines...) Expand all Loading... |
115 virtual void PinchGestureUpdate(float magnify_delta, | 116 virtual void PinchGestureUpdate(float magnify_delta, |
116 gfx::Point anchor) OVERRIDE; | 117 gfx::Point anchor) OVERRIDE; |
117 virtual void PinchGestureEnd() OVERRIDE; | 118 virtual void PinchGestureEnd() OVERRIDE; |
118 virtual void StartPageScaleAnimation(gfx::Vector2d target_offset, | 119 virtual void StartPageScaleAnimation(gfx::Vector2d target_offset, |
119 bool anchor_point, | 120 bool anchor_point, |
120 float page_scale, | 121 float page_scale, |
121 base::TimeTicks start_time, | 122 base::TimeTicks start_time, |
122 base::TimeDelta duration) OVERRIDE; | 123 base::TimeDelta duration) OVERRIDE; |
123 virtual void ScheduleAnimation() OVERRIDE; | 124 virtual void ScheduleAnimation() OVERRIDE; |
124 virtual bool HaveTouchEventHandlersAt(gfx::Point viewport_port) OVERRIDE; | 125 virtual bool HaveTouchEventHandlersAt(gfx::Point viewport_port) OVERRIDE; |
125 virtual void DidReceiveLastInputEventForVSync( | 126 virtual void DidReceiveLastInputEventForBeginFrame( |
126 base::TimeTicks frame_time) OVERRIDE; | 127 base::TimeTicks frame_time) OVERRIDE; |
127 | 128 |
128 // TopControlsManagerClient implementation. | 129 // TopControlsManagerClient implementation. |
129 virtual void DidChangeTopControlsPosition() OVERRIDE; | 130 virtual void DidChangeTopControlsPosition() OVERRIDE; |
130 virtual bool HaveRootScrollLayer() const OVERRIDE; | 131 virtual bool HaveRootScrollLayer() const OVERRIDE; |
131 | 132 |
132 void StartScrollbarAnimation(base::TimeTicks now); | 133 void StartScrollbarAnimation(base::TimeTicks now); |
133 | 134 |
134 struct CC_EXPORT FrameData : public RenderPassSink { | 135 struct CC_EXPORT FrameData : public RenderPassSink { |
135 FrameData(); | 136 FrameData(); |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 virtual bool AllowPartialSwap() const OVERRIDE; | 194 virtual bool AllowPartialSwap() const OVERRIDE; |
194 | 195 |
195 // TileManagerClient implementation. | 196 // TileManagerClient implementation. |
196 virtual void ScheduleManageTiles() OVERRIDE; | 197 virtual void ScheduleManageTiles() OVERRIDE; |
197 virtual void DidInitializeVisibleTile() OVERRIDE; | 198 virtual void DidInitializeVisibleTile() OVERRIDE; |
198 | 199 |
199 // OutputSurfaceClient implementation. | 200 // OutputSurfaceClient implementation. |
200 virtual void SetNeedsRedrawRect(gfx::Rect rect) OVERRIDE; | 201 virtual void SetNeedsRedrawRect(gfx::Rect rect) OVERRIDE; |
201 virtual void OnVSyncParametersChanged(base::TimeTicks timebase, | 202 virtual void OnVSyncParametersChanged(base::TimeTicks timebase, |
202 base::TimeDelta interval) OVERRIDE; | 203 base::TimeDelta interval) OVERRIDE; |
203 virtual void DidVSync(base::TimeTicks frame_time) OVERRIDE; | 204 virtual void BeginFrame(base::TimeTicks frame_time) OVERRIDE; |
204 virtual void OnSendFrameToParentCompositorAck(const CompositorFrameAck& ack) | 205 virtual void OnSendFrameToParentCompositorAck(const CompositorFrameAck& ack) |
205 OVERRIDE; | 206 OVERRIDE; |
206 | 207 |
207 // Called from LayerTreeImpl. | 208 // Called from LayerTreeImpl. |
208 void OnCanDrawStateChangedForTree(); | 209 void OnCanDrawStateChangedForTree(); |
209 | 210 |
210 // Implementation | 211 // Implementation |
211 bool CanDraw(); | 212 bool CanDraw(); |
212 OutputSurface* output_surface() const { return output_surface_.get(); } | 213 OutputSurface* output_surface() const { return output_surface_.get(); } |
213 | 214 |
214 std::string LayerTreeAsText() const; | 215 std::string LayerTreeAsText() const; |
215 std::string LayerTreeAsJson() const; | 216 std::string LayerTreeAsJson() const; |
216 | 217 |
217 void FinishAllRendering(); | 218 void FinishAllRendering(); |
218 int SourceAnimationFrameNumber() const; | 219 int SourceAnimationFrameNumber() const; |
219 | 220 |
220 virtual bool InitializeRenderer(scoped_ptr<OutputSurface> output_surface); | 221 virtual bool InitializeRenderer(scoped_ptr<OutputSurface> output_surface); |
221 bool IsContextLost(); | 222 bool IsContextLost(); |
222 TileManager* tile_manager() { return tile_manager_.get(); } | 223 TileManager* tile_manager() { return tile_manager_.get(); } |
223 Renderer* renderer() { return renderer_.get(); } | 224 Renderer* renderer() { return renderer_.get(); } |
224 const RendererCapabilities& GetRendererCapabilities() const; | 225 const RendererCapabilities& GetRendererCapabilities() const; |
225 | 226 |
226 virtual bool SwapBuffers(const FrameData& frame); | 227 virtual bool SwapBuffers(const FrameData& frame); |
227 void EnableVSyncNotification(bool enable); | 228 void EnableBeginFrameNotification(bool enable); |
228 | 229 |
229 void Readback(void* pixels, gfx::Rect rect_in_device_viewport); | 230 void Readback(void* pixels, gfx::Rect rect_in_device_viewport); |
230 | 231 |
231 LayerTreeImpl* active_tree() { return active_tree_.get(); } | 232 LayerTreeImpl* active_tree() { return active_tree_.get(); } |
232 const LayerTreeImpl* active_tree() const { return active_tree_.get(); } | 233 const LayerTreeImpl* active_tree() const { return active_tree_.get(); } |
233 LayerTreeImpl* pending_tree() { return pending_tree_.get(); } | 234 LayerTreeImpl* pending_tree() { return pending_tree_.get(); } |
234 const LayerTreeImpl* pending_tree() const { return pending_tree_.get(); } | 235 const LayerTreeImpl* pending_tree() const { return pending_tree_.get(); } |
235 const LayerTreeImpl* recycle_tree() const { return recycle_tree_.get(); } | 236 const LayerTreeImpl* recycle_tree() const { return recycle_tree_.get(); } |
236 void CreatePendingTree(); | 237 void CreatePendingTree(); |
237 void CheckForCompletedTileUploads(); | 238 void CheckForCompletedTileUploads(); |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
484 scoped_ptr<AnimationRegistrar> animation_registrar_; | 485 scoped_ptr<AnimationRegistrar> animation_registrar_; |
485 | 486 |
486 RenderingStatsInstrumentation* rendering_stats_instrumentation_; | 487 RenderingStatsInstrumentation* rendering_stats_instrumentation_; |
487 | 488 |
488 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); | 489 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); |
489 }; | 490 }; |
490 | 491 |
491 } // namespace cc | 492 } // namespace cc |
492 | 493 |
493 #endif // CC_TREES_LAYER_TREE_HOST_IMPL_H_ | 494 #endif // CC_TREES_LAYER_TREE_HOST_IMPL_H_ |
OLD | NEW |