| 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_H_ | 5 #ifndef CC_TREES_LAYER_TREE_HOST_H_ |
| 6 #define CC_TREES_LAYER_TREE_HOST_H_ | 6 #define CC_TREES_LAYER_TREE_HOST_H_ |
| 7 | 7 |
| 8 #include <limits> | 8 #include <limits> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 #include "cc/input/top_controls_state.h" | 29 #include "cc/input/top_controls_state.h" |
| 30 #include "cc/layers/layer_lists.h" | 30 #include "cc/layers/layer_lists.h" |
| 31 #include "cc/output/output_surface.h" | 31 #include "cc/output/output_surface.h" |
| 32 #include "cc/output/renderer_capabilities.h" | 32 #include "cc/output/renderer_capabilities.h" |
| 33 #include "cc/output/swap_promise.h" | 33 #include "cc/output/swap_promise.h" |
| 34 #include "cc/resources/resource_format.h" | 34 #include "cc/resources/resource_format.h" |
| 35 #include "cc/resources/scoped_ui_resource.h" | 35 #include "cc/resources/scoped_ui_resource.h" |
| 36 #include "cc/surfaces/surface_sequence.h" | 36 #include "cc/surfaces/surface_sequence.h" |
| 37 #include "cc/trees/layer_tree_host_client.h" | 37 #include "cc/trees/layer_tree_host_client.h" |
| 38 #include "cc/trees/layer_tree_host_common.h" | 38 #include "cc/trees/layer_tree_host_common.h" |
| 39 #include "cc/trees/layer_tree_mutators_client.h" |
| 39 #include "cc/trees/layer_tree_settings.h" | 40 #include "cc/trees/layer_tree_settings.h" |
| 40 #include "cc/trees/proxy.h" | 41 #include "cc/trees/proxy.h" |
| 41 #include "cc/trees/swap_promise_monitor.h" | 42 #include "cc/trees/swap_promise_monitor.h" |
| 42 #include "third_party/skia/include/core/SkColor.h" | 43 #include "third_party/skia/include/core/SkColor.h" |
| 43 #include "ui/gfx/geometry/rect.h" | 44 #include "ui/gfx/geometry/rect.h" |
| 44 | 45 |
| 45 namespace gpu { | 46 namespace gpu { |
| 46 class GpuMemoryBufferManager; | 47 class GpuMemoryBufferManager; |
| 47 } | 48 } |
| 48 | 49 |
| 49 namespace cc { | 50 namespace cc { |
| 50 class AnimationRegistrar; | 51 class AnimationRegistrar; |
| 52 class AnimationHost; |
| 51 class BeginFrameSource; | 53 class BeginFrameSource; |
| 52 class HeadsUpDisplayLayer; | 54 class HeadsUpDisplayLayer; |
| 53 class Layer; | 55 class Layer; |
| 54 class LayerTreeHostImpl; | 56 class LayerTreeHostImpl; |
| 55 class LayerTreeHostImplClient; | 57 class LayerTreeHostImplClient; |
| 56 class LayerTreeHostSingleThreadClient; | 58 class LayerTreeHostSingleThreadClient; |
| 57 class PrioritizedResource; | 59 class PrioritizedResource; |
| 58 class PrioritizedResourceManager; | 60 class PrioritizedResourceManager; |
| 59 class Region; | 61 class Region; |
| 60 class RenderingStatsInstrumentation; | 62 class RenderingStatsInstrumentation; |
| 61 class ResourceProvider; | 63 class ResourceProvider; |
| 62 class ResourceUpdateQueue; | 64 class ResourceUpdateQueue; |
| 63 class SharedBitmapManager; | 65 class SharedBitmapManager; |
| 64 class TaskGraphRunner; | 66 class TaskGraphRunner; |
| 65 class TopControlsManager; | 67 class TopControlsManager; |
| 66 class UIResourceRequest; | 68 class UIResourceRequest; |
| 67 struct PendingPageScaleAnimation; | 69 struct PendingPageScaleAnimation; |
| 68 struct RenderingStats; | 70 struct RenderingStats; |
| 69 struct ScrollAndScaleSet; | 71 struct ScrollAndScaleSet; |
| 70 enum class GpuRasterizationStatus; | 72 enum class GpuRasterizationStatus; |
| 71 | 73 |
| 72 class CC_EXPORT LayerTreeHost { | 74 class CC_EXPORT LayerTreeHost : public LayerTreeMutatorsClient { |
| 73 public: | 75 public: |
| 74 // The SharedBitmapManager will be used on the compositor thread. | 76 // The SharedBitmapManager will be used on the compositor thread. |
| 75 static scoped_ptr<LayerTreeHost> CreateThreaded( | 77 static scoped_ptr<LayerTreeHost> CreateThreaded( |
| 76 LayerTreeHostClient* client, | 78 LayerTreeHostClient* client, |
| 77 SharedBitmapManager* shared_bitmap_manager, | 79 SharedBitmapManager* shared_bitmap_manager, |
| 78 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, | 80 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, |
| 79 TaskGraphRunner* task_graph_runner, | 81 TaskGraphRunner* task_graph_runner, |
| 80 const LayerTreeSettings& settings, | 82 const LayerTreeSettings& settings, |
| 81 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, | 83 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, |
| 82 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner, | 84 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner, |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 TopControlsState current, | 252 TopControlsState current, |
| 251 bool animate); | 253 bool animate); |
| 252 | 254 |
| 253 HeadsUpDisplayLayer* hud_layer() const { return hud_layer_.get(); } | 255 HeadsUpDisplayLayer* hud_layer() const { return hud_layer_.get(); } |
| 254 | 256 |
| 255 Proxy* proxy() const { return proxy_.get(); } | 257 Proxy* proxy() const { return proxy_.get(); } |
| 256 | 258 |
| 257 AnimationRegistrar* animation_registrar() const { | 259 AnimationRegistrar* animation_registrar() const { |
| 258 return animation_registrar_.get(); | 260 return animation_registrar_.get(); |
| 259 } | 261 } |
| 262 AnimationHost* animation_host() const { return animation_host_.get(); } |
| 260 | 263 |
| 261 bool in_paint_layer_contents() const { return in_paint_layer_contents_; } | 264 bool in_paint_layer_contents() const { return in_paint_layer_contents_; } |
| 262 | 265 |
| 263 // CreateUIResource creates a resource given a bitmap. The bitmap is | 266 // CreateUIResource creates a resource given a bitmap. The bitmap is |
| 264 // generated via an interface function, which is called when initializing the | 267 // generated via an interface function, which is called when initializing the |
| 265 // resource and when the resource has been lost (due to lost context). The | 268 // resource and when the resource has been lost (due to lost context). The |
| 266 // parameter of the interface is a single boolean, which indicates whether the | 269 // parameter of the interface is a single boolean, which indicates whether the |
| 267 // resource has been lost or not. CreateUIResource returns an Id of the | 270 // resource has been lost or not. CreateUIResource returns an Id of the |
| 268 // resource, which is always positive. | 271 // resource, which is always positive. |
| 269 virtual UIResourceId CreateUIResource(UIResourceClient* client); | 272 virtual UIResourceId CreateUIResource(UIResourceClient* client); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 size_t num_queued_swap_promises() const { return swap_promise_list_.size(); } | 304 size_t num_queued_swap_promises() const { return swap_promise_list_.size(); } |
| 302 | 305 |
| 303 void set_surface_id_namespace(uint32_t id_namespace); | 306 void set_surface_id_namespace(uint32_t id_namespace); |
| 304 SurfaceSequence CreateSurfaceSequence(); | 307 SurfaceSequence CreateSurfaceSequence(); |
| 305 | 308 |
| 306 void SetChildrenNeedBeginFrames(bool children_need_begin_frames) const; | 309 void SetChildrenNeedBeginFrames(bool children_need_begin_frames) const; |
| 307 void SendBeginFramesToChildren(const BeginFrameArgs& args) const; | 310 void SendBeginFramesToChildren(const BeginFrameArgs& args) const; |
| 308 | 311 |
| 309 void SetAuthoritativeVSyncInterval(const base::TimeDelta& interval); | 312 void SetAuthoritativeVSyncInterval(const base::TimeDelta& interval); |
| 310 | 313 |
| 314 Layer* LayerById(int id) const; |
| 315 void RegisterLayer(Layer* layer); |
| 316 void UnregisterLayer(Layer* layer); |
| 317 // LayerTreeMutatorsClient implementation. |
| 318 bool IsLayerInActiveTree(int layer_id) const override; |
| 319 bool IsLayerInPendingTree(int layer_id) const override; |
| 320 void SetMutatorsNeedCommit() override; |
| 321 void SetLayerFilterMutated(int layer_id, |
| 322 bool active_tree, |
| 323 const FilterOperations& filters) override; |
| 324 void SetLayerOpacityMutated(int layer_id, |
| 325 bool active_tree, |
| 326 float opacity) override; |
| 327 void SetLayerTransformMutated(int layer_id, |
| 328 bool active_tree, |
| 329 const gfx::Transform& transform) override; |
| 330 void SetLayerScrollOffsetMutated( |
| 331 int layer_id, |
| 332 bool active_tree, |
| 333 const gfx::ScrollOffset& scroll_offset) override; |
| 334 |
| 311 protected: | 335 protected: |
| 312 LayerTreeHost(LayerTreeHostClient* client, | 336 LayerTreeHost(LayerTreeHostClient* client, |
| 313 SharedBitmapManager* shared_bitmap_manager, | 337 SharedBitmapManager* shared_bitmap_manager, |
| 314 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, | 338 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, |
| 315 TaskGraphRunner* task_graph_runner, | 339 TaskGraphRunner* task_graph_runner, |
| 316 const LayerTreeSettings& settings); | 340 const LayerTreeSettings& settings); |
| 317 void InitializeThreaded( | 341 void InitializeThreaded( |
| 318 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, | 342 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, |
| 319 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner, | 343 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner, |
| 320 scoped_ptr<BeginFrameSource> external_begin_frame_source); | 344 scoped_ptr<BeginFrameSource> external_begin_frame_source); |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 bool content_is_suitable_for_gpu_rasterization_; | 441 bool content_is_suitable_for_gpu_rasterization_; |
| 418 bool gpu_rasterization_histogram_recorded_; | 442 bool gpu_rasterization_histogram_recorded_; |
| 419 | 443 |
| 420 SkColor background_color_; | 444 SkColor background_color_; |
| 421 bool has_transparent_background_; | 445 bool has_transparent_background_; |
| 422 | 446 |
| 423 typedef ScopedPtrVector<PrioritizedResource> TextureList; | 447 typedef ScopedPtrVector<PrioritizedResource> TextureList; |
| 424 size_t partial_texture_update_requests_; | 448 size_t partial_texture_update_requests_; |
| 425 | 449 |
| 426 scoped_ptr<AnimationRegistrar> animation_registrar_; | 450 scoped_ptr<AnimationRegistrar> animation_registrar_; |
| 451 scoped_ptr<AnimationHost> animation_host_; |
| 427 | 452 |
| 428 scoped_ptr<PendingPageScaleAnimation> pending_page_scale_animation_; | 453 scoped_ptr<PendingPageScaleAnimation> pending_page_scale_animation_; |
| 429 | 454 |
| 430 // If set, then page scale animation has completed, but the client hasn't been | 455 // If set, then page scale animation has completed, but the client hasn't been |
| 431 // notified about it yet. | 456 // notified about it yet. |
| 432 bool did_complete_scale_animation_; | 457 bool did_complete_scale_animation_; |
| 433 | 458 |
| 434 bool in_paint_layer_contents_; | 459 bool in_paint_layer_contents_; |
| 435 | 460 |
| 436 int id_; | 461 int id_; |
| 437 bool next_commit_forces_redraw_; | 462 bool next_commit_forces_redraw_; |
| 438 | 463 |
| 439 scoped_refptr<Layer> overscroll_elasticity_layer_; | 464 scoped_refptr<Layer> overscroll_elasticity_layer_; |
| 440 scoped_refptr<Layer> page_scale_layer_; | 465 scoped_refptr<Layer> page_scale_layer_; |
| 441 scoped_refptr<Layer> inner_viewport_scroll_layer_; | 466 scoped_refptr<Layer> inner_viewport_scroll_layer_; |
| 442 scoped_refptr<Layer> outer_viewport_scroll_layer_; | 467 scoped_refptr<Layer> outer_viewport_scroll_layer_; |
| 443 | 468 |
| 444 LayerSelectionBound selection_start_; | 469 LayerSelectionBound selection_start_; |
| 445 LayerSelectionBound selection_end_; | 470 LayerSelectionBound selection_end_; |
| 446 | 471 |
| 447 SharedBitmapManager* shared_bitmap_manager_; | 472 SharedBitmapManager* shared_bitmap_manager_; |
| 448 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager_; | 473 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager_; |
| 449 TaskGraphRunner* task_graph_runner_; | 474 TaskGraphRunner* task_graph_runner_; |
| 450 | 475 |
| 451 ScopedPtrVector<SwapPromise> swap_promise_list_; | 476 ScopedPtrVector<SwapPromise> swap_promise_list_; |
| 452 std::set<SwapPromiseMonitor*> swap_promise_monitor_; | 477 std::set<SwapPromiseMonitor*> swap_promise_monitor_; |
| 453 | 478 |
| 479 typedef base::hash_map<int, Layer*> LayerIdMap; |
| 480 LayerIdMap layer_id_map_; |
| 481 |
| 454 uint32_t surface_id_namespace_; | 482 uint32_t surface_id_namespace_; |
| 455 uint32_t next_surface_sequence_; | 483 uint32_t next_surface_sequence_; |
| 456 | 484 |
| 457 DISALLOW_COPY_AND_ASSIGN(LayerTreeHost); | 485 DISALLOW_COPY_AND_ASSIGN(LayerTreeHost); |
| 458 }; | 486 }; |
| 459 | 487 |
| 460 } // namespace cc | 488 } // namespace cc |
| 461 | 489 |
| 462 #endif // CC_TREES_LAYER_TREE_HOST_H_ | 490 #endif // CC_TREES_LAYER_TREE_HOST_H_ |
| OLD | NEW |