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

Unified Diff: ui/views/animation/flood_fill_ink_drop_ripple.cc

Issue 2631333002: [animations] Adds metrics for jank on selected layer animations (Closed)
Patch Set: Adds UMA reporting for ripples and overview mode (UMA name fix) Created 3 years, 11 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
Index: ui/views/animation/flood_fill_ink_drop_ripple.cc
diff --git a/ui/views/animation/flood_fill_ink_drop_ripple.cc b/ui/views/animation/flood_fill_ink_drop_ripple.cc
index 5ed22814c1b497d876ddb939af4ca9d8f588e13c..304eae84c3a707d9b2eae84d4fa7c509de80b86a 100644
--- a/ui/views/animation/flood_fill_ink_drop_ripple.cc
+++ b/ui/views/animation/flood_fill_ink_drop_ripple.cc
@@ -6,7 +6,9 @@
#include <algorithm>
+#include "base/lazy_instance.h"
#include "base/logging.h"
+#include "base/metrics/histogram_macros.h"
#include "third_party/skia/include/core/SkColor.h"
#include "ui/compositor/layer.h"
#include "ui/compositor/layer_animation_sequence.h"
@@ -113,6 +115,16 @@ float CalculateCircleLayerRadius(const gfx::Rect& clip_bounds) {
return std::max(clip_bounds.width(), clip_bounds.height()) / 2.f;
}
+class FloodRippleMetricsReporter : public ui::AnimationMetricsReporter {
+ void Report(int value) override {
+ UMA_HISTOGRAM_PERCENTAGE("Views.AnimationSmoothness.FloodFillRipple",
+ value);
+ }
+};
+
+base::LazyInstance<FloodRippleMetricsReporter>::Leaky g_reporter =
+ LAZY_INSTANCE_INITIALIZER;
+
} // namespace
namespace views {
@@ -323,6 +335,7 @@ void FloodFillInkDropRipple::AnimateToTransform(
if (animation_observer)
sequence->AddObserver(animation_observer);
+ sequence->SetAnimationMetricsReporter(g_reporter.Pointer());
animator->StartAnimation(sequence);
}
@@ -344,6 +357,7 @@ void FloodFillInkDropRipple::PauseTransformAnimation(
if (observer)
sequence->AddObserver(observer);
+ sequence->SetAnimationMetricsReporter(g_reporter.Pointer());
animator->StartAnimation(sequence);
}
@@ -369,6 +383,7 @@ void FloodFillInkDropRipple::AnimateToOpacity(
if (animation_observer)
animation_sequence->AddObserver(animation_observer);
+ animation_sequence->SetAnimationMetricsReporter(g_reporter.Pointer());
animator->StartAnimation(animation_sequence);
}
@@ -390,6 +405,7 @@ void FloodFillInkDropRipple::PauseOpacityAnimation(
if (observer)
sequence->AddObserver(observer);
+ sequence->SetAnimationMetricsReporter(g_reporter.Pointer());
animator->StartAnimation(sequence);
}

Powered by Google App Engine
This is Rietveld 408576698