Chromium Code Reviews| Index: ash/wm/window_animations.cc |
| diff --git a/ash/wm/window_animations.cc b/ash/wm/window_animations.cc |
| index 95fd82097f85c831621d4ea0607158a0714b4086..243bddc070c9684e471b3240e008e89871505a94 100644 |
| --- a/ash/wm/window_animations.cc |
| +++ b/ash/wm/window_animations.cc |
| @@ -15,8 +15,10 @@ |
| #include "ash/wm/workspace_controller.h" |
| #include "ash/wm_window.h" |
| #include "base/i18n/rtl.h" |
| +#include "base/lazy_instance.h" |
| #include "base/logging.h" |
| #include "base/memory/ptr_util.h" |
| +#include "base/metrics/histogram_macros.h" |
| #include "base/stl_util.h" |
| #include "base/time/time.h" |
| #include "ui/aura/client/aura_constants.h" |
| @@ -84,6 +86,15 @@ base::TimeDelta GetCrossFadeDuration(aura::Window* window, |
| Round64(kCrossFadeDurationMinMs + (factor * kRange))); |
| } |
| +class CrossFadeMetricsReporter : public ui::AnimationMetricsReporter { |
|
varkha
2017/05/12 15:14:25
There was a nit in a previous similar CL to define
wutao
2017/05/12 17:46:37
I kept copying from your first code. I will make c
|
| + void Report(int value) override { |
| + UMA_HISTOGRAM_PERCENTAGE("Ash.Window.AnimationSmoothness.CrossFade", value); |
| + } |
| +}; |
| + |
| +base::LazyInstance<CrossFadeMetricsReporter>::Leaky g_reporter_cross_fade = |
| + LAZY_INSTANCE_INITIALIZER; |
| + |
| } // namespace |
| const int kCrossFadeDurationMS = 200; |
| @@ -319,6 +330,8 @@ base::TimeDelta CrossFadeAnimation( |
| new CrossFadeObserver(window, std::move(old_layer_owner))); |
| settings.SetTransitionDuration(duration); |
| settings.SetTweenType(tween_type); |
| + // Only add reporter to |old_layer|. |
| + settings.SetAnimationMetricsReporter(g_reporter_cross_fade.Pointer()); |
| gfx::Transform out_transform; |
| float scale_x = static_cast<float>(new_bounds.width()) / |
| static_cast<float>(old_bounds.width()); |