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

Unified Diff: ash/wm/window_animations.cc

Issue 2869263002: Add UMA for CrossFadeAnimation. (Closed)
Patch Set: Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | tools/metrics/histograms/histograms.xml » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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());
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | tools/metrics/histograms/histograms.xml » ('J')

Powered by Google App Engine
This is Rietveld 408576698