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 BeginFrameOnImplThread(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 DidReceiveLastInputEventForBeginFrameOnImplThread( |
| 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 | 87 class CC_EXPORT LayerTreeHostImpl |
87 : public InputHandler, | 88 : public InputHandler, |
(...skipping 29 matching lines...) Expand all Loading... |
117 virtual void PinchGestureUpdate(float magnify_delta, | 118 virtual void PinchGestureUpdate(float magnify_delta, |
118 gfx::Point anchor) OVERRIDE; | 119 gfx::Point anchor) OVERRIDE; |
119 virtual void PinchGestureEnd() OVERRIDE; | 120 virtual void PinchGestureEnd() OVERRIDE; |
120 virtual void StartPageScaleAnimation(gfx::Vector2d target_offset, | 121 virtual void StartPageScaleAnimation(gfx::Vector2d target_offset, |
121 bool anchor_point, | 122 bool anchor_point, |
122 float page_scale, | 123 float page_scale, |
123 base::TimeTicks start_time, | 124 base::TimeTicks start_time, |
124 base::TimeDelta duration) OVERRIDE; | 125 base::TimeDelta duration) OVERRIDE; |
125 virtual void ScheduleAnimation() OVERRIDE; | 126 virtual void ScheduleAnimation() OVERRIDE; |
126 virtual bool HaveTouchEventHandlersAt(gfx::Point viewport_port) OVERRIDE; | 127 virtual bool HaveTouchEventHandlersAt(gfx::Point viewport_port) OVERRIDE; |
127 virtual void DidReceiveLastInputEventForVSync( | 128 virtual void DidReceiveLastInputEventForBeginFrame( |
128 base::TimeTicks frame_time) OVERRIDE; | 129 base::TimeTicks frame_time) OVERRIDE; |
129 | 130 |
130 // TopControlsManagerClient implementation. | 131 // TopControlsManagerClient implementation. |
131 virtual void DidChangeTopControlsPosition() OVERRIDE; | 132 virtual void DidChangeTopControlsPosition() OVERRIDE; |
132 virtual bool HaveRootScrollLayer() const OVERRIDE; | 133 virtual bool HaveRootScrollLayer() const OVERRIDE; |
133 | 134 |
134 void StartScrollbarAnimation(base::TimeTicks now); | 135 void StartScrollbarAnimation(base::TimeTicks now); |
135 | 136 |
136 struct CC_EXPORT FrameData : public RenderPassSink { | 137 struct CC_EXPORT FrameData : public RenderPassSink { |
137 FrameData(); | 138 FrameData(); |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 // TileManagerClient implementation. | 199 // TileManagerClient implementation. |
199 virtual void ScheduleManageTiles() OVERRIDE; | 200 virtual void ScheduleManageTiles() OVERRIDE; |
200 virtual void DidInitializeVisibleTile() OVERRIDE; | 201 virtual void DidInitializeVisibleTile() OVERRIDE; |
201 virtual bool ShouldForceTileUploadsRequiredForActivationToComplete() const | 202 virtual bool ShouldForceTileUploadsRequiredForActivationToComplete() const |
202 OVERRIDE; | 203 OVERRIDE; |
203 | 204 |
204 // OutputSurfaceClient implementation. | 205 // OutputSurfaceClient implementation. |
205 virtual void SetNeedsRedrawRect(gfx::Rect rect) OVERRIDE; | 206 virtual void SetNeedsRedrawRect(gfx::Rect rect) OVERRIDE; |
206 virtual void OnVSyncParametersChanged(base::TimeTicks timebase, | 207 virtual void OnVSyncParametersChanged(base::TimeTicks timebase, |
207 base::TimeDelta interval) OVERRIDE; | 208 base::TimeDelta interval) OVERRIDE; |
208 virtual void DidVSync(base::TimeTicks frame_time) OVERRIDE; | 209 virtual void BeginFrame(base::TimeTicks frame_time) |
| 210 OVERRIDE; |
209 virtual void OnSendFrameToParentCompositorAck(const CompositorFrameAck& ack) | 211 virtual void OnSendFrameToParentCompositorAck(const CompositorFrameAck& ack) |
210 OVERRIDE; | 212 OVERRIDE; |
211 | 213 |
212 // Called from LayerTreeImpl. | 214 // Called from LayerTreeImpl. |
213 void OnCanDrawStateChangedForTree(); | 215 void OnCanDrawStateChangedForTree(); |
214 | 216 |
215 // Implementation | 217 // Implementation |
216 bool CanDraw(); | 218 bool CanDraw(); |
217 OutputSurface* output_surface() const { return output_surface_.get(); } | 219 OutputSurface* output_surface() const { return output_surface_.get(); } |
218 | 220 |
219 std::string LayerTreeAsText() const; | 221 std::string LayerTreeAsText() const; |
220 std::string LayerTreeAsJson() const; | 222 std::string LayerTreeAsJson() const; |
221 | 223 |
222 void FinishAllRendering(); | 224 void FinishAllRendering(); |
223 int SourceAnimationFrameNumber() const; | 225 int SourceAnimationFrameNumber() const; |
224 | 226 |
225 virtual bool InitializeRenderer(scoped_ptr<OutputSurface> output_surface); | 227 virtual bool InitializeRenderer(scoped_ptr<OutputSurface> output_surface); |
226 bool IsContextLost(); | 228 bool IsContextLost(); |
227 TileManager* tile_manager() { return tile_manager_.get(); } | 229 TileManager* tile_manager() { return tile_manager_.get(); } |
228 Renderer* renderer() { return renderer_.get(); } | 230 Renderer* renderer() { return renderer_.get(); } |
229 const RendererCapabilities& GetRendererCapabilities() const; | 231 const RendererCapabilities& GetRendererCapabilities() const; |
230 | 232 |
231 virtual bool SwapBuffers(const FrameData& frame); | 233 virtual bool SwapBuffers(const FrameData& frame); |
232 void EnableVSyncNotification(bool enable); | 234 void SetNeedsBeginFrame(bool enable); |
233 | 235 |
234 void Readback(void* pixels, gfx::Rect rect_in_device_viewport); | 236 void Readback(void* pixels, gfx::Rect rect_in_device_viewport); |
235 | 237 |
236 LayerTreeImpl* active_tree() { return active_tree_.get(); } | 238 LayerTreeImpl* active_tree() { return active_tree_.get(); } |
237 const LayerTreeImpl* active_tree() const { return active_tree_.get(); } | 239 const LayerTreeImpl* active_tree() const { return active_tree_.get(); } |
238 LayerTreeImpl* pending_tree() { return pending_tree_.get(); } | 240 LayerTreeImpl* pending_tree() { return pending_tree_.get(); } |
239 const LayerTreeImpl* pending_tree() const { return pending_tree_.get(); } | 241 const LayerTreeImpl* pending_tree() const { return pending_tree_.get(); } |
240 const LayerTreeImpl* recycle_tree() const { return recycle_tree_.get(); } | 242 const LayerTreeImpl* recycle_tree() const { return recycle_tree_.get(); } |
241 void CreatePendingTree(); | 243 void CreatePendingTree(); |
242 void CheckForCompletedTileUploads(); | 244 void CheckForCompletedTileUploads(); |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
503 scoped_ptr<AnimationRegistrar> animation_registrar_; | 505 scoped_ptr<AnimationRegistrar> animation_registrar_; |
504 | 506 |
505 RenderingStatsInstrumentation* rendering_stats_instrumentation_; | 507 RenderingStatsInstrumentation* rendering_stats_instrumentation_; |
506 | 508 |
507 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); | 509 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); |
508 }; | 510 }; |
509 | 511 |
510 } // namespace cc | 512 } // namespace cc |
511 | 513 |
512 #endif // CC_TREES_LAYER_TREE_HOST_IMPL_H_ | 514 #endif // CC_TREES_LAYER_TREE_HOST_IMPL_H_ |
OLD | NEW |