Chromium Code Reviews| Index: ash/rotator/screen_rotation_animator.cc |
| diff --git a/ash/rotator/screen_rotation_animator.cc b/ash/rotator/screen_rotation_animator.cc |
| index c0dbe2058d6f7a4c33314ed1f07650cde2446195..ef7f54464fb94a9d9dc8f46f9edc9edd18618262 100644 |
| --- a/ash/rotator/screen_rotation_animator.cc |
| +++ b/ash/rotator/screen_rotation_animator.cc |
| @@ -14,6 +14,7 @@ |
| #include "ash/shell.h" |
| #include "base/command_line.h" |
| #include "base/memory/ptr_util.h" |
| +#include "base/metrics/histogram_macros.h" |
| #include "base/time/time.h" |
| #include "ui/aura/window.h" |
| #include "ui/compositor/layer.h" |
| @@ -47,6 +48,10 @@ const int kRotationDurationInMs = 250; |
| const int kCounterClockWiseRotationFactor = 1; |
| const int kClockWiseRotationFactor = -1; |
| +// The percentage histogram boundary. |
| +const int kPercentage_MIN = 1; |
| +const int kPercentage_MAX = 101; |
| + |
| // Aborts the active animations of the layer, and recurses upon its child |
| // layers. |
| void AbortAnimations(ui::Layer* layer) { |
| @@ -177,9 +182,21 @@ struct ScreenRotationAnimator::ScreenRotationRequest { |
| display::Display::RotationSource source; |
| }; |
| +class ScreenRotationAnimator::ScreenRotationAnimationMetricsReporter |
| + : public ui::AnimationMetricsReporter { |
| + void Report(int value) override { |
| + base::LinearHistogram::FactoryGet( |
| + "Ash.Rotation.AnimationSmoothness", kPercentage_MIN, kPercentage_MAX, |
|
bruthig
2017/03/24 14:25:39
FYI You will need to add an entry to histograms.xm
wutao
2017/03/24 20:24:37
Done.
|
| + kPercentage_MAX + 1, base::HistogramBase::kUmaTargetedHistogramFlag) |
| + ->Add(value); |
| + } |
| +}; |
| + |
| ScreenRotationAnimator::ScreenRotationAnimator(int64_t display_id) |
| : display_id_(display_id), |
| is_rotating_(false), |
| + metrics_reporter_( |
| + base::MakeUnique<ScreenRotationAnimationMetricsReporter>()), |
| disable_animation_timers_for_test_(false), |
| weak_factory_(this) {} |
| @@ -278,6 +295,7 @@ void ScreenRotationAnimator::AnimateRotation( |
| // control the animation. |
| if (disable_animation_timers_for_test_) |
|
bruthig
2017/03/24 14:25:39
Not related to this change but shouldn't we be dis
wutao
2017/03/24 20:24:37
Ideally yes, but it will not affect the test resul
|
| animator->set_disable_timer_for_test(true); |
| + animation_sequence->SetAnimationMetricsReporter(metrics_reporter_.get()); |
| animator->StartAnimation(animation_sequence.release()); |
| rotation_request.reset(); |