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

Unified Diff: ash/wm/overview/scoped_overview_animation_settings_aura.cc

Issue 2631333002: [animations] Adds metrics for jank on selected layer animations (Closed)
Patch Set: Adds UMA reporting for ripples and overview mode (extern constexpr) 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: ash/wm/overview/scoped_overview_animation_settings_aura.cc
diff --git a/ash/wm/overview/scoped_overview_animation_settings_aura.cc b/ash/wm/overview/scoped_overview_animation_settings_aura.cc
index d785c185dfe0f306f3abed9ed5c2c737a11a0cd6..9d5b117ab1821a299ce9d1633187a912ba8bbf81 100644
--- a/ash/wm/overview/scoped_overview_animation_settings_aura.cc
+++ b/ash/wm/overview/scoped_overview_animation_settings_aura.cc
@@ -4,8 +4,10 @@
#include "ash/wm/overview/scoped_overview_animation_settings_aura.h"
+#include "base/lazy_instance.h"
#include "base/time/time.h"
#include "ui/aura/window.h"
+#include "ui/compositor/animation_metrics_reporter_template.h"
#include "ui/compositor/layer.h"
#include "ui/compositor/layer_animation_observer.h"
#include "ui/compositor/scoped_layer_animation_settings.h"
@@ -51,6 +53,39 @@ base::TimeDelta GetAnimationDuration(OverviewAnimationType animation_type) {
return base::TimeDelta();
}
+extern constexpr char kMetricCloseName[] =
+ "Ash.WindowSelector.AnimationSmoothness.Close";
+extern constexpr char kMetricEnterName[] =
+ "Ash.WindowSelector.AnimationSmoothness.Enter";
+extern constexpr char kMetricExitName[] =
+ "Ash.WindowSelector.AnimationSmoothness.Exit";
+
+base::LazyInstance<ui::AnimationMetricsReporterTemplate<kMetricCloseName>>::
+ Leaky g_reporter_close = LAZY_INSTANCE_INITIALIZER;
+base::LazyInstance<ui::AnimationMetricsReporterTemplate<kMetricEnterName>>::
+ Leaky g_reporter_enter = LAZY_INSTANCE_INITIALIZER;
+base::LazyInstance<ui::AnimationMetricsReporterTemplate<kMetricExitName>>::Leaky
+ g_reporter_exit = LAZY_INSTANCE_INITIALIZER;
+
+ui::AnimationMetricsReporter* GetMetricsReporter(
+ OverviewAnimationType animation_type) {
+ switch (animation_type) {
+ case OVERVIEW_ANIMATION_NONE:
+ return nullptr;
+ case OVERVIEW_ANIMATION_ENTER_OVERVIEW_MODE_FADE_IN:
+ case OVERVIEW_ANIMATION_LAY_OUT_SELECTOR_ITEMS:
+ return g_reporter_enter.Pointer();
+ case OVERVIEW_ANIMATION_EXIT_OVERVIEW_MODE_FADE_OUT:
+ case OVERVIEW_ANIMATION_RESTORE_WINDOW:
+ return g_reporter_exit.Pointer();
+ case OVERVIEW_ANIMATION_CLOSING_SELECTOR_ITEM:
+ case OVERVIEW_ANIMATION_CLOSE_SELECTOR_ITEM:
+ return g_reporter_close.Pointer();
+ }
+ NOTREACHED();
+ return nullptr;
+}
+
} // namespace
ScopedOverviewAnimationSettingsAura::ScopedOverviewAnimationSettingsAura(
@@ -91,6 +126,8 @@ ScopedOverviewAnimationSettingsAura::ScopedOverviewAnimationSettingsAura(
}
animation_settings_->SetTransitionDuration(
GetAnimationDuration(animation_type));
+ animation_settings_->SetAnimationMetricsReporter(
+ GetMetricsReporter(animation_type));
}
ScopedOverviewAnimationSettingsAura::~ScopedOverviewAnimationSettingsAura() {}
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | ui/compositor/animation_metrics_reporter_template.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698