| 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 <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 class DebugRectHistory; | 44 class DebugRectHistory; |
| 45 class EvictionTilePriorityQueue; | 45 class EvictionTilePriorityQueue; |
| 46 class FrameRateCounter; | 46 class FrameRateCounter; |
| 47 class LayerImpl; | 47 class LayerImpl; |
| 48 class LayerTreeImpl; | 48 class LayerTreeImpl; |
| 49 class MemoryHistory; | 49 class MemoryHistory; |
| 50 class PageScaleAnimation; | 50 class PageScaleAnimation; |
| 51 class PaintTimeCounter; | 51 class PaintTimeCounter; |
| 52 class PictureLayerImpl; | 52 class PictureLayerImpl; |
| 53 class RasterTilePriorityQueue; | 53 class RasterTilePriorityQueue; |
| 54 class RasterWorkerPool; | 54 class TileTaskWorkerPool; |
| 55 class RenderPassDrawQuad; | 55 class RenderPassDrawQuad; |
| 56 class RenderingStatsInstrumentation; | 56 class RenderingStatsInstrumentation; |
| 57 class ResourcePool; | 57 class ResourcePool; |
| 58 class ScrollElasticityHelper; | 58 class ScrollElasticityHelper; |
| 59 class ScrollbarLayerImplBase; | 59 class ScrollbarLayerImplBase; |
| 60 class TextureMailboxDeleter; | 60 class TextureMailboxDeleter; |
| 61 class TopControlsManager; | 61 class TopControlsManager; |
| 62 class UIResourceBitmap; | 62 class UIResourceBitmap; |
| 63 class UIResourceRequest; | 63 class UIResourceRequest; |
| 64 struct RendererCapabilitiesImpl; | 64 struct RendererCapabilitiesImpl; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 85 virtual void OnCanDrawStateChanged(bool can_draw) = 0; | 85 virtual void OnCanDrawStateChanged(bool can_draw) = 0; |
| 86 virtual void NotifyReadyToActivate() = 0; | 86 virtual void NotifyReadyToActivate() = 0; |
| 87 virtual void NotifyReadyToDraw() = 0; | 87 virtual void NotifyReadyToDraw() = 0; |
| 88 // Please call these 3 functions through | 88 // Please call these 3 functions through |
| 89 // LayerTreeHostImpl's SetNeedsRedraw(), SetNeedsRedrawRect() and | 89 // LayerTreeHostImpl's SetNeedsRedraw(), SetNeedsRedrawRect() and |
| 90 // SetNeedsAnimate(). | 90 // SetNeedsAnimate(). |
| 91 virtual void SetNeedsRedrawOnImplThread() = 0; | 91 virtual void SetNeedsRedrawOnImplThread() = 0; |
| 92 virtual void SetNeedsRedrawRectOnImplThread(const gfx::Rect& damage_rect) = 0; | 92 virtual void SetNeedsRedrawRectOnImplThread(const gfx::Rect& damage_rect) = 0; |
| 93 virtual void SetNeedsAnimateOnImplThread() = 0; | 93 virtual void SetNeedsAnimateOnImplThread() = 0; |
| 94 virtual void SetNeedsCommitOnImplThread() = 0; | 94 virtual void SetNeedsCommitOnImplThread() = 0; |
| 95 virtual void SetNeedsManageTilesOnImplThread() = 0; | 95 virtual void SetNeedsPrepareTilesOnImplThread() = 0; |
| 96 virtual void PostAnimationEventsToMainThreadOnImplThread( | 96 virtual void PostAnimationEventsToMainThreadOnImplThread( |
| 97 scoped_ptr<AnimationEventsVector> events) = 0; | 97 scoped_ptr<AnimationEventsVector> events) = 0; |
| 98 // Returns true if resources were deleted by this call. | 98 // Returns true if resources were deleted by this call. |
| 99 virtual bool ReduceContentsTextureMemoryOnImplThread( | 99 virtual bool ReduceContentsTextureMemoryOnImplThread( |
| 100 size_t limit_bytes, | 100 size_t limit_bytes, |
| 101 int priority_cutoff) = 0; | 101 int priority_cutoff) = 0; |
| 102 virtual bool IsInsideDraw() = 0; | 102 virtual bool IsInsideDraw() = 0; |
| 103 virtual void RenewTreePriority() = 0; | 103 virtual void RenewTreePriority() = 0; |
| 104 virtual void PostDelayedScrollbarFadeOnImplThread( | 104 virtual void PostDelayedScrollbarFadeOnImplThread( |
| 105 const base::Closure& start_fade, | 105 const base::Closure& start_fade, |
| 106 base::TimeDelta delay) = 0; | 106 base::TimeDelta delay) = 0; |
| 107 virtual void DidActivateSyncTree() = 0; | 107 virtual void DidActivateSyncTree() = 0; |
| 108 virtual void DidManageTiles() = 0; | 108 virtual void DidPrepareTiles() = 0; |
| 109 | 109 |
| 110 protected: | 110 protected: |
| 111 virtual ~LayerTreeHostImplClient() {} | 111 virtual ~LayerTreeHostImplClient() {} |
| 112 }; | 112 }; |
| 113 | 113 |
| 114 // LayerTreeHostImpl owns the LayerImpl trees as well as associated rendering | 114 // LayerTreeHostImpl owns the LayerImpl trees as well as associated rendering |
| 115 // state. | 115 // state. |
| 116 class CC_EXPORT LayerTreeHostImpl | 116 class CC_EXPORT LayerTreeHostImpl |
| 117 : public InputHandler, | 117 : public InputHandler, |
| 118 public RendererClient, | 118 public RendererClient, |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 virtual void BeginMainFrameAborted(bool did_handle); | 193 virtual void BeginMainFrameAborted(bool did_handle); |
| 194 virtual void BeginCommit(); | 194 virtual void BeginCommit(); |
| 195 virtual void CommitComplete(); | 195 virtual void CommitComplete(); |
| 196 virtual void Animate(base::TimeTicks monotonic_time); | 196 virtual void Animate(base::TimeTicks monotonic_time); |
| 197 virtual void UpdateAnimationState(bool start_ready_animations); | 197 virtual void UpdateAnimationState(bool start_ready_animations); |
| 198 void ActivateAnimations(); | 198 void ActivateAnimations(); |
| 199 void MainThreadHasStoppedFlinging(); | 199 void MainThreadHasStoppedFlinging(); |
| 200 void DidAnimateScrollOffset(); | 200 void DidAnimateScrollOffset(); |
| 201 void SetViewportDamage(const gfx::Rect& damage_rect); | 201 void SetViewportDamage(const gfx::Rect& damage_rect); |
| 202 | 202 |
| 203 virtual void ManageTiles(); | 203 virtual void PrepareTiles(); |
| 204 | 204 |
| 205 // Returns DRAW_SUCCESS unless problems occured preparing the frame, and we | 205 // Returns DRAW_SUCCESS unless problems occured preparing the frame, and we |
| 206 // should try to avoid displaying the frame. If PrepareToDraw is called, | 206 // should try to avoid displaying the frame. If PrepareToDraw is called, |
| 207 // DidDrawAllLayers must also be called, regardless of whether DrawLayers is | 207 // DidDrawAllLayers must also be called, regardless of whether DrawLayers is |
| 208 // called between the two. | 208 // called between the two. |
| 209 virtual DrawResult PrepareToDraw(FrameData* frame); | 209 virtual DrawResult PrepareToDraw(FrameData* frame); |
| 210 virtual void DrawLayers(FrameData* frame, base::TimeTicks frame_begin_time); | 210 virtual void DrawLayers(FrameData* frame, base::TimeTicks frame_begin_time); |
| 211 // Must be called if and only if PrepareToDraw was called. | 211 // Must be called if and only if PrepareToDraw was called. |
| 212 void DidDrawAllLayers(const FrameData& frame); | 212 void DidDrawAllLayers(const FrameData& frame); |
| 213 | 213 |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 492 void GetPictureLayerImplPairs(std::vector<PictureLayerImpl::Pair>* layers, | 492 void GetPictureLayerImplPairs(std::vector<PictureLayerImpl::Pair>* layers, |
| 493 bool need_valid_tile_priorities) const; | 493 bool need_valid_tile_priorities) const; |
| 494 | 494 |
| 495 void SetRequiresHighResToDraw() { requires_high_res_to_draw_ = true; } | 495 void SetRequiresHighResToDraw() { requires_high_res_to_draw_ = true; } |
| 496 void ResetRequiresHighResToDraw() { requires_high_res_to_draw_ = false; } | 496 void ResetRequiresHighResToDraw() { requires_high_res_to_draw_ = false; } |
| 497 bool RequiresHighResToDraw() const { return requires_high_res_to_draw_; } | 497 bool RequiresHighResToDraw() const { return requires_high_res_to_draw_; } |
| 498 | 498 |
| 499 // Only valid for synchronous (non-scheduled) single-threaded case. | 499 // Only valid for synchronous (non-scheduled) single-threaded case. |
| 500 void SynchronouslyInitializeAllTiles(); | 500 void SynchronouslyInitializeAllTiles(); |
| 501 | 501 |
| 502 virtual void CreateResourceAndRasterWorkerPool( | 502 virtual void CreateResourceAndTileTaskWorkerPool( |
| 503 scoped_ptr<RasterWorkerPool>* raster_worker_pool, | 503 scoped_ptr<TileTaskWorkerPool>* tile_task_worker_pool, |
| 504 scoped_ptr<ResourcePool>* resource_pool, | 504 scoped_ptr<ResourcePool>* resource_pool, |
| 505 scoped_ptr<ResourcePool>* staging_resource_pool); | 505 scoped_ptr<ResourcePool>* staging_resource_pool); |
| 506 | 506 |
| 507 protected: | 507 protected: |
| 508 LayerTreeHostImpl( | 508 LayerTreeHostImpl( |
| 509 const LayerTreeSettings& settings, | 509 const LayerTreeSettings& settings, |
| 510 LayerTreeHostImplClient* client, | 510 LayerTreeHostImplClient* client, |
| 511 Proxy* proxy, | 511 Proxy* proxy, |
| 512 RenderingStatsInstrumentation* rendering_stats_instrumentation, | 512 RenderingStatsInstrumentation* rendering_stats_instrumentation, |
| 513 SharedBitmapManager* shared_bitmap_manager, | 513 SharedBitmapManager* shared_bitmap_manager, |
| 514 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, | 514 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, |
| 515 int id); | 515 int id); |
| 516 | 516 |
| 517 void UpdateViewportContainerSizes(); | 517 void UpdateViewportContainerSizes(); |
| 518 | 518 |
| 519 // Virtual for testing. | 519 // Virtual for testing. |
| 520 virtual void AnimateLayers(base::TimeTicks monotonic_time); | 520 virtual void AnimateLayers(base::TimeTicks monotonic_time); |
| 521 const AnimationRegistrar::AnimationControllerMap& | 521 const AnimationRegistrar::AnimationControllerMap& |
| 522 active_animation_controllers() const { | 522 active_animation_controllers() const { |
| 523 return animation_registrar_->active_animation_controllers(); | 523 return animation_registrar_->active_animation_controllers(); |
| 524 } | 524 } |
| 525 | 525 |
| 526 bool manage_tiles_needed() const { return tile_priorities_dirty_; } | 526 bool prepare_tiles_needed() const { return tile_priorities_dirty_; } |
| 527 | 527 |
| 528 LayerTreeHostImplClient* client_; | 528 LayerTreeHostImplClient* client_; |
| 529 Proxy* proxy_; | 529 Proxy* proxy_; |
| 530 | 530 |
| 531 private: | 531 private: |
| 532 void CreateAndSetRenderer(); | 532 void CreateAndSetRenderer(); |
| 533 void CreateAndSetTileManager(); | 533 void CreateAndSetTileManager(); |
| 534 void DestroyTileManager(); | 534 void DestroyTileManager(); |
| 535 void ReleaseTreeResources(); | 535 void ReleaseTreeResources(); |
| 536 void EnforceZeroBudget(bool zero_budget); | 536 void EnforceZeroBudget(bool zero_budget); |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 603 std::set<UIResourceId> evicted_ui_resources_; | 603 std::set<UIResourceId> evicted_ui_resources_; |
| 604 | 604 |
| 605 scoped_ptr<OutputSurface> output_surface_; | 605 scoped_ptr<OutputSurface> output_surface_; |
| 606 | 606 |
| 607 // |resource_provider_| and |tile_manager_| can be NULL, e.g. when using tile- | 607 // |resource_provider_| and |tile_manager_| can be NULL, e.g. when using tile- |
| 608 // free rendering - see OutputSurface::ForcedDrawToSoftwareDevice(). | 608 // free rendering - see OutputSurface::ForcedDrawToSoftwareDevice(). |
| 609 scoped_ptr<ResourceProvider> resource_provider_; | 609 scoped_ptr<ResourceProvider> resource_provider_; |
| 610 scoped_ptr<TileManager> tile_manager_; | 610 scoped_ptr<TileManager> tile_manager_; |
| 611 bool use_gpu_rasterization_; | 611 bool use_gpu_rasterization_; |
| 612 GpuRasterizationStatus gpu_rasterization_status_; | 612 GpuRasterizationStatus gpu_rasterization_status_; |
| 613 scoped_ptr<RasterWorkerPool> raster_worker_pool_; | 613 scoped_ptr<TileTaskWorkerPool> tile_task_worker_pool_; |
| 614 scoped_ptr<ResourcePool> resource_pool_; | 614 scoped_ptr<ResourcePool> resource_pool_; |
| 615 scoped_ptr<ResourcePool> staging_resource_pool_; | 615 scoped_ptr<ResourcePool> staging_resource_pool_; |
| 616 scoped_ptr<Renderer> renderer_; | 616 scoped_ptr<Renderer> renderer_; |
| 617 | 617 |
| 618 GlobalStateThatImpactsTilePriority global_tile_state_; | 618 GlobalStateThatImpactsTilePriority global_tile_state_; |
| 619 | 619 |
| 620 // Tree currently being drawn. | 620 // Tree currently being drawn. |
| 621 scoped_ptr<LayerTreeImpl> active_tree_; | 621 scoped_ptr<LayerTreeImpl> active_tree_; |
| 622 | 622 |
| 623 // In impl-side painting mode, tree with possibly incomplete rasterized | 623 // In impl-side painting mode, tree with possibly incomplete rasterized |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 726 | 726 |
| 727 bool requires_high_res_to_draw_; | 727 bool requires_high_res_to_draw_; |
| 728 bool required_for_draw_tile_is_top_of_raster_queue_; | 728 bool required_for_draw_tile_is_top_of_raster_queue_; |
| 729 | 729 |
| 730 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); | 730 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); |
| 731 }; | 731 }; |
| 732 | 732 |
| 733 } // namespace cc | 733 } // namespace cc |
| 734 | 734 |
| 735 #endif // CC_TREES_LAYER_TREE_HOST_IMPL_H_ | 735 #endif // CC_TREES_LAYER_TREE_HOST_IMPL_H_ |
| OLD | NEW |