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

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: Fix code review issues. Rebase. Created 5 years, 6 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 19 matching lines...) Expand all
30 #include "cc/input/top_controls_state.h" 30 #include "cc/input/top_controls_state.h"
31 #include "cc/layers/layer_lists.h" 31 #include "cc/layers/layer_lists.h"
32 #include "cc/output/output_surface.h" 32 #include "cc/output/output_surface.h"
33 #include "cc/output/renderer_capabilities.h" 33 #include "cc/output/renderer_capabilities.h"
34 #include "cc/output/swap_promise.h" 34 #include "cc/output/swap_promise.h"
35 #include "cc/resources/resource_format.h" 35 #include "cc/resources/resource_format.h"
36 #include "cc/resources/scoped_ui_resource.h" 36 #include "cc/resources/scoped_ui_resource.h"
37 #include "cc/surfaces/surface_sequence.h" 37 #include "cc/surfaces/surface_sequence.h"
38 #include "cc/trees/layer_tree_host_client.h" 38 #include "cc/trees/layer_tree_host_client.h"
39 #include "cc/trees/layer_tree_host_common.h" 39 #include "cc/trees/layer_tree_host_common.h"
40 #include "cc/trees/layer_tree_mutators_client.h"
40 #include "cc/trees/layer_tree_settings.h" 41 #include "cc/trees/layer_tree_settings.h"
41 #include "cc/trees/proxy.h" 42 #include "cc/trees/proxy.h"
42 #include "cc/trees/swap_promise_monitor.h" 43 #include "cc/trees/swap_promise_monitor.h"
43 #include "third_party/skia/include/core/SkColor.h" 44 #include "third_party/skia/include/core/SkColor.h"
44 #include "ui/gfx/geometry/rect.h" 45 #include "ui/gfx/geometry/rect.h"
45 46
46 namespace gpu { 47 namespace gpu {
47 class GpuMemoryBufferManager; 48 class GpuMemoryBufferManager;
48 } 49 }
49 50
50 namespace cc { 51 namespace cc {
51 class AnimationRegistrar; 52 class AnimationRegistrar;
53 class AnimationHost;
52 class BeginFrameSource; 54 class BeginFrameSource;
53 class HeadsUpDisplayLayer; 55 class HeadsUpDisplayLayer;
54 class Layer; 56 class Layer;
55 class LayerTreeHostImpl; 57 class LayerTreeHostImpl;
56 class LayerTreeHostImplClient; 58 class LayerTreeHostImplClient;
57 class LayerTreeHostSingleThreadClient; 59 class LayerTreeHostSingleThreadClient;
58 class PrioritizedResource; 60 class PrioritizedResource;
59 class PrioritizedResourceManager; 61 class PrioritizedResourceManager;
60 class PropertyTrees; 62 class PropertyTrees;
61 class Region; 63 class Region;
62 class RenderingStatsInstrumentation; 64 class RenderingStatsInstrumentation;
63 class ResourceProvider; 65 class ResourceProvider;
64 class ResourceUpdateQueue; 66 class ResourceUpdateQueue;
65 class SharedBitmapManager; 67 class SharedBitmapManager;
66 class TaskGraphRunner; 68 class TaskGraphRunner;
67 class TopControlsManager; 69 class TopControlsManager;
68 class UIResourceRequest; 70 class UIResourceRequest;
69 struct PendingPageScaleAnimation; 71 struct PendingPageScaleAnimation;
70 struct RenderingStats; 72 struct RenderingStats;
71 struct ScrollAndScaleSet; 73 struct ScrollAndScaleSet;
72 74
73 class CC_EXPORT LayerTreeHost { 75 class CC_EXPORT LayerTreeHost : public LayerTreeMutatorsClient {
74 public: 76 public:
75 // TODO(sad): InitParams should be a movable type so that it can be 77 // TODO(sad): InitParams should be a movable type so that it can be
76 // std::move()d to the Create* functions. 78 // std::move()d to the Create* functions.
77 struct CC_EXPORT InitParams { 79 struct CC_EXPORT InitParams {
78 LayerTreeHostClient* client = nullptr; 80 LayerTreeHostClient* client = nullptr;
79 SharedBitmapManager* shared_bitmap_manager = nullptr; 81 SharedBitmapManager* shared_bitmap_manager = nullptr;
80 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager = nullptr; 82 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager = nullptr;
81 TaskGraphRunner* task_graph_runner = nullptr; 83 TaskGraphRunner* task_graph_runner = nullptr;
82 LayerTreeSettings const* settings = nullptr; 84 LayerTreeSettings const* settings = nullptr;
83 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner; 85 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner;
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 TopControlsState current, 263 TopControlsState current,
262 bool animate); 264 bool animate);
263 265
264 HeadsUpDisplayLayer* hud_layer() const { return hud_layer_.get(); } 266 HeadsUpDisplayLayer* hud_layer() const { return hud_layer_.get(); }
265 267
266 Proxy* proxy() const { return proxy_.get(); } 268 Proxy* proxy() const { return proxy_.get(); }
267 269
268 AnimationRegistrar* animation_registrar() const { 270 AnimationRegistrar* animation_registrar() const {
269 return animation_registrar_.get(); 271 return animation_registrar_.get();
270 } 272 }
273 AnimationHost* animation_host() const { return animation_host_.get(); }
271 274
272 bool in_paint_layer_contents() const { return in_paint_layer_contents_; } 275 bool in_paint_layer_contents() const { return in_paint_layer_contents_; }
273 276
274 // CreateUIResource creates a resource given a bitmap. The bitmap is 277 // CreateUIResource creates a resource given a bitmap. The bitmap is
275 // generated via an interface function, which is called when initializing the 278 // generated via an interface function, which is called when initializing the
276 // resource and when the resource has been lost (due to lost context). The 279 // resource and when the resource has been lost (due to lost context). The
277 // parameter of the interface is a single boolean, which indicates whether the 280 // parameter of the interface is a single boolean, which indicates whether the
278 // resource has been lost or not. CreateUIResource returns an Id of the 281 // resource has been lost or not. CreateUIResource returns an Id of the
279 // resource, which is always positive. 282 // resource, which is always positive.
280 virtual UIResourceId CreateUIResource(UIResourceClient* client); 283 virtual UIResourceId CreateUIResource(UIResourceClient* client);
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 // If this is true, only property trees will be used for main thread CDP. 330 // If this is true, only property trees will be used for main thread CDP.
328 // CDP will not be run, and verify_property_trees will be ignored. 331 // CDP will not be run, and verify_property_trees will be ignored.
329 bool using_only_property_trees() const { 332 bool using_only_property_trees() const {
330 return settings().impl_side_painting; 333 return settings().impl_side_painting;
331 } 334 }
332 335
333 void RecordFrameTimingEvents( 336 void RecordFrameTimingEvents(
334 scoped_ptr<FrameTimingTracker::CompositeTimingSet> composite_events, 337 scoped_ptr<FrameTimingTracker::CompositeTimingSet> composite_events,
335 scoped_ptr<FrameTimingTracker::MainFrameTimingSet> main_frame_events); 338 scoped_ptr<FrameTimingTracker::MainFrameTimingSet> main_frame_events);
336 339
340 Layer* LayerById(int id) const;
341 void RegisterLayer(Layer* layer);
342 void UnregisterLayer(Layer* layer);
343 // LayerTreeMutatorsClient implementation.
344 bool IsLayerInTree(int layer_id, LayerTreeType tree_type) const override;
345 void SetMutatorsNeedCommit() override;
346 void SetLayerFilterMutated(int layer_id,
347 LayerTreeType tree_type,
348 const FilterOperations& filters) override;
349 void SetLayerOpacityMutated(int layer_id,
350 LayerTreeType tree_type,
351 float opacity) override;
352 void SetLayerTransformMutated(int layer_id,
353 LayerTreeType tree_type,
354 const gfx::Transform& transform) override;
355 void SetLayerScrollOffsetMutated(
356 int layer_id,
357 LayerTreeType tree_type,
358 const gfx::ScrollOffset& scroll_offset) override;
359
337 protected: 360 protected:
338 explicit LayerTreeHost(InitParams* params); 361 explicit LayerTreeHost(InitParams* params);
339 void InitializeThreaded( 362 void InitializeThreaded(
340 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, 363 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
341 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner, 364 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner,
342 scoped_ptr<BeginFrameSource> external_begin_frame_source); 365 scoped_ptr<BeginFrameSource> external_begin_frame_source);
343 void InitializeSingleThreaded( 366 void InitializeSingleThreaded(
344 LayerTreeHostSingleThreadClient* single_thread_client, 367 LayerTreeHostSingleThreadClient* single_thread_client,
345 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, 368 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
346 scoped_ptr<BeginFrameSource> external_begin_frame_source); 369 scoped_ptr<BeginFrameSource> external_begin_frame_source);
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 bool content_is_suitable_for_gpu_rasterization_; 475 bool content_is_suitable_for_gpu_rasterization_;
453 bool gpu_rasterization_histogram_recorded_; 476 bool gpu_rasterization_histogram_recorded_;
454 477
455 SkColor background_color_; 478 SkColor background_color_;
456 bool has_transparent_background_; 479 bool has_transparent_background_;
457 480
458 typedef ScopedPtrVector<PrioritizedResource> TextureList; 481 typedef ScopedPtrVector<PrioritizedResource> TextureList;
459 size_t partial_texture_update_requests_; 482 size_t partial_texture_update_requests_;
460 483
461 scoped_ptr<AnimationRegistrar> animation_registrar_; 484 scoped_ptr<AnimationRegistrar> animation_registrar_;
485 scoped_ptr<AnimationHost> animation_host_;
462 486
463 scoped_ptr<PendingPageScaleAnimation> pending_page_scale_animation_; 487 scoped_ptr<PendingPageScaleAnimation> pending_page_scale_animation_;
464 488
465 // If set, then page scale animation has completed, but the client hasn't been 489 // If set, then page scale animation has completed, but the client hasn't been
466 // notified about it yet. 490 // notified about it yet.
467 bool did_complete_scale_animation_; 491 bool did_complete_scale_animation_;
468 492
469 bool in_paint_layer_contents_; 493 bool in_paint_layer_contents_;
470 494
471 int id_; 495 int id_;
472 bool next_commit_forces_redraw_; 496 bool next_commit_forces_redraw_;
473 497
474 scoped_refptr<Layer> overscroll_elasticity_layer_; 498 scoped_refptr<Layer> overscroll_elasticity_layer_;
475 scoped_refptr<Layer> page_scale_layer_; 499 scoped_refptr<Layer> page_scale_layer_;
476 scoped_refptr<Layer> inner_viewport_scroll_layer_; 500 scoped_refptr<Layer> inner_viewport_scroll_layer_;
477 scoped_refptr<Layer> outer_viewport_scroll_layer_; 501 scoped_refptr<Layer> outer_viewport_scroll_layer_;
478 502
479 LayerSelection selection_; 503 LayerSelection selection_;
480 504
481 SharedBitmapManager* shared_bitmap_manager_; 505 SharedBitmapManager* shared_bitmap_manager_;
482 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager_; 506 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager_;
483 TaskGraphRunner* task_graph_runner_; 507 TaskGraphRunner* task_graph_runner_;
484 508
485 ScopedPtrVector<SwapPromise> swap_promise_list_; 509 ScopedPtrVector<SwapPromise> swap_promise_list_;
486 std::set<SwapPromiseMonitor*> swap_promise_monitor_; 510 std::set<SwapPromiseMonitor*> swap_promise_monitor_;
487 511
488 PropertyTrees property_trees_; 512 PropertyTrees property_trees_;
489 513
514 typedef base::hash_map<int, Layer*> LayerIdMap;
515 LayerIdMap layer_id_map_;
516
490 uint32_t surface_id_namespace_; 517 uint32_t surface_id_namespace_;
491 uint32_t next_surface_sequence_; 518 uint32_t next_surface_sequence_;
492 519
493 DISALLOW_COPY_AND_ASSIGN(LayerTreeHost); 520 DISALLOW_COPY_AND_ASSIGN(LayerTreeHost);
494 }; 521 };
495 522
496 } // namespace cc 523 } // namespace cc
497 524
498 #endif // CC_TREES_LAYER_TREE_HOST_H_ 525 #endif // CC_TREES_LAYER_TREE_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698