Commit 1cc64497 authored by Sammie Quon's avatar Sammie Quon Committed by Commit Bot

ui: Add more class docs for AnimationMetricsRecorder/Reporter.

As requested in [1]. Idea is make it less needed to code-search for
examples.

[1] https://chromium-review.googlesource.com/c/chromium/src/+/2068305/10/ui/compositor/animation_metrics_recorder.h#16

Test: none
Bug: 1051490
Change-Id: I4a8bb4bc04e8f745913f215952daab90a54deafc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2097236
Commit-Queue: Sammie Quon <sammiequon@chromium.org>
Reviewed-by: default avatarRobert Flack <flackr@chromium.org>
Reviewed-by: default avatarAhmed Fakhry <afakhry@chromium.org>
Cr-Commit-Position: refs/heads/master@{#749250}
parent 3a7675d4
......@@ -13,6 +13,26 @@ namespace ui {
class AnimationMetricsReporter;
// This is the interface to send animation smoothness numbers to a given
// AnimationMetricsReporter.
//
// Classes that run animations (e.g. ui::LayerAnimationSequence,
// views::CompositorAnimationRunner) should own one of these objects and pass
// the values required to calculate animation smoothness when an animation
// starts and ends.
//
// To use, when your animation starts:
// animation_metrics_recorder_->OnAnimationStart(frame, start_time,
// expected_duration);
// and when it ends:
// animation metrics_recorder_->OnAnimationEnd(frame, refresh_rate);
// and your attached AnimationMetricsReporter will report the calculated
// smoothness. Note that if the animator is attached or detached during an
// animation, this class will have to be notified.
//
// Unless implementing a complex custom animator, client code should just need
// to supply an AnimationMetricsReporter to an animations class that already
// owns an instance of this class.
class COMPOSITOR_EXPORT AnimationMetricsRecorder {
public:
explicit AnimationMetricsRecorder(AnimationMetricsReporter* reporter);
......
......@@ -9,9 +9,13 @@
namespace ui {
// Override this class and attach it to any class that supports recording
// animation smoothness (e.g. ui::LayerAnimationSequence,
// views::CompositorAnimationRunner). When an animation ends, |Report| will be
// called with the animation smoothness as a percentage.
class COMPOSITOR_EXPORT AnimationMetricsReporter {
public:
virtual ~AnimationMetricsReporter() {}
virtual ~AnimationMetricsReporter() = default;
// Called at the end of every animation sequence, if the duration and frames
// passed meets certain criteria. |value| is the smoothness, measured in
// percentage of the 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