Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(553)

Side by Side Diff: cc/trees/layer_tree_host.h

Issue 947033002: CC Animations: Establish AnimationHost, AnimationTimeline and AnimationPlayer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Add comments. Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 PropertyTrees; 61 class PropertyTrees;
60 class Region; 62 class Region;
61 class RenderingStatsInstrumentation; 63 class RenderingStatsInstrumentation;
62 class ResourceProvider; 64 class ResourceProvider;
63 class ResourceUpdateQueue; 65 class ResourceUpdateQueue;
64 class SharedBitmapManager; 66 class SharedBitmapManager;
65 class TaskGraphRunner; 67 class TaskGraphRunner;
66 class TopControlsManager; 68 class TopControlsManager;
67 class UIResourceRequest; 69 class UIResourceRequest;
68 struct PendingPageScaleAnimation; 70 struct PendingPageScaleAnimation;
69 struct RenderingStats; 71 struct RenderingStats;
70 struct ScrollAndScaleSet; 72 struct ScrollAndScaleSet;
71 enum class GpuRasterizationStatus; 73 enum class GpuRasterizationStatus;
72 74
73 class CC_EXPORT LayerTreeHost { 75 class CC_EXPORT LayerTreeHost : public LayerTreeMutatorsClient {
74 public: 76 public:
75 // The SharedBitmapManager will be used on the compositor thread. 77 // The SharedBitmapManager will be used on the compositor thread.
76 static scoped_ptr<LayerTreeHost> CreateThreaded( 78 static scoped_ptr<LayerTreeHost> CreateThreaded(
77 LayerTreeHostClient* client, 79 LayerTreeHostClient* client,
78 SharedBitmapManager* shared_bitmap_manager, 80 SharedBitmapManager* shared_bitmap_manager,
79 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, 81 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager,
80 TaskGraphRunner* task_graph_runner, 82 TaskGraphRunner* task_graph_runner,
81 const LayerTreeSettings& settings, 83 const LayerTreeSettings& settings,
82 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, 84 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
83 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner, 85 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner,
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
311 PropertyTrees* property_trees() { return &property_trees_; } 314 PropertyTrees* property_trees() { return &property_trees_; }
312 315
316 Layer* LayerById(int id) const;
317 void RegisterLayer(Layer* layer);
318 void UnregisterLayer(Layer* layer);
319 // LayerTreeMutatorsClient implementation.
320 bool IsLayerInActiveTree(int layer_id) const override;
321 bool IsLayerInPendingTree(int layer_id) const override;
322 void SetMutatorsNeedCommit() override;
323 void SetLayerFilterMutated(int layer_id,
324 bool active_tree,
325 const FilterOperations& filters) override;
326 void SetLayerOpacityMutated(int layer_id,
327 bool active_tree,
328 float opacity) override;
329 void SetLayerTransformMutated(int layer_id,
330 bool active_tree,
331 const gfx::Transform& transform) override;
332 void SetLayerScrollOffsetMutated(
333 int layer_id,
334 bool active_tree,
335 const gfx::ScrollOffset& scroll_offset) override;
336
313 protected: 337 protected:
314 LayerTreeHost(LayerTreeHostClient* client, 338 LayerTreeHost(LayerTreeHostClient* client,
315 SharedBitmapManager* shared_bitmap_manager, 339 SharedBitmapManager* shared_bitmap_manager,
316 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, 340 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager,
317 TaskGraphRunner* task_graph_runner, 341 TaskGraphRunner* task_graph_runner,
318 const LayerTreeSettings& settings); 342 const LayerTreeSettings& settings);
319 void InitializeThreaded( 343 void InitializeThreaded(
320 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, 344 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
321 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner, 345 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner,
322 scoped_ptr<BeginFrameSource> external_begin_frame_source); 346 scoped_ptr<BeginFrameSource> external_begin_frame_source);
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
419 bool content_is_suitable_for_gpu_rasterization_; 443 bool content_is_suitable_for_gpu_rasterization_;
420 bool gpu_rasterization_histogram_recorded_; 444 bool gpu_rasterization_histogram_recorded_;
421 445
422 SkColor background_color_; 446 SkColor background_color_;
423 bool has_transparent_background_; 447 bool has_transparent_background_;
424 448
425 typedef ScopedPtrVector<PrioritizedResource> TextureList; 449 typedef ScopedPtrVector<PrioritizedResource> TextureList;
426 size_t partial_texture_update_requests_; 450 size_t partial_texture_update_requests_;
427 451
428 scoped_ptr<AnimationRegistrar> animation_registrar_; 452 scoped_ptr<AnimationRegistrar> animation_registrar_;
453 scoped_ptr<AnimationHost> animation_host_;
429 454
430 scoped_ptr<PendingPageScaleAnimation> pending_page_scale_animation_; 455 scoped_ptr<PendingPageScaleAnimation> pending_page_scale_animation_;
431 456
432 // If set, then page scale animation has completed, but the client hasn't been 457 // If set, then page scale animation has completed, but the client hasn't been
433 // notified about it yet. 458 // notified about it yet.
434 bool did_complete_scale_animation_; 459 bool did_complete_scale_animation_;
435 460
436 bool in_paint_layer_contents_; 461 bool in_paint_layer_contents_;
437 462
438 int id_; 463 int id_;
439 bool next_commit_forces_redraw_; 464 bool next_commit_forces_redraw_;
440 465
441 scoped_refptr<Layer> overscroll_elasticity_layer_; 466 scoped_refptr<Layer> overscroll_elasticity_layer_;
442 scoped_refptr<Layer> page_scale_layer_; 467 scoped_refptr<Layer> page_scale_layer_;
443 scoped_refptr<Layer> inner_viewport_scroll_layer_; 468 scoped_refptr<Layer> inner_viewport_scroll_layer_;
444 scoped_refptr<Layer> outer_viewport_scroll_layer_; 469 scoped_refptr<Layer> outer_viewport_scroll_layer_;
445 470
446 LayerSelection selection_; 471 LayerSelection selection_;
447 472
448 SharedBitmapManager* shared_bitmap_manager_; 473 SharedBitmapManager* shared_bitmap_manager_;
449 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager_; 474 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager_;
450 TaskGraphRunner* task_graph_runner_; 475 TaskGraphRunner* task_graph_runner_;
451 476
452 ScopedPtrVector<SwapPromise> swap_promise_list_; 477 ScopedPtrVector<SwapPromise> swap_promise_list_;
453 std::set<SwapPromiseMonitor*> swap_promise_monitor_; 478 std::set<SwapPromiseMonitor*> swap_promise_monitor_;
454 479
455 PropertyTrees property_trees_; 480 PropertyTrees property_trees_;
456 481
482 typedef base::hash_map<int, Layer*> LayerIdMap;
483 LayerIdMap layer_id_map_;
484
457 uint32_t surface_id_namespace_; 485 uint32_t surface_id_namespace_;
458 uint32_t next_surface_sequence_; 486 uint32_t next_surface_sequence_;
459 487
460 DISALLOW_COPY_AND_ASSIGN(LayerTreeHost); 488 DISALLOW_COPY_AND_ASSIGN(LayerTreeHost);
461 }; 489 };
462 490
463 } // namespace cc 491 } // namespace cc
464 492
465 #endif // CC_TREES_LAYER_TREE_HOST_H_ 493 #endif // CC_TREES_LAYER_TREE_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698