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

Side by Side Diff: ui/compositor/layer_animator.h

Issue 1898683002: CC Animation: Erase LayerAnimationEventObserver. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@eventobserver
Patch Set: Created 4 years, 8 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
« no previous file with comments | « ui/compositor/layer_animation_sequence_unittest.cc ('k') | ui/compositor/layer_animator.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 UI_COMPOSITOR_LAYER_ANIMATOR_H_ 5 #ifndef UI_COMPOSITOR_LAYER_ANIMATOR_H_
6 #define UI_COMPOSITOR_LAYER_ANIMATOR_H_ 6 #define UI_COMPOSITOR_LAYER_ANIMATOR_H_
7 7
8 #include <deque> 8 #include <deque>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "base/gtest_prod_util.h" 12 #include "base/gtest_prod_util.h"
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/memory/linked_ptr.h" 14 #include "base/memory/linked_ptr.h"
15 #include "base/memory/ref_counted.h" 15 #include "base/memory/ref_counted.h"
16 #include "base/observer_list.h" 16 #include "base/observer_list.h"
17 #include "base/time/time.h" 17 #include "base/time/time.h"
18 #include "cc/animation/layer_animation_event_observer.h" 18 #include "cc/animation/animation_delegate.h"
19 #include "cc/animation/target_property.h"
19 #include "ui/compositor/compositor_export.h" 20 #include "ui/compositor/compositor_export.h"
20 #include "ui/compositor/layer_animation_element.h" 21 #include "ui/compositor/layer_animation_element.h"
21 #include "ui/compositor/layer_threaded_animation_delegate.h" 22 #include "ui/compositor/layer_threaded_animation_delegate.h"
22 #include "ui/gfx/animation/tween.h" 23 #include "ui/gfx/animation/tween.h"
23 24
24 namespace cc { 25 namespace cc {
25 class Animation; 26 class Animation;
26 class AnimationPlayer; 27 class AnimationPlayer;
27 class AnimationTimeline; 28 class AnimationTimeline;
28 class Layer; 29 class Layer;
(...skipping 20 matching lines...) Expand all
49 // NB: during many tests, set_disable_animations_for_test is used and causes 50 // NB: during many tests, set_disable_animations_for_test is used and causes
50 // all animations to complete immediately. The layer animation is ref counted 51 // all animations to complete immediately. The layer animation is ref counted
51 // so that if its owning layer is deleted (and the owning layer is only other 52 // so that if its owning layer is deleted (and the owning layer is only other
52 // class that should ever hold a ref ptr to a LayerAnimator), the animator can 53 // class that should ever hold a ref ptr to a LayerAnimator), the animator can
53 // ensure that it is not disposed of until it finishes executing. It does this 54 // ensure that it is not disposed of until it finishes executing. It does this
54 // by holding a reference to itself for the duration of methods for which it 55 // by holding a reference to itself for the duration of methods for which it
55 // must guarantee that |this| is valid. 56 // must guarantee that |this| is valid.
56 class COMPOSITOR_EXPORT LayerAnimator 57 class COMPOSITOR_EXPORT LayerAnimator
57 : public base::RefCounted<LayerAnimator>, 58 : public base::RefCounted<LayerAnimator>,
58 public LayerThreadedAnimationDelegate, 59 public LayerThreadedAnimationDelegate,
59 NON_EXPORTED_BASE(public cc::LayerAnimationEventObserver) { 60 NON_EXPORTED_BASE(public cc::AnimationDelegate) {
60 public: 61 public:
61 enum PreemptionStrategy { 62 enum PreemptionStrategy {
62 IMMEDIATELY_SET_NEW_TARGET, 63 IMMEDIATELY_SET_NEW_TARGET,
63 IMMEDIATELY_ANIMATE_TO_NEW_TARGET, 64 IMMEDIATELY_ANIMATE_TO_NEW_TARGET,
64 ENQUEUE_NEW_ANIMATION, 65 ENQUEUE_NEW_ANIMATION,
65 REPLACE_QUEUED_ANIMATIONS, 66 REPLACE_QUEUED_ANIMATIONS,
66 BLEND_WITH_CURRENT_ANIMATION 67 BLEND_WITH_CURRENT_ANIMATION
67 }; 68 };
68 69
69 explicit LayerAnimator(base::TimeDelta transition_duration); 70 explicit LayerAnimator(base::TimeDelta transition_duration);
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 // This is similar to StopAnimating, but aborts rather than finishes the 190 // This is similar to StopAnimating, but aborts rather than finishes the
190 // animations and notifies all observers. 191 // animations and notifies all observers.
191 void AbortAllAnimations() { StopAnimatingInternal(true); } 192 void AbortAllAnimations() { StopAnimatingInternal(true); }
192 193
193 // These functions are used for adding or removing observers from the observer 194 // These functions are used for adding or removing observers from the observer
194 // list. The observers are notified when animations end. 195 // list. The observers are notified when animations end.
195 void AddObserver(LayerAnimationObserver* observer); 196 void AddObserver(LayerAnimationObserver* observer);
196 void RemoveObserver(LayerAnimationObserver* observer); 197 void RemoveObserver(LayerAnimationObserver* observer);
197 198
198 // Called when a threaded animation is actually started. 199 // Called when a threaded animation is actually started.
199 void OnThreadedAnimationStarted(const cc::AnimationEvent& event); 200 void OnThreadedAnimationStarted(base::TimeTicks monotonic_time,
201 cc::TargetProperty::Type target_property,
202 int group_id);
200 203
201 // This determines how implicit animations will be tweened. This has no 204 // This determines how implicit animations will be tweened. This has no
202 // effect on animations that are explicitly started or scheduled. The default 205 // effect on animations that are explicitly started or scheduled. The default
203 // is Tween::LINEAR. 206 // is Tween::LINEAR.
204 void set_tween_type(gfx::Tween::Type tween_type) { tween_type_ = tween_type; } 207 void set_tween_type(gfx::Tween::Type tween_type) { tween_type_ = tween_type; }
205 gfx::Tween::Type tween_type() const { return tween_type_; } 208 gfx::Tween::Type tween_type() const { return tween_type_; }
206 209
207 // For testing purposes only. 210 // For testing purposes only.
208 void set_disable_timer_for_test(bool disable_timer) { 211 void set_disable_timer_for_test(bool disable_timer) {
209 disable_timer_for_test_ = disable_timer; 212 disable_timer_for_test_ = disable_timer;
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 335
333 // Clears the animation queues and notifies any running animations that they 336 // Clears the animation queues and notifies any running animations that they
334 // have been aborted. 337 // have been aborted.
335 void ClearAnimationsInternal(); 338 void ClearAnimationsInternal();
336 339
337 // Cleans up any running animations that may have been deleted. 340 // Cleans up any running animations that may have been deleted.
338 void PurgeDeletedAnimations(); 341 void PurgeDeletedAnimations();
339 342
340 LayerAnimatorCollection* GetLayerAnimatorCollection(); 343 LayerAnimatorCollection* GetLayerAnimatorCollection();
341 344
342 // LayerAnimationEventObserver 345 // cc::AnimationDelegate implementation.
343 void OnAnimationStarted(const cc::AnimationEvent& event) override; 346 void NotifyAnimationStarted(base::TimeTicks monotonic_time,
347 cc::TargetProperty::Type target_property,
348 int group_id) override;
349 void NotifyAnimationFinished(base::TimeTicks monotonic_time,
350 cc::TargetProperty::Type target_property,
351 int group_id) override {}
352 void NotifyAnimationAborted(base::TimeTicks monotonic_time,
353 cc::TargetProperty::Type target_property,
354 int group_id) override {}
355 void NotifyAnimationTakeover(
356 base::TimeTicks monotonic_time,
357 cc::TargetProperty::Type target_property,
358 double animation_start_time,
359 std::unique_ptr<cc::AnimationCurve> curve) override {}
344 360
345 // Implementation of LayerThreadedAnimationDelegate. 361 // Implementation of LayerThreadedAnimationDelegate.
346 void AddThreadedAnimation(std::unique_ptr<cc::Animation> animation) override; 362 void AddThreadedAnimation(std::unique_ptr<cc::Animation> animation) override;
347 void RemoveThreadedAnimation(int animation_id) override; 363 void RemoveThreadedAnimation(int animation_id) override;
348 364
349 void AttachLayerToAnimationPlayer(int layer_id); 365 void AttachLayerToAnimationPlayer(int layer_id);
350 void DetachLayerFromAnimationPlayer(); 366 void DetachLayerFromAnimationPlayer();
351 367
352 // This is the queue of animations to run. 368 // This is the queue of animations to run.
353 AnimationQueue animation_queue_; 369 AnimationQueue animation_queue_;
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 // ResetCompositor/SetCompositor scope. 412 // ResetCompositor/SetCompositor scope.
397 // TODO(loyso): Remove it. crbug.com/592873. 413 // TODO(loyso): Remove it. crbug.com/592873.
398 scoped_refptr<cc::LayerAnimationController> animation_controller_state_; 414 scoped_refptr<cc::LayerAnimationController> animation_controller_state_;
399 415
400 DISALLOW_COPY_AND_ASSIGN(LayerAnimator); 416 DISALLOW_COPY_AND_ASSIGN(LayerAnimator);
401 }; 417 };
402 418
403 } // namespace ui 419 } // namespace ui
404 420
405 #endif // UI_COMPOSITOR_LAYER_ANIMATOR_H_ 421 #endif // UI_COMPOSITOR_LAYER_ANIMATOR_H_
OLDNEW
« no previous file with comments | « ui/compositor/layer_animation_sequence_unittest.cc ('k') | ui/compositor/layer_animator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698