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

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 (comments) Created 3 years, 11 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/scoped_layer_animation_settings.h » ('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 23 matching lines...) Expand all
90 base::TimeDelta duration = GetTransitionDuration(); \ 91 base::TimeDelta duration = GetTransitionDuration(); \
91 if (duration.is_zero() && delegate() && \ 92 if (duration.is_zero() && delegate() && \
92 (preemption_strategy_ != ENQUEUE_NEW_ANIMATION)) { \ 93 (preemption_strategy_ != ENQUEUE_NEW_ANIMATION)) { \
93 StopAnimatingProperty(LayerAnimationElement::property); \ 94 StopAnimatingProperty(LayerAnimationElement::property); \
94 delegate()->Set##name##FromAnimation(value); \ 95 delegate()->Set##name##FromAnimation(value); \
95 return; \ 96 return; \
96 } \ 97 } \
97 std::unique_ptr<LayerAnimationElement> element = \ 98 std::unique_ptr<LayerAnimationElement> element = \
98 LayerAnimationElement::Create##name##Element(value, duration); \ 99 LayerAnimationElement::Create##name##Element(value, duration); \
99 element->set_tween_type(tween_type_); \ 100 element->set_tween_type(tween_type_); \
100 StartAnimation(new LayerAnimationSequence(std::move(element))); \ 101 LayerAnimationSequence* sequence = \
102 new LayerAnimationSequence(std::move(element)); \
103 sequence->SetAnimationMetricsReporter(animation_metrics_reporter_); \
104 StartAnimation(sequence); \
sadrul 2017/01/20 17:29:43 Does this cover all the cases? e.g. what if LayerA
ajuma 2017/01/20 23:02:06 This is a good point, what about moving this logic
101 } \ 105 } \
102 \ 106 \
103 member_type LayerAnimator::GetTarget##name() const { \ 107 member_type LayerAnimator::GetTarget##name() const { \
104 LayerAnimationElement::TargetValue target(delegate()); \ 108 LayerAnimationElement::TargetValue target(delegate()); \
105 GetTargetValue(&target); \ 109 GetTargetValue(&target); \
106 return target.member; \ 110 return target.member; \
107 } 111 }
108 112
109 ANIMATED_PROPERTY( 113 ANIMATED_PROPERTY(
110 const gfx::Transform&, TRANSFORM, Transform, gfx::Transform, transform); 114 const gfx::Transform&, TRANSFORM, Transform, gfx::Transform, transform);
(...skipping 820 matching lines...) Expand 10 before | Expand all | Expand 10 after
931 const base::WeakPtr<LayerAnimationSequence>& sequence) 935 const base::WeakPtr<LayerAnimationSequence>& sequence)
932 : sequence_(sequence) { 936 : sequence_(sequence) {
933 } 937 }
934 938
935 LayerAnimator::RunningAnimation::RunningAnimation( 939 LayerAnimator::RunningAnimation::RunningAnimation(
936 const RunningAnimation& other) = default; 940 const RunningAnimation& other) = default;
937 941
938 LayerAnimator::RunningAnimation::~RunningAnimation() { } 942 LayerAnimator::RunningAnimation::~RunningAnimation() { }
939 943
940 } // namespace ui 944 } // namespace ui
OLDNEW
« no previous file with comments | « ui/compositor/layer_animator.h ('k') | ui/compositor/scoped_layer_animation_settings.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698