| 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 <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 // LayerTreeHost->Proxy callback interface. | 54 // LayerTreeHost->Proxy callback interface. |
| 55 class LayerTreeHostImplClient { | 55 class LayerTreeHostImplClient { |
| 56 public: | 56 public: |
| 57 virtual void DidTryInitializeRendererOnImplThread( | 57 virtual void DidTryInitializeRendererOnImplThread( |
| 58 bool success, | 58 bool success, |
| 59 scoped_refptr<ContextProvider> offscreen_context_provider) = 0; | 59 scoped_refptr<ContextProvider> offscreen_context_provider) = 0; |
| 60 virtual void DidLoseOutputSurfaceOnImplThread() = 0; | 60 virtual void DidLoseOutputSurfaceOnImplThread() = 0; |
| 61 virtual void OnSwapBuffersCompleteOnImplThread() = 0; | 61 virtual void OnSwapBuffersCompleteOnImplThread() = 0; |
| 62 virtual void BeginFrameOnImplThread(const BeginFrameArgs& args) = 0; | 62 virtual void BeginFrameOnImplThread(const BeginFrameArgs& args) = 0; |
| 63 virtual void OnCanDrawStateChanged(bool can_draw) = 0; | 63 virtual void OnCanDrawStateChanged(bool can_draw) = 0; |
| 64 virtual void NotifyReadyToActivate() = 0; |
| 64 virtual void OnHasPendingTreeStateChanged(bool has_pending_tree) = 0; | 65 virtual void OnHasPendingTreeStateChanged(bool has_pending_tree) = 0; |
| 65 virtual void SetNeedsRedrawOnImplThread() = 0; | 66 virtual void SetNeedsRedrawOnImplThread() = 0; |
| 66 virtual void SetNeedsRedrawRectOnImplThread(gfx::Rect damage_rect) = 0; | 67 virtual void SetNeedsRedrawRectOnImplThread(gfx::Rect damage_rect) = 0; |
| 67 virtual void DidInitializeVisibleTileOnImplThread() = 0; | 68 virtual void DidInitializeVisibleTileOnImplThread() = 0; |
| 68 virtual void SetNeedsCommitOnImplThread() = 0; | 69 virtual void SetNeedsCommitOnImplThread() = 0; |
| 69 virtual void PostAnimationEventsToMainThreadOnImplThread( | 70 virtual void PostAnimationEventsToMainThreadOnImplThread( |
| 70 scoped_ptr<AnimationEventsVector> events, | 71 scoped_ptr<AnimationEventsVector> events, |
| 71 base::Time wall_clock_time) = 0; | 72 base::Time wall_clock_time) = 0; |
| 72 // Returns true if resources were deleted by this call. | 73 // Returns true if resources were deleted by this call. |
| 73 virtual bool ReduceContentsTextureMemoryOnImplThread( | 74 virtual bool ReduceContentsTextureMemoryOnImplThread( |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 | 156 |
| 156 virtual void BeginCommit(); | 157 virtual void BeginCommit(); |
| 157 virtual void CommitComplete(); | 158 virtual void CommitComplete(); |
| 158 virtual void Animate(base::TimeTicks monotonic_time, | 159 virtual void Animate(base::TimeTicks monotonic_time, |
| 159 base::Time wall_clock_time); | 160 base::Time wall_clock_time); |
| 160 virtual void UpdateAnimationState(bool start_ready_animations); | 161 virtual void UpdateAnimationState(bool start_ready_animations); |
| 161 void MainThreadHasStoppedFlinging(); | 162 void MainThreadHasStoppedFlinging(); |
| 162 void UpdateBackgroundAnimateTicking(bool should_background_tick); | 163 void UpdateBackgroundAnimateTicking(bool should_background_tick); |
| 163 void SetViewportDamage(gfx::Rect damage_rect); | 164 void SetViewportDamage(gfx::Rect damage_rect); |
| 164 | 165 |
| 165 void ManageTiles(); | 166 // Returns false if ManageTiles was not necessary and the pending tree |
| 167 // can be activated. |
| 168 bool ManageTiles(); |
| 166 | 169 |
| 167 // Returns false if problems occured preparing the frame, and we should try | 170 // Returns false if problems occured preparing the frame, and we should try |
| 168 // to avoid displaying the frame. If PrepareToDraw is called, DidDrawAllLayers | 171 // to avoid displaying the frame. If PrepareToDraw is called, DidDrawAllLayers |
| 169 // must also be called, regardless of whether DrawLayers is called between the | 172 // must also be called, regardless of whether DrawLayers is called between the |
| 170 // two. | 173 // two. |
| 171 virtual bool PrepareToDraw(FrameData* frame, | 174 virtual bool PrepareToDraw(FrameData* frame, |
| 172 gfx::Rect device_viewport_damage_rect); | 175 gfx::Rect device_viewport_damage_rect); |
| 173 virtual void DrawLayers(FrameData* frame, base::TimeTicks frame_begin_time); | 176 virtual void DrawLayers(FrameData* frame, base::TimeTicks frame_begin_time); |
| 174 // Must be called if and only if PrepareToDraw was called. | 177 // Must be called if and only if PrepareToDraw was called. |
| 175 void DidDrawAllLayers(const FrameData& frame); | 178 void DidDrawAllLayers(const FrameData& frame); |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 void Readback(void* pixels, gfx::Rect rect_in_device_viewport); | 244 void Readback(void* pixels, gfx::Rect rect_in_device_viewport); |
| 242 | 245 |
| 243 LayerTreeImpl* active_tree() { return active_tree_.get(); } | 246 LayerTreeImpl* active_tree() { return active_tree_.get(); } |
| 244 const LayerTreeImpl* active_tree() const { return active_tree_.get(); } | 247 const LayerTreeImpl* active_tree() const { return active_tree_.get(); } |
| 245 LayerTreeImpl* pending_tree() { return pending_tree_.get(); } | 248 LayerTreeImpl* pending_tree() { return pending_tree_.get(); } |
| 246 const LayerTreeImpl* pending_tree() const { return pending_tree_.get(); } | 249 const LayerTreeImpl* pending_tree() const { return pending_tree_.get(); } |
| 247 const LayerTreeImpl* recycle_tree() const { return recycle_tree_.get(); } | 250 const LayerTreeImpl* recycle_tree() const { return recycle_tree_.get(); } |
| 248 virtual void CreatePendingTree(); | 251 virtual void CreatePendingTree(); |
| 249 void UpdateVisibleTiles(); | 252 void UpdateVisibleTiles(); |
| 250 virtual void ActivatePendingTreeIfNeeded(); | 253 virtual void ActivatePendingTreeIfNeeded(); |
| 254 virtual void ActivatePendingTree(); |
| 251 | 255 |
| 252 // Shortcuts to layers on the active tree. | 256 // Shortcuts to layers on the active tree. |
| 253 LayerImpl* RootLayer() const; | 257 LayerImpl* RootLayer() const; |
| 254 LayerImpl* RootScrollLayer() const; | 258 LayerImpl* RootScrollLayer() const; |
| 255 LayerImpl* CurrentlyScrollingLayer() const; | 259 LayerImpl* CurrentlyScrollingLayer() const; |
| 256 | 260 |
| 257 virtual void SetVisible(bool visible); | 261 virtual void SetVisible(bool visible); |
| 258 bool visible() const { return visible_; } | 262 bool visible() const { return visible_; } |
| 259 | 263 |
| 260 void SetNeedsCommit() { client_->SetNeedsCommitOnImplThread(); } | 264 void SetNeedsCommit() { client_->SetNeedsCommitOnImplThread(); } |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 385 void DeleteUIResource(UIResourceId uid); | 389 void DeleteUIResource(UIResourceId uid); |
| 386 | 390 |
| 387 ResourceProvider::ResourceId ResourceIdForUIResource(UIResourceId uid) const; | 391 ResourceProvider::ResourceId ResourceIdForUIResource(UIResourceId uid) const; |
| 388 | 392 |
| 389 protected: | 393 protected: |
| 390 LayerTreeHostImpl( | 394 LayerTreeHostImpl( |
| 391 const LayerTreeSettings& settings, | 395 const LayerTreeSettings& settings, |
| 392 LayerTreeHostImplClient* client, | 396 LayerTreeHostImplClient* client, |
| 393 Proxy* proxy, | 397 Proxy* proxy, |
| 394 RenderingStatsInstrumentation* rendering_stats_instrumentation); | 398 RenderingStatsInstrumentation* rendering_stats_instrumentation); |
| 395 virtual void ActivatePendingTree(); | |
| 396 | 399 |
| 397 // Virtual for testing. | 400 // Virtual for testing. |
| 398 virtual void AnimateLayers(base::TimeTicks monotonic_time, | 401 virtual void AnimateLayers(base::TimeTicks monotonic_time, |
| 399 base::Time wall_clock_time); | 402 base::Time wall_clock_time); |
| 400 | 403 |
| 401 // Virtual for testing. | 404 // Virtual for testing. |
| 402 virtual base::TimeDelta LowFrequencyAnimationInterval() const; | 405 virtual base::TimeDelta LowFrequencyAnimationInterval() const; |
| 403 | 406 |
| 404 const AnimationRegistrar::AnimationControllerMap& | 407 const AnimationRegistrar::AnimationControllerMap& |
| 405 active_animation_controllers() const { | 408 active_animation_controllers() const { |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 453 void SetManagedMemoryPolicy(const ManagedMemoryPolicy& policy); | 456 void SetManagedMemoryPolicy(const ManagedMemoryPolicy& policy); |
| 454 void EnforceManagedMemoryPolicy(const ManagedMemoryPolicy& policy); | 457 void EnforceManagedMemoryPolicy(const ManagedMemoryPolicy& policy); |
| 455 | 458 |
| 456 void DidInitializeVisibleTile(); | 459 void DidInitializeVisibleTile(); |
| 457 | 460 |
| 458 typedef base::hash_map<UIResourceId, ResourceProvider::ResourceId> | 461 typedef base::hash_map<UIResourceId, ResourceProvider::ResourceId> |
| 459 UIResourceMap; | 462 UIResourceMap; |
| 460 UIResourceMap ui_resource_map_; | 463 UIResourceMap ui_resource_map_; |
| 461 | 464 |
| 462 scoped_ptr<OutputSurface> output_surface_; | 465 scoped_ptr<OutputSurface> output_surface_; |
| 466 bool output_surface_lost_; |
| 463 | 467 |
| 464 // |resource_provider_| and |tile_manager_| can be NULL, e.g. when using tile- | 468 // |resource_provider_| and |tile_manager_| can be NULL, e.g. when using tile- |
| 465 // free rendering - see OutputSurface::ForcedDrawToSoftwareDevice(). | 469 // free rendering - see OutputSurface::ForcedDrawToSoftwareDevice(). |
| 466 scoped_ptr<ResourceProvider> resource_provider_; | 470 scoped_ptr<ResourceProvider> resource_provider_; |
| 467 scoped_ptr<TileManager> tile_manager_; | 471 scoped_ptr<TileManager> tile_manager_; |
| 468 scoped_ptr<Renderer> renderer_; | 472 scoped_ptr<Renderer> renderer_; |
| 469 | 473 |
| 470 // Tree currently being drawn. | 474 // Tree currently being drawn. |
| 471 scoped_ptr<LayerTreeImpl> active_tree_; | 475 scoped_ptr<LayerTreeImpl> active_tree_; |
| 472 | 476 |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 557 | 561 |
| 558 // Optional callback to notify of new tree activations. | 562 // Optional callback to notify of new tree activations. |
| 559 base::Closure tree_activation_callback_; | 563 base::Closure tree_activation_callback_; |
| 560 | 564 |
| 561 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); | 565 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); |
| 562 }; | 566 }; |
| 563 | 567 |
| 564 } // namespace cc | 568 } // namespace cc |
| 565 | 569 |
| 566 #endif // CC_TREES_LAYER_TREE_HOST_IMPL_H_ | 570 #endif // CC_TREES_LAYER_TREE_HOST_IMPL_H_ |
| OLD | NEW |