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

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: Remove kEnableNewCompositorAnimations. Created 5 years, 9 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/layer_selection_bound.h" 29 #include "cc/input/layer_selection_bound.h"
30 #include "cc/input/scrollbar.h" 30 #include "cc/input/scrollbar.h"
31 #include "cc/input/top_controls_state.h" 31 #include "cc/input/top_controls_state.h"
32 #include "cc/layers/layer_lists.h" 32 #include "cc/layers/layer_lists.h"
33 #include "cc/output/output_surface.h" 33 #include "cc/output/output_surface.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 "third_party/skia/include/core/SkColor.h" 42 #include "third_party/skia/include/core/SkColor.h"
42 #include "ui/gfx/geometry/rect.h" 43 #include "ui/gfx/geometry/rect.h"
43 44
44 namespace gpu { 45 namespace gpu {
45 class GpuMemoryBufferManager; 46 class GpuMemoryBufferManager;
46 } 47 }
47 48
48 namespace cc { 49 namespace cc {
49 class AnimationRegistrar; 50 class AnimationRegistrar;
51 class AnimationTimeline;
50 class BeginFrameSource; 52 class BeginFrameSource;
51 class HeadsUpDisplayLayer; 53 class HeadsUpDisplayLayer;
52 class Layer; 54 class Layer;
53 class LayerTreeHostImpl; 55 class LayerTreeHostImpl;
54 class LayerTreeHostImplClient; 56 class LayerTreeHostImplClient;
55 class LayerTreeHostSingleThreadClient; 57 class LayerTreeHostSingleThreadClient;
56 class PrioritizedResource; 58 class PrioritizedResource;
57 class PrioritizedResourceManager; 59 class PrioritizedResourceManager;
58 class Region; 60 class Region;
59 class RenderingStatsInstrumentation; 61 class RenderingStatsInstrumentation;
(...skipping 18 matching lines...) Expand all
78 RendererCapabilities(); 80 RendererCapabilities();
79 ~RendererCapabilities(); 81 ~RendererCapabilities();
80 82
81 // Duplicate any modification to this list to RendererCapabilitiesImpl. 83 // Duplicate any modification to this list to RendererCapabilitiesImpl.
82 ResourceFormat best_texture_format; 84 ResourceFormat best_texture_format;
83 bool allow_partial_texture_updates; 85 bool allow_partial_texture_updates;
84 int max_texture_size; 86 int max_texture_size;
85 bool using_shared_memory_resources; 87 bool using_shared_memory_resources;
86 }; 88 };
87 89
88 class CC_EXPORT LayerTreeHost { 90 class CC_EXPORT LayerTreeHost : public LayerTreeMutatorsClient {
89 public: 91 public:
90 // The SharedBitmapManager will be used on the compositor thread. 92 // The SharedBitmapManager will be used on the compositor thread.
91 static scoped_ptr<LayerTreeHost> CreateThreaded( 93 static scoped_ptr<LayerTreeHost> CreateThreaded(
92 LayerTreeHostClient* client, 94 LayerTreeHostClient* client,
93 SharedBitmapManager* shared_bitmap_manager, 95 SharedBitmapManager* shared_bitmap_manager,
94 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, 96 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager,
95 const LayerTreeSettings& settings, 97 const LayerTreeSettings& settings,
96 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, 98 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
97 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner, 99 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner,
98 scoped_ptr<BeginFrameSource> external_begin_frame_source); 100 scoped_ptr<BeginFrameSource> external_begin_frame_source);
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 void SetNeedsRedraw(); 171 void SetNeedsRedraw();
170 void SetNeedsRedrawRect(const gfx::Rect& damage_rect); 172 void SetNeedsRedrawRect(const gfx::Rect& damage_rect);
171 bool CommitRequested() const; 173 bool CommitRequested() const;
172 bool BeginMainFrameRequested() const; 174 bool BeginMainFrameRequested() const;
173 175
174 void SetNextCommitWaitsForActivation(); 176 void SetNextCommitWaitsForActivation();
175 177
176 void SetNextCommitForcesRedraw(); 178 void SetNextCommitForcesRedraw();
177 179
178 void SetAnimationEvents(scoped_ptr<AnimationEventsVector> events); 180 void SetAnimationEvents(scoped_ptr<AnimationEventsVector> events);
181 void SetAnimationTimeline(scoped_refptr<AnimationTimeline> timeline);
179 182
180 void SetRootLayer(scoped_refptr<Layer> root_layer); 183 void SetRootLayer(scoped_refptr<Layer> root_layer);
181 Layer* root_layer() { return root_layer_.get(); } 184 Layer* root_layer() { return root_layer_.get(); }
182 const Layer* root_layer() const { return root_layer_.get(); } 185 const Layer* root_layer() const { return root_layer_.get(); }
183 const Layer* overscroll_elasticity_layer() const { 186 const Layer* overscroll_elasticity_layer() const {
184 return overscroll_elasticity_layer_.get(); 187 return overscroll_elasticity_layer_.get();
185 } 188 }
186 const Layer* page_scale_layer() const { return page_scale_layer_.get(); } 189 const Layer* page_scale_layer() const { return page_scale_layer_.get(); }
187 void RegisterViewportLayers(scoped_refptr<Layer> overscroll_elasticity_layer, 190 void RegisterViewportLayers(scoped_refptr<Layer> overscroll_elasticity_layer,
188 scoped_refptr<Layer> page_scale_layer, 191 scoped_refptr<Layer> page_scale_layer,
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 TopControlsState current, 267 TopControlsState current,
265 bool animate); 268 bool animate);
266 269
267 HeadsUpDisplayLayer* hud_layer() const { return hud_layer_.get(); } 270 HeadsUpDisplayLayer* hud_layer() const { return hud_layer_.get(); }
268 271
269 Proxy* proxy() const { return proxy_.get(); } 272 Proxy* proxy() const { return proxy_.get(); }
270 273
271 AnimationRegistrar* animation_registrar() const { 274 AnimationRegistrar* animation_registrar() const {
272 return animation_registrar_.get(); 275 return animation_registrar_.get();
273 } 276 }
277 AnimationTimeline* animation_timeline() const {
278 return animation_timeline_.get();
279 }
274 280
275 // Obtains a thorough dump of the LayerTreeHost as a value. 281 // Obtains a thorough dump of the LayerTreeHost as a value.
276 void AsValueInto(base::trace_event::TracedValue* value) const; 282 void AsValueInto(base::trace_event::TracedValue* value) const;
277 283
278 bool in_paint_layer_contents() const { return in_paint_layer_contents_; } 284 bool in_paint_layer_contents() const { return in_paint_layer_contents_; }
279 285
280 // CreateUIResource creates a resource given a bitmap. The bitmap is 286 // CreateUIResource creates a resource given a bitmap. The bitmap is
281 // generated via an interface function, which is called when initializing the 287 // generated via an interface function, which is called when initializing the
282 // resource and when the resource has been lost (due to lost context). The 288 // resource and when the resource has been lost (due to lost context). The
283 // parameter of the interface is a single boolean, which indicates whether the 289 // parameter of the interface is a single boolean, which indicates whether the
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 void BreakSwapPromises(SwapPromise::DidNotSwapReason reason); 322 void BreakSwapPromises(SwapPromise::DidNotSwapReason reason);
317 323
318 size_t num_queued_swap_promises() const { return swap_promise_list_.size(); } 324 size_t num_queued_swap_promises() const { return swap_promise_list_.size(); }
319 325
320 void set_surface_id_namespace(uint32_t id_namespace); 326 void set_surface_id_namespace(uint32_t id_namespace);
321 SurfaceSequence CreateSurfaceSequence(); 327 SurfaceSequence CreateSurfaceSequence();
322 328
323 void SetChildrenNeedBeginFrames(bool children_need_begin_frames) const; 329 void SetChildrenNeedBeginFrames(bool children_need_begin_frames) const;
324 void SendBeginFramesToChildren(const BeginFrameArgs& args) const; 330 void SendBeginFramesToChildren(const BeginFrameArgs& args) const;
325 331
332 Layer* LayerById(int id) const;
333 void RegisterLayer(Layer* layer);
334 void UnregisterLayer(Layer* layer);
335 // LayerTreeMutatorsClient implementation.
336 AnimationRegistrar* GetAnimationRegistrar() const override;
337 bool IsLayerInActiveTree(int layer_id) const override;
338 bool IsLayerInPendingTree(int layer_id) const override;
339 void SetMutatorsNeedCommit() override;
340 void SetLayerFilterMutated(int layer_id,
341 bool active_tree,
342 const FilterOperations& filters) override;
343 void SetLayerOpacityMutated(int layer_id,
344 bool active_tree,
345 float opacity) override;
346 void SetLayerTransformMutated(int layer_id,
347 bool active_tree,
348 const gfx::Transform& transform) override;
349
326 protected: 350 protected:
327 LayerTreeHost(LayerTreeHostClient* client, 351 LayerTreeHost(LayerTreeHostClient* client,
328 SharedBitmapManager* shared_bitmap_manager, 352 SharedBitmapManager* shared_bitmap_manager,
329 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, 353 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager,
330 const LayerTreeSettings& settings); 354 const LayerTreeSettings& settings);
331 void InitializeThreaded( 355 void InitializeThreaded(
332 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, 356 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
333 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner, 357 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner,
334 scoped_ptr<BeginFrameSource> external_begin_frame_source); 358 scoped_ptr<BeginFrameSource> external_begin_frame_source);
335 void InitializeSingleThreaded( 359 void InitializeSingleThreaded(
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 bool content_is_suitable_for_gpu_rasterization_; 455 bool content_is_suitable_for_gpu_rasterization_;
432 bool gpu_rasterization_histogram_recorded_; 456 bool gpu_rasterization_histogram_recorded_;
433 457
434 SkColor background_color_; 458 SkColor background_color_;
435 bool has_transparent_background_; 459 bool has_transparent_background_;
436 460
437 typedef ScopedPtrVector<PrioritizedResource> TextureList; 461 typedef ScopedPtrVector<PrioritizedResource> TextureList;
438 size_t partial_texture_update_requests_; 462 size_t partial_texture_update_requests_;
439 463
440 scoped_ptr<AnimationRegistrar> animation_registrar_; 464 scoped_ptr<AnimationRegistrar> animation_registrar_;
465 scoped_refptr<AnimationTimeline> animation_timeline_;
441 466
442 scoped_ptr<PendingPageScaleAnimation> pending_page_scale_animation_; 467 scoped_ptr<PendingPageScaleAnimation> pending_page_scale_animation_;
443 468
444 // If set, then page scale animation has completed, but the client hasn't been 469 // If set, then page scale animation has completed, but the client hasn't been
445 // notified about it yet. 470 // notified about it yet.
446 bool did_complete_scale_animation_; 471 bool did_complete_scale_animation_;
447 472
448 bool in_paint_layer_contents_; 473 bool in_paint_layer_contents_;
449 474
450 int id_; 475 int id_;
451 bool next_commit_forces_redraw_; 476 bool next_commit_forces_redraw_;
452 477
453 scoped_refptr<Layer> overscroll_elasticity_layer_; 478 scoped_refptr<Layer> overscroll_elasticity_layer_;
454 scoped_refptr<Layer> page_scale_layer_; 479 scoped_refptr<Layer> page_scale_layer_;
455 scoped_refptr<Layer> inner_viewport_scroll_layer_; 480 scoped_refptr<Layer> inner_viewport_scroll_layer_;
456 scoped_refptr<Layer> outer_viewport_scroll_layer_; 481 scoped_refptr<Layer> outer_viewport_scroll_layer_;
457 482
458 LayerSelectionBound selection_start_; 483 LayerSelectionBound selection_start_;
459 LayerSelectionBound selection_end_; 484 LayerSelectionBound selection_end_;
460 485
461 SharedBitmapManager* shared_bitmap_manager_; 486 SharedBitmapManager* shared_bitmap_manager_;
462 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager_; 487 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager_;
463 488
464 ScopedPtrVector<SwapPromise> swap_promise_list_; 489 ScopedPtrVector<SwapPromise> swap_promise_list_;
465 std::set<SwapPromiseMonitor*> swap_promise_monitor_; 490 std::set<SwapPromiseMonitor*> swap_promise_monitor_;
466 491
492 typedef base::hash_map<int, Layer*> LayerIdMap;
493 LayerIdMap layer_id_map_;
494
467 uint32_t surface_id_namespace_; 495 uint32_t surface_id_namespace_;
468 uint32_t next_surface_sequence_; 496 uint32_t next_surface_sequence_;
469 497
470 DISALLOW_COPY_AND_ASSIGN(LayerTreeHost); 498 DISALLOW_COPY_AND_ASSIGN(LayerTreeHost);
471 }; 499 };
472 500
473 } // namespace cc 501 } // namespace cc
474 502
475 #endif // CC_TREES_LAYER_TREE_HOST_H_ 503 #endif // CC_TREES_LAYER_TREE_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698