| 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 <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 // LayerTreeHost->Proxy callback interface. | 89 // LayerTreeHost->Proxy callback interface. |
| 90 class LayerTreeHostImplClient { | 90 class LayerTreeHostImplClient { |
| 91 public: | 91 public: |
| 92 virtual void UpdateRendererCapabilitiesOnImplThread() = 0; | 92 virtual void UpdateRendererCapabilitiesOnImplThread() = 0; |
| 93 virtual void DidLoseOutputSurfaceOnImplThread() = 0; | 93 virtual void DidLoseOutputSurfaceOnImplThread() = 0; |
| 94 virtual void CommitVSyncParameters(base::TimeTicks timebase, | 94 virtual void CommitVSyncParameters(base::TimeTicks timebase, |
| 95 base::TimeDelta interval) = 0; | 95 base::TimeDelta interval) = 0; |
| 96 virtual void SetEstimatedParentDrawTime(base::TimeDelta draw_time) = 0; | 96 virtual void SetEstimatedParentDrawTime(base::TimeDelta draw_time) = 0; |
| 97 virtual void DidSwapBuffersOnImplThread() = 0; | 97 virtual void DidSwapBuffersOnImplThread() = 0; |
| 98 virtual void DidSwapBuffersCompleteOnImplThread() = 0; | 98 virtual void DidSwapBuffersCompleteOnImplThread() = 0; |
| 99 virtual void OnResourcelessSoftareDrawStateChanged( | |
| 100 bool resourceless_draw) = 0; | |
| 101 virtual void OnCanDrawStateChanged(bool can_draw) = 0; | 99 virtual void OnCanDrawStateChanged(bool can_draw) = 0; |
| 102 virtual void NotifyReadyToActivate() = 0; | 100 virtual void NotifyReadyToActivate() = 0; |
| 103 virtual void NotifyReadyToDraw() = 0; | 101 virtual void NotifyReadyToDraw() = 0; |
| 104 // Please call these 3 functions through | 102 // Please call these 3 functions through |
| 105 // LayerTreeHostImpl's SetNeedsRedraw(), SetNeedsRedrawRect() and | 103 // LayerTreeHostImpl's SetNeedsRedraw(), SetNeedsRedrawRect() and |
| 106 // SetNeedsOneBeginImplFrame(). | 104 // SetNeedsOneBeginImplFrame(). |
| 107 virtual void SetNeedsRedrawOnImplThread() = 0; | 105 virtual void SetNeedsRedrawOnImplThread() = 0; |
| 108 virtual void SetNeedsRedrawRectOnImplThread(const gfx::Rect& damage_rect) = 0; | 106 virtual void SetNeedsRedrawRectOnImplThread(const gfx::Rect& damage_rect) = 0; |
| 109 virtual void SetNeedsOneBeginImplFrameOnImplThread() = 0; | 107 virtual void SetNeedsOneBeginImplFrameOnImplThread() = 0; |
| 110 virtual void SetNeedsCommitOnImplThread() = 0; | 108 virtual void SetNeedsCommitOnImplThread() = 0; |
| 111 virtual void SetNeedsPrepareTilesOnImplThread() = 0; | 109 virtual void SetNeedsPrepareTilesOnImplThread() = 0; |
| 112 virtual void SetVideoNeedsBeginFrames(bool needs_begin_frames) = 0; | 110 virtual void SetVideoNeedsBeginFrames(bool needs_begin_frames) = 0; |
| 113 virtual void PostAnimationEventsToMainThreadOnImplThread( | 111 virtual void PostAnimationEventsToMainThreadOnImplThread( |
| 114 scoped_ptr<AnimationEventsVector> events) = 0; | 112 scoped_ptr<AnimationEventsVector> events) = 0; |
| 115 virtual bool IsInsideDraw() = 0; | 113 virtual bool IsInsideDraw() = 0; |
| 116 virtual void RenewTreePriority() = 0; | 114 virtual void RenewTreePriority() = 0; |
| 117 virtual void PostDelayedAnimationTaskOnImplThread(const base::Closure& task, | 115 virtual void PostDelayedAnimationTaskOnImplThread(const base::Closure& task, |
| 118 base::TimeDelta delay) = 0; | 116 base::TimeDelta delay) = 0; |
| 119 virtual void DidActivateSyncTree() = 0; | 117 virtual void DidActivateSyncTree() = 0; |
| 120 virtual void WillPrepareTiles() = 0; | 118 virtual void WillPrepareTiles() = 0; |
| 121 virtual void DidPrepareTiles() = 0; | 119 virtual void DidPrepareTiles() = 0; |
| 122 | 120 |
| 123 // Called when page scale animation has completed on the impl thread. | 121 // Called when page scale animation has completed on the impl thread. |
| 124 virtual void DidCompletePageScaleAnimationOnImplThread() = 0; | 122 virtual void DidCompletePageScaleAnimationOnImplThread() = 0; |
| 125 | 123 |
| 126 // Called when output surface asks for a draw. | 124 // Called when output surface asks for a draw. |
| 127 virtual void OnDrawForOutputSurface() = 0; | 125 virtual void OnDrawForOutputSurface(bool resourceless_software_draw) = 0; |
| 128 | 126 |
| 129 virtual void PostFrameTimingEventsOnImplThread( | 127 virtual void PostFrameTimingEventsOnImplThread( |
| 130 scoped_ptr<FrameTimingTracker::CompositeTimingSet> composite_events, | 128 scoped_ptr<FrameTimingTracker::CompositeTimingSet> composite_events, |
| 131 scoped_ptr<FrameTimingTracker::MainFrameTimingSet> main_frame_events) = 0; | 129 scoped_ptr<FrameTimingTracker::MainFrameTimingSet> main_frame_events) = 0; |
| 132 | 130 |
| 133 protected: | 131 protected: |
| 134 virtual ~LayerTreeHostImplClient() {} | 132 virtual ~LayerTreeHostImplClient() {} |
| 135 }; | 133 }; |
| 136 | 134 |
| 137 // LayerTreeHostImpl owns the LayerImpl trees as well as associated rendering | 135 // LayerTreeHostImpl owns the LayerImpl trees as well as associated rendering |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 | 295 |
| 298 // When blocking, this prevents client_->NotifyReadyToActivate() from being | 296 // When blocking, this prevents client_->NotifyReadyToActivate() from being |
| 299 // called. When disabled, it calls client_->NotifyReadyToActivate() | 297 // called. When disabled, it calls client_->NotifyReadyToActivate() |
| 300 // immediately if any notifications had been blocked while blocking. | 298 // immediately if any notifications had been blocked while blocking. |
| 301 virtual void BlockNotifyReadyToActivateForTesting(bool block); | 299 virtual void BlockNotifyReadyToActivateForTesting(bool block); |
| 302 | 300 |
| 303 // Resets all of the trees to an empty state. | 301 // Resets all of the trees to an empty state. |
| 304 void ResetTreesForTesting(); | 302 void ResetTreesForTesting(); |
| 305 | 303 |
| 306 size_t SourceAnimationFrameNumberForTesting() const; | 304 size_t SourceAnimationFrameNumberForTesting() const; |
| 305 void SetExternalViewportForTesting(const gfx::Rect& external_viewport); |
| 306 void SetResourcelessSoftwareDrawForTesting(bool resourceless_software_draw); |
| 307 | 307 |
| 308 void RegisterScrollbarAnimationController(int scroll_layer_id); | 308 void RegisterScrollbarAnimationController(int scroll_layer_id); |
| 309 void UnregisterScrollbarAnimationController(int scroll_layer_id); | 309 void UnregisterScrollbarAnimationController(int scroll_layer_id); |
| 310 ScrollbarAnimationController* ScrollbarAnimationControllerForId( | 310 ScrollbarAnimationController* ScrollbarAnimationControllerForId( |
| 311 int scroll_layer_id) const; | 311 int scroll_layer_id) const; |
| 312 | 312 |
| 313 DrawMode GetDrawMode() const; | 313 DrawMode GetDrawMode() const; |
| 314 | 314 |
| 315 // Viewport size in draw space: this size is in physical pixels and is used | 315 // Viewport size in draw space: this size is in physical pixels and is used |
| 316 // for draw properties, tilings, quads and render passes. | 316 // for draw properties, tilings, quads and render passes. |
| (...skipping 25 matching lines...) Expand all Loading... |
| 342 ScrollbarSet ScrollbarsFor(int scroll_layer_id) const override; | 342 ScrollbarSet ScrollbarsFor(int scroll_layer_id) const override; |
| 343 | 343 |
| 344 // VideoBeginFrameSource implementation. | 344 // VideoBeginFrameSource implementation. |
| 345 void AddVideoFrameController(VideoFrameController* controller) override; | 345 void AddVideoFrameController(VideoFrameController* controller) override; |
| 346 void RemoveVideoFrameController(VideoFrameController* controller) override; | 346 void RemoveVideoFrameController(VideoFrameController* controller) override; |
| 347 | 347 |
| 348 // OutputSurfaceClient implementation. | 348 // OutputSurfaceClient implementation. |
| 349 void CommitVSyncParameters(base::TimeTicks timebase, | 349 void CommitVSyncParameters(base::TimeTicks timebase, |
| 350 base::TimeDelta interval) override; | 350 base::TimeDelta interval) override; |
| 351 void SetNeedsRedrawRect(const gfx::Rect& rect) override; | 351 void SetNeedsRedrawRect(const gfx::Rect& rect) override; |
| 352 void SetExternalDrawConstraints( | 352 void SetExternalTilePriorityConstraints( |
| 353 const gfx::Transform& transform, | 353 const gfx::Rect& viewport_rect, |
| 354 const gfx::Rect& viewport, | 354 const gfx::Transform& transform) override; |
| 355 const gfx::Rect& clip, | |
| 356 const gfx::Rect& viewport_rect_for_tile_priority, | |
| 357 const gfx::Transform& transform_for_tile_priority, | |
| 358 bool resourceless_software_draw) override; | |
| 359 void DidLoseOutputSurface() override; | 355 void DidLoseOutputSurface() override; |
| 360 void DidSwapBuffers() override; | 356 void DidSwapBuffers() override; |
| 361 void DidSwapBuffersComplete() override; | 357 void DidSwapBuffersComplete() override; |
| 362 void ReclaimResources(const CompositorFrameAck* ack) override; | 358 void ReclaimResources(const CompositorFrameAck* ack) override; |
| 363 void SetMemoryPolicy(const ManagedMemoryPolicy& policy) override; | 359 void SetMemoryPolicy(const ManagedMemoryPolicy& policy) override; |
| 364 void SetTreeActivationCallback(const base::Closure& callback) override; | 360 void SetTreeActivationCallback(const base::Closure& callback) override; |
| 365 void OnDraw() override; | 361 void OnDraw(const gfx::Transform& transform, |
| 362 const gfx::Rect& viewport, |
| 363 const gfx::Rect& clip, |
| 364 bool resourceless_software_draw) override; |
| 366 | 365 |
| 367 // Called from LayerTreeImpl. | 366 // Called from LayerTreeImpl. |
| 368 void OnCanDrawStateChangedForTree(); | 367 void OnCanDrawStateChangedForTree(); |
| 369 | 368 |
| 370 // Implementation. | 369 // Implementation. |
| 371 int id() const { return id_; } | 370 int id() const { return id_; } |
| 372 bool CanDraw() const; | 371 bool CanDraw() const; |
| 373 OutputSurface* output_surface() const { return output_surface_; } | 372 OutputSurface* output_surface() const { return output_surface_; } |
| 374 void ReleaseOutputSurface(); | 373 void ReleaseOutputSurface(); |
| 375 | 374 |
| (...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 830 scoped_ptr<FrameTimingTracker> frame_timing_tracker_; | 829 scoped_ptr<FrameTimingTracker> frame_timing_tracker_; |
| 831 | 830 |
| 832 scoped_ptr<Viewport> viewport_; | 831 scoped_ptr<Viewport> viewport_; |
| 833 | 832 |
| 834 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); | 833 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); |
| 835 }; | 834 }; |
| 836 | 835 |
| 837 } // namespace cc | 836 } // namespace cc |
| 838 | 837 |
| 839 #endif // CC_TREES_LAYER_TREE_HOST_IMPL_H_ | 838 #endif // CC_TREES_LAYER_TREE_HOST_IMPL_H_ |
| OLD | NEW |