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

Side by Side Diff: ui/compositor/scoped_layer_animation_settings.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
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/scoped_layer_animation_settings.h" 5 #include "ui/compositor/scoped_layer_animation_settings.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "ui/compositor/layer.h" 9 #include "ui/compositor/layer.h"
10 #include "ui/compositor/layer_animation_observer.h" 10 #include "ui/compositor/layer_animation_observer.h"
(...skipping 15 matching lines...) Expand all
26 old_is_transition_duration_locked_( 26 old_is_transition_duration_locked_(
27 animator->is_transition_duration_locked_), 27 animator->is_transition_duration_locked_),
28 old_transition_duration_(animator->GetTransitionDuration()), 28 old_transition_duration_(animator->GetTransitionDuration()),
29 old_tween_type_(animator->tween_type()), 29 old_tween_type_(animator->tween_type()),
30 old_preemption_strategy_(animator->preemption_strategy()) { 30 old_preemption_strategy_(animator->preemption_strategy()) {
31 SetTransitionDuration( 31 SetTransitionDuration(
32 base::TimeDelta::FromMilliseconds(kDefaultTransitionDurationMs)); 32 base::TimeDelta::FromMilliseconds(kDefaultTransitionDurationMs));
33 } 33 }
34 34
35 ScopedLayerAnimationSettings::~ScopedLayerAnimationSettings() { 35 ScopedLayerAnimationSettings::~ScopedLayerAnimationSettings() {
36 animator_->set_animation_metrics_reporter(nullptr);
36 animator_->is_transition_duration_locked_ = 37 animator_->is_transition_duration_locked_ =
37 old_is_transition_duration_locked_; 38 old_is_transition_duration_locked_;
38 animator_->SetTransitionDuration(old_transition_duration_); 39 animator_->SetTransitionDuration(old_transition_duration_);
39 animator_->set_tween_type(old_tween_type_); 40 animator_->set_tween_type(old_tween_type_);
40 animator_->set_preemption_strategy(old_preemption_strategy_); 41 animator_->set_preemption_strategy(old_preemption_strategy_);
41 42
42 for (std::set<ImplicitAnimationObserver*>::const_iterator i = 43 for (std::set<ImplicitAnimationObserver*>::const_iterator i =
43 observers_.begin(); i != observers_.end(); ++i) { 44 observers_.begin(); i != observers_.end(); ++i) {
44 animator_->observers_.RemoveObserver(*i); 45 animator_->observers_.RemoveObserver(*i);
45 (*i)->SetActive(true); 46 (*i)->SetActive(true);
46 } 47 }
47 } 48 }
48 49
49 void ScopedLayerAnimationSettings::AddObserver( 50 void ScopedLayerAnimationSettings::AddObserver(
50 ImplicitAnimationObserver* observer) { 51 ImplicitAnimationObserver* observer) {
51 observers_.insert(observer); 52 observers_.insert(observer);
52 animator_->AddObserver(observer); 53 animator_->AddObserver(observer);
53 } 54 }
54 55
56 void ScopedLayerAnimationSettings::SetAnimationMetricsReporter(
57 AnimationMetricsReporter* reporter) {
58 animator_->set_animation_metrics_reporter(reporter);
59 }
60
55 void ScopedLayerAnimationSettings::SetTransitionDuration( 61 void ScopedLayerAnimationSettings::SetTransitionDuration(
56 base::TimeDelta duration) { 62 base::TimeDelta duration) {
57 animator_->SetTransitionDuration(duration); 63 animator_->SetTransitionDuration(duration);
58 } 64 }
59 65
60 void ScopedLayerAnimationSettings::LockTransitionDuration() { 66 void ScopedLayerAnimationSettings::LockTransitionDuration() {
61 animator_->is_transition_duration_locked_ = true; 67 animator_->is_transition_duration_locked_ = true;
62 } 68 }
63 69
64 base::TimeDelta ScopedLayerAnimationSettings::GetTransitionDuration() const { 70 base::TimeDelta ScopedLayerAnimationSettings::GetTransitionDuration() const {
(...skipping 12 matching lines...) Expand all
77 LayerAnimator::PreemptionStrategy strategy) { 83 LayerAnimator::PreemptionStrategy strategy) {
78 animator_->set_preemption_strategy(strategy); 84 animator_->set_preemption_strategy(strategy);
79 } 85 }
80 86
81 LayerAnimator::PreemptionStrategy 87 LayerAnimator::PreemptionStrategy
82 ScopedLayerAnimationSettings::GetPreemptionStrategy() const { 88 ScopedLayerAnimationSettings::GetPreemptionStrategy() const {
83 return animator_->preemption_strategy(); 89 return animator_->preemption_strategy();
84 } 90 }
85 91
86 } // namespace ui 92 } // namespace ui
OLDNEW
« no previous file with comments | « ui/compositor/scoped_layer_animation_settings.h ('k') | ui/compositor/test/test_layer_animation_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698