| 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 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 void Readback(void* pixels, gfx::Rect rect_in_device_viewport); | 241 void Readback(void* pixels, gfx::Rect rect_in_device_viewport); |
| 241 | 242 |
| 242 LayerTreeImpl* active_tree() { return active_tree_.get(); } | 243 LayerTreeImpl* active_tree() { return active_tree_.get(); } |
| 243 const LayerTreeImpl* active_tree() const { return active_tree_.get(); } | 244 const LayerTreeImpl* active_tree() const { return active_tree_.get(); } |
| 244 LayerTreeImpl* pending_tree() { return pending_tree_.get(); } | 245 LayerTreeImpl* pending_tree() { return pending_tree_.get(); } |
| 245 const LayerTreeImpl* pending_tree() const { return pending_tree_.get(); } | 246 const LayerTreeImpl* pending_tree() const { return pending_tree_.get(); } |
| 246 const LayerTreeImpl* recycle_tree() const { return recycle_tree_.get(); } | 247 const LayerTreeImpl* recycle_tree() const { return recycle_tree_.get(); } |
| 247 virtual void CreatePendingTree(); | 248 virtual void CreatePendingTree(); |
| 248 void UpdateVisibleTiles(); | 249 void UpdateVisibleTiles(); |
| 249 virtual void ActivatePendingTreeIfNeeded(); | 250 virtual void ActivatePendingTreeIfNeeded(); |
| 251 virtual void ActivatePendingTree(); |
| 250 | 252 |
| 251 // Shortcuts to layers on the active tree. | 253 // Shortcuts to layers on the active tree. |
| 252 LayerImpl* RootLayer() const; | 254 LayerImpl* RootLayer() const; |
| 253 LayerImpl* RootScrollLayer() const; | 255 LayerImpl* RootScrollLayer() const; |
| 254 LayerImpl* CurrentlyScrollingLayer() const; | 256 LayerImpl* CurrentlyScrollingLayer() const; |
| 255 | 257 |
| 256 virtual void SetVisible(bool visible); | 258 virtual void SetVisible(bool visible); |
| 257 bool visible() const { return visible_; } | 259 bool visible() const { return visible_; } |
| 258 | 260 |
| 259 void SetNeedsCommit() { client_->SetNeedsCommitOnImplThread(); } | 261 void SetNeedsCommit() { client_->SetNeedsCommitOnImplThread(); } |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 void DeleteUIResource(UIResourceId uid); | 384 void DeleteUIResource(UIResourceId uid); |
| 383 | 385 |
| 384 ResourceProvider::ResourceId ResourceIdForUIResource(UIResourceId uid) const; | 386 ResourceProvider::ResourceId ResourceIdForUIResource(UIResourceId uid) const; |
| 385 | 387 |
| 386 protected: | 388 protected: |
| 387 LayerTreeHostImpl( | 389 LayerTreeHostImpl( |
| 388 const LayerTreeSettings& settings, | 390 const LayerTreeSettings& settings, |
| 389 LayerTreeHostImplClient* client, | 391 LayerTreeHostImplClient* client, |
| 390 Proxy* proxy, | 392 Proxy* proxy, |
| 391 RenderingStatsInstrumentation* rendering_stats_instrumentation); | 393 RenderingStatsInstrumentation* rendering_stats_instrumentation); |
| 392 virtual void ActivatePendingTree(); | |
| 393 | 394 |
| 394 // Virtual for testing. | 395 // Virtual for testing. |
| 395 virtual void AnimateLayers(base::TimeTicks monotonic_time, | 396 virtual void AnimateLayers(base::TimeTicks monotonic_time, |
| 396 base::Time wall_clock_time); | 397 base::Time wall_clock_time); |
| 397 | 398 |
| 398 // Virtual for testing. | 399 // Virtual for testing. |
| 399 virtual base::TimeDelta LowFrequencyAnimationInterval() const; | 400 virtual base::TimeDelta LowFrequencyAnimationInterval() const; |
| 400 | 401 |
| 401 const AnimationRegistrar::AnimationControllerMap& | 402 const AnimationRegistrar::AnimationControllerMap& |
| 402 active_animation_controllers() const { | 403 active_animation_controllers() const { |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 451 bool zero_budget); | 452 bool zero_budget); |
| 452 void EnforceManagedMemoryPolicy(const ManagedMemoryPolicy& policy); | 453 void EnforceManagedMemoryPolicy(const ManagedMemoryPolicy& policy); |
| 453 | 454 |
| 454 void DidInitializeVisibleTile(); | 455 void DidInitializeVisibleTile(); |
| 455 | 456 |
| 456 typedef base::hash_map<UIResourceId, ResourceProvider::ResourceId> | 457 typedef base::hash_map<UIResourceId, ResourceProvider::ResourceId> |
| 457 UIResourceMap; | 458 UIResourceMap; |
| 458 UIResourceMap ui_resource_map_; | 459 UIResourceMap ui_resource_map_; |
| 459 | 460 |
| 460 scoped_ptr<OutputSurface> output_surface_; | 461 scoped_ptr<OutputSurface> output_surface_; |
| 462 bool output_surface_lost_; |
| 461 | 463 |
| 462 // |resource_provider_| and |tile_manager_| can be NULL, e.g. when using tile- | 464 // |resource_provider_| and |tile_manager_| can be NULL, e.g. when using tile- |
| 463 // free rendering - see OutputSurface::ForcedDrawToSoftwareDevice(). | 465 // free rendering - see OutputSurface::ForcedDrawToSoftwareDevice(). |
| 464 scoped_ptr<ResourceProvider> resource_provider_; | 466 scoped_ptr<ResourceProvider> resource_provider_; |
| 465 scoped_ptr<TileManager> tile_manager_; | 467 scoped_ptr<TileManager> tile_manager_; |
| 466 scoped_ptr<Renderer> renderer_; | 468 scoped_ptr<Renderer> renderer_; |
| 467 | 469 |
| 468 // Tree currently being drawn. | 470 // Tree currently being drawn. |
| 469 scoped_ptr<LayerTreeImpl> active_tree_; | 471 scoped_ptr<LayerTreeImpl> active_tree_; |
| 470 | 472 |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 555 | 557 |
| 556 // Optional callback to notify of new tree activations. | 558 // Optional callback to notify of new tree activations. |
| 557 base::Closure tree_activation_callback_; | 559 base::Closure tree_activation_callback_; |
| 558 | 560 |
| 559 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); | 561 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); |
| 560 }; | 562 }; |
| 561 | 563 |
| 562 } // namespace cc | 564 } // namespace cc |
| 563 | 565 |
| 564 #endif // CC_TREES_LAYER_TREE_HOST_IMPL_H_ | 566 #endif // CC_TREES_LAYER_TREE_HOST_IMPL_H_ |
| OLD | NEW |