Commit 5b144b80 authored by Jun Mukai's avatar Jun Mukai Committed by Commit Bot

Use ui::AnimationMetricsReporter for WindowCycleView animation

As revealed in the discussion in the reported bug, ash::FpsCounter
and ui::AnimationMetricsReporter calculates a slightly different
data points. For this specific case, ui::AnimationMetricsReporter
would be better.

Note that this does not recover the reported number to the original;
Ash.WindowCycleView.AnimationSmoothness.Show.2windows to be ~50
and slightly shorter than previous value (~67), but this would
mean that ash::FpsCounter wouldn't be good for computing
animation smoothness.

Bug: 1085501
Test: tast ui.WindowCycleView on coral/astronaut
Change-Id: I747d5eeaaeb2c319fbe661e8c1d4b6f8c67ec296
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2212492Reviewed-by: default avatarSammie Quon <sammiequon@chromium.org>
Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Commit-Queue: Jun Mukai <mukai@chromium.org>
Cr-Commit-Position: refs/heads/master@{#771951}
parent f739fca7
......@@ -10,7 +10,6 @@
#include "ash/accessibility/accessibility_controller_impl.h"
#include "ash/app_list/app_list_controller_impl.h"
#include "ash/public/cpp/fps_counter.h"
#include "ash/public/cpp/shell_window_ids.h"
#include "ash/public/cpp/window_properties.h"
#include "ash/shell.h"
......@@ -111,6 +110,17 @@ class CustomWindowTargeter : public aura::WindowTargeter {
aura::Window* tab_cycler_;
};
// Reporter of fade-in animation smoothness.
class FadeInAnimationMetricsReporter : public ui::AnimationMetricsReporter {
public:
FadeInAnimationMetricsReporter() = default;
~FadeInAnimationMetricsReporter() override = default;
void Report(int value) override {
UMA_HISTOGRAM_PERCENTAGE(kShowAnimationSmoothness, value);
}
};
} // namespace
// This view represents a single aura::Window by displaying a title and a
......@@ -270,13 +280,11 @@ class WindowCycleView : public views::WidgetDelegateView,
void FadeInLayer() {
DCHECK(GetWidget());
fade_in_fps_counter_ =
std::make_unique<FpsCounter>(GetWidget()->GetCompositor());
layer()->SetOpacity(0.f);
ui::ScopedLayerAnimationSettings settings(layer()->GetAnimator());
settings.SetTransitionDuration(kFadeInDuration);
settings.AddObserver(this);
settings.SetAnimationMetricsReporter(&fade_in_reporter_);
settings.CacheRenderSurface();
layer()->SetOpacity(1.f);
}
......@@ -403,11 +411,6 @@ class WindowCycleView : public views::WidgetDelegateView,
// ui::ImplicitAnimationObserver:
void OnImplicitAnimationsCompleted() override {
DCHECK(fade_in_fps_counter_);
int smoothness = fade_in_fps_counter_->ComputeSmoothness();
if (smoothness > 0)
UMA_HISTOGRAM_PERCENTAGE(kShowAnimationSmoothness, smoothness);
fade_in_fps_counter_.reset();
occlusion_tracker_pauser_.reset();
}
......@@ -430,7 +433,7 @@ class WindowCycleView : public views::WidgetDelegateView,
base::flat_set<WindowCycleItemView*> no_previews_set_;
// Records the animation smoothness of the fade in animation.
std::unique_ptr<FpsCounter> fade_in_fps_counter_;
FadeInAnimationMetricsReporter fade_in_reporter_;
// Used for preventng occlusion state computations for the duration of the
// fade in animation.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment