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

Unified Diff: ash/wm/window_animations.cc

Issue 2869263002: Add UMA for CrossFadeAnimation. (Closed)
Patch Set: Fix nits. 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 | « ash/wm/overview/scoped_overview_animation_settings_aura.cc ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
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..95d75013c6c36aa8fe6210149a57a305d0424b43 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,22 @@ base::TimeDelta GetCrossFadeDuration(aura::Window* window,
Round64(kCrossFadeDurationMinMs + (factor * kRange)));
}
+class CrossFadeMetricsReporter : public ui::AnimationMetricsReporter {
+ public:
+ CrossFadeMetricsReporter() = default;
+ ~CrossFadeMetricsReporter() override = default;
+
+ void Report(int value) override {
+ UMA_HISTOGRAM_PERCENTAGE("Ash.Window.AnimationSmoothness.CrossFade", value);
+ }
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(CrossFadeMetricsReporter);
+};
+
+base::LazyInstance<CrossFadeMetricsReporter>::Leaky g_reporter_cross_fade =
+ LAZY_INSTANCE_INITIALIZER;
+
} // namespace
const int kCrossFadeDurationMS = 200;
@@ -319,6 +337,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 | « ash/wm/overview/scoped_overview_animation_settings_aura.cc ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698