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

Side by Side Diff: cc/layers/layer.h

Issue 1101823002: CC Animations: Make LayerAnimationController creation optional (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Plumb LayerSettings parameter for cc::Layer construction. 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 2010 The Chromium Authors. All rights reserved. 1 // Copyright 2010 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_LAYERS_LAYER_H_ 5 #ifndef CC_LAYERS_LAYER_H_
6 #define CC_LAYERS_LAYER_H_ 6 #define CC_LAYERS_LAYER_H_
7 7
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 51
52 namespace cc { 52 namespace cc {
53 53
54 class Animation; 54 class Animation;
55 class AnimationDelegate; 55 class AnimationDelegate;
56 struct AnimationEvent; 56 struct AnimationEvent;
57 class CopyOutputRequest; 57 class CopyOutputRequest;
58 class LayerAnimationEventObserver; 58 class LayerAnimationEventObserver;
59 class LayerClient; 59 class LayerClient;
60 class LayerImpl; 60 class LayerImpl;
61 class LayerSettings;
61 class LayerTreeHost; 62 class LayerTreeHost;
62 class LayerTreeHostCommon; 63 class LayerTreeHostCommon;
63 class LayerTreeImpl; 64 class LayerTreeImpl;
65 class LayerTreeSettings;
64 class PriorityCalculator; 66 class PriorityCalculator;
65 class RenderingStatsInstrumentation; 67 class RenderingStatsInstrumentation;
66 class ResourceUpdateQueue; 68 class ResourceUpdateQueue;
67 class ScrollbarLayerInterface; 69 class ScrollbarLayerInterface;
68 class SimpleEnclosedRegion; 70 class SimpleEnclosedRegion;
69 struct AnimationEvent; 71 struct AnimationEvent;
70 template <typename LayerType> 72 template <typename LayerType>
71 class OcclusionTracker; 73 class OcclusionTracker;
72 74
73 // Base class for composited layers. Special layer types are derived from 75 // Base class for composited layers. Special layer types are derived from
74 // this class. 76 // this class.
75 class CC_EXPORT Layer : public base::RefCounted<Layer>, 77 class CC_EXPORT Layer : public base::RefCounted<Layer>,
76 public LayerAnimationValueObserver, 78 public LayerAnimationValueObserver,
77 public LayerAnimationValueProvider { 79 public LayerAnimationValueProvider {
78 public: 80 public:
79 typedef RenderSurfaceLayerList RenderSurfaceListType; 81 typedef RenderSurfaceLayerList RenderSurfaceListType;
80 typedef LayerList LayerListType; 82 typedef LayerList LayerListType;
81 typedef RenderSurface RenderSurfaceType; 83 typedef RenderSurface RenderSurfaceType;
82 84
83 enum LayerIdLabels { 85 enum LayerIdLabels {
84 INVALID_ID = -1, 86 INVALID_ID = -1,
85 }; 87 };
86 88
87 static scoped_refptr<Layer> Create(); 89 static scoped_refptr<Layer> Create(const LayerSettings& settings);
88 90
89 int id() const { return layer_id_; } 91 int id() const { return layer_id_; }
90 92
91 Layer* RootLayer(); 93 Layer* RootLayer();
92 Layer* parent() { return parent_; } 94 Layer* parent() { return parent_; }
93 const Layer* parent() const { return parent_; } 95 const Layer* parent() const { return parent_; }
94 void AddChild(scoped_refptr<Layer> child); 96 void AddChild(scoped_refptr<Layer> child);
95 void InsertChild(scoped_refptr<Layer> child, size_t index); 97 void InsertChild(scoped_refptr<Layer> child, size_t index);
96 void ReplaceChild(Layer* reference, scoped_refptr<Layer> new_layer); 98 void ReplaceChild(Layer* reference, scoped_refptr<Layer> new_layer);
97 void RemoveFromParent(); 99 void RemoveFromParent();
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 void RemoveAnimation(int animation_id); 419 void RemoveAnimation(int animation_id);
418 void RemoveAnimation(int animation_id, Animation::TargetProperty property); 420 void RemoveAnimation(int animation_id, Animation::TargetProperty property);
419 421
420 LayerAnimationController* layer_animation_controller() { 422 LayerAnimationController* layer_animation_controller() {
421 return layer_animation_controller_.get(); 423 return layer_animation_controller_.get();
422 } 424 }
423 void SetLayerAnimationControllerForTest( 425 void SetLayerAnimationControllerForTest(
424 scoped_refptr<LayerAnimationController> controller); 426 scoped_refptr<LayerAnimationController> controller);
425 427
426 void set_layer_animation_delegate(AnimationDelegate* delegate) { 428 void set_layer_animation_delegate(AnimationDelegate* delegate) {
429 DCHECK(layer_animation_controller_);
427 layer_animation_controller_->set_layer_animation_delegate(delegate); 430 layer_animation_controller_->set_layer_animation_delegate(delegate);
428 } 431 }
429 432
430 bool HasActiveAnimation() const; 433 bool HasActiveAnimation() const;
434 void RegisterForAnimations(AnimationRegistrar* registrar);
431 435
432 void AddLayerAnimationEventObserver( 436 void AddLayerAnimationEventObserver(
433 LayerAnimationEventObserver* animation_observer); 437 LayerAnimationEventObserver* animation_observer);
434 void RemoveLayerAnimationEventObserver( 438 void RemoveLayerAnimationEventObserver(
435 LayerAnimationEventObserver* animation_observer); 439 LayerAnimationEventObserver* animation_observer);
436 440
437 virtual SimpleEnclosedRegion VisibleContentOpaqueRegion() const; 441 virtual SimpleEnclosedRegion VisibleContentOpaqueRegion() const;
438 442
439 virtual ScrollbarLayerInterface* ToScrollbarLayer(); 443 virtual ScrollbarLayerInterface* ToScrollbarLayer();
440 444
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
551 return frame_timing_requests_; 555 return frame_timing_requests_;
552 } 556 }
553 557
554 void DidBeginTracing(); 558 void DidBeginTracing();
555 559
556 protected: 560 protected:
557 friend class LayerImpl; 561 friend class LayerImpl;
558 friend class TreeSynchronizer; 562 friend class TreeSynchronizer;
559 ~Layer() override; 563 ~Layer() override;
560 564
561 Layer(); 565 explicit Layer(const LayerSettings& settings);
562 566
563 // These SetNeeds functions are in order of severity of update: 567 // These SetNeeds functions are in order of severity of update:
564 // 568 //
565 // Called when this layer has been modified in some way, but isn't sure 569 // Called when this layer has been modified in some way, but isn't sure
566 // that it needs a commit yet. It needs CalcDrawProperties and UpdateLayers 570 // that it needs a commit yet. It needs CalcDrawProperties and UpdateLayers
567 // before it knows whether or not a commit is required. 571 // before it knows whether or not a commit is required.
568 void SetNeedsUpdate(); 572 void SetNeedsUpdate();
569 // Called when a property has been modified in a way that the layer 573 // Called when a property has been modified in a way that the layer
570 // knows immediately that a commit is required. This implies SetNeedsUpdate 574 // knows immediately that a commit is required. This implies SetNeedsUpdate
571 // as well as SetNeedsPushProperties to push that property. 575 // as well as SetNeedsPushProperties to push that property.
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
754 758
755 std::vector<FrameTimingRequest> frame_timing_requests_; 759 std::vector<FrameTimingRequest> frame_timing_requests_;
756 bool frame_timing_requests_dirty_; 760 bool frame_timing_requests_dirty_;
757 761
758 DISALLOW_COPY_AND_ASSIGN(Layer); 762 DISALLOW_COPY_AND_ASSIGN(Layer);
759 }; 763 };
760 764
761 } // namespace cc 765 } // namespace cc
762 766
763 #endif // CC_LAYERS_LAYER_H_ 767 #endif // CC_LAYERS_LAYER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698