chromium/ui/compositor/animation_throughput_reporter.h

// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef UI_COMPOSITOR_ANIMATION_THROUGHPUT_REPORTER_H_
#define UI_COMPOSITOR_ANIMATION_THROUGHPUT_REPORTER_H_

#include <memory>

#include "base/functional/callback_forward.h"
#include "base/memory/scoped_refptr.h"
#include "cc/metrics/frame_sequence_metrics.h"
#include "ui/compositor/compositor_export.h"

namespace ui {

class Compositor;
class LayerAnimator;

// Reports cc::FrameSequenceMetrics::ThroughputData of layer animations.
//
// Throughput is defined as the ratio between number frames presented (actual
// screen updates) for the animations and the number frames expected.
// DroppedFrames/SkippedFrames is the other part of the story. It is a ratio
// between dropped/skipped frames over the expected frames.
//
// See also docs/speed/graphics_metrics_definitions.md.
//
// cc::FrameSequenceMetrics::ThroughputData contains the numbers of produced
// frames and expected frames and could be used to calculate the two metrics.
//
// All layer animation sequences created after its construction are consider
// as part of the animation being tracked. Graphics throughput tracking is
// stopped when all relevant layer animation sequences finish. The report
// callback is invoked on the next frame presentation if there is enough data
// and none of the layer animation sequences is aborted.
class COMPOSITOR_EXPORT AnimationThroughputReporter {};

}  // namespace ui

#endif  // UI_COMPOSITOR_ANIMATION_THROUGHPUT_REPORTER_H_