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

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

Issue 2631333002: [animations] Adds metrics for jank on selected layer animations (Closed)
Patch Set: Adds UMA reporting for ripples and overview mode (query refresh rate) Created 3 years, 10 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_animator.h ('k') | ui/compositor/layer_unittest.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 #include "ui/compositor/layer_animator.h" 5 #include "ui/compositor/layer_animator.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory> 9 #include <memory>
10 10
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 // LayerAnimator public -------------------------------------------------------- 46 // LayerAnimator public --------------------------------------------------------
47 47
48 LayerAnimator::LayerAnimator(base::TimeDelta transition_duration) 48 LayerAnimator::LayerAnimator(base::TimeDelta transition_duration)
49 : delegate_(NULL), 49 : delegate_(NULL),
50 preemption_strategy_(IMMEDIATELY_SET_NEW_TARGET), 50 preemption_strategy_(IMMEDIATELY_SET_NEW_TARGET),
51 is_transition_duration_locked_(false), 51 is_transition_duration_locked_(false),
52 transition_duration_(transition_duration), 52 transition_duration_(transition_duration),
53 tween_type_(gfx::Tween::LINEAR), 53 tween_type_(gfx::Tween::LINEAR),
54 is_started_(false), 54 is_started_(false),
55 disable_timer_for_test_(false), 55 disable_timer_for_test_(false),
56 adding_animations_(false) { 56 adding_animations_(false),
57 animation_metrics_reporter_(nullptr) {
57 animation_player_ = 58 animation_player_ =
58 cc::AnimationPlayer::Create(cc::AnimationIdProvider::NextPlayerId()); 59 cc::AnimationPlayer::Create(cc::AnimationIdProvider::NextPlayerId());
59 } 60 }
60 61
61 LayerAnimator::~LayerAnimator() { 62 LayerAnimator::~LayerAnimator() {
62 for (size_t i = 0; i < running_animations_.size(); ++i) { 63 for (size_t i = 0; i < running_animations_.size(); ++i) {
63 if (running_animations_[i].is_sequence_alive()) 64 if (running_animations_[i].is_sequence_alive())
64 running_animations_[i].sequence()->OnAnimatorDestroyed(); 65 running_animations_[i].sequence()->OnAnimatorDestroyed();
65 } 66 }
66 ClearAnimationsInternal(); 67 ClearAnimationsInternal();
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 void LayerAnimator::RemoveThreadedAnimation(int animation_id) { 189 void LayerAnimator::RemoveThreadedAnimation(int animation_id) {
189 animation_player_->RemoveAnimation(animation_id); 190 animation_player_->RemoveAnimation(animation_id);
190 } 191 }
191 192
192 cc::AnimationPlayer* LayerAnimator::GetAnimationPlayerForTesting() const { 193 cc::AnimationPlayer* LayerAnimator::GetAnimationPlayerForTesting() const {
193 return animation_player_.get(); 194 return animation_player_.get();
194 } 195 }
195 196
196 void LayerAnimator::StartAnimation(LayerAnimationSequence* animation) { 197 void LayerAnimator::StartAnimation(LayerAnimationSequence* animation) {
197 scoped_refptr<LayerAnimator> retain(this); 198 scoped_refptr<LayerAnimator> retain(this);
199 if (animation_metrics_reporter_)
200 animation->SetAnimationMetricsReporter(animation_metrics_reporter_);
198 OnScheduled(animation); 201 OnScheduled(animation);
199 if (!StartSequenceImmediately(animation)) { 202 if (!StartSequenceImmediately(animation)) {
200 // Attempt to preempt a running animation. 203 // Attempt to preempt a running animation.
201 switch (preemption_strategy_) { 204 switch (preemption_strategy_) {
202 case IMMEDIATELY_SET_NEW_TARGET: 205 case IMMEDIATELY_SET_NEW_TARGET:
203 ImmediatelySetNewTarget(animation); 206 ImmediatelySetNewTarget(animation);
204 break; 207 break;
205 case IMMEDIATELY_ANIMATE_TO_NEW_TARGET: 208 case IMMEDIATELY_ANIMATE_TO_NEW_TARGET:
206 ImmediatelyAnimateToNewTarget(animation); 209 ImmediatelyAnimateToNewTarget(animation);
207 break; 210 break;
(...skipping 723 matching lines...) Expand 10 before | Expand all | Expand 10 after
931 const base::WeakPtr<LayerAnimationSequence>& sequence) 934 const base::WeakPtr<LayerAnimationSequence>& sequence)
932 : sequence_(sequence) { 935 : sequence_(sequence) {
933 } 936 }
934 937
935 LayerAnimator::RunningAnimation::RunningAnimation( 938 LayerAnimator::RunningAnimation::RunningAnimation(
936 const RunningAnimation& other) = default; 939 const RunningAnimation& other) = default;
937 940
938 LayerAnimator::RunningAnimation::~RunningAnimation() { } 941 LayerAnimator::RunningAnimation::~RunningAnimation() { }
939 942
940 } // namespace ui 943 } // namespace ui
OLDNEW
« no previous file with comments | « ui/compositor/layer_animator.h ('k') | ui/compositor/layer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698