#include "ui/compositor/presentation_time_recorder.h"
#include <ostream>
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/logging.h"
#include "base/memory/ptr_util.h"
#include "base/memory/raw_ptr.h"
#include "base/metrics/histogram.h"
#include "base/trace_event/trace_event.h"
namespace ui {
namespace {
bool report_immediately_for_test = …;
}
class PresentationTimeRecorder::PresentationTimeRecorderInternal
: public ui::CompositorObserver { … };
bool PresentationTimeRecorder::PresentationTimeRecorderInternal::RequestNext() { … }
void PresentationTimeRecorder::PresentationTimeRecorderInternal::OnPresented(
int count,
base::TimeTicks requested_time,
const viz::FrameTimingDetails& frame_timing_details) { … }
void PresentationTimeRecorder::PresentationTimeRecorderInternal::
SelfDestruct() { … }
PresentationTimeRecorder::PresentationTimeRecorder(
raw_ptr<PresentationTimeRecorderInternal> internal)
: … { … }
PresentationTimeRecorder::~PresentationTimeRecorder() { … }
bool PresentationTimeRecorder::RequestNext() { … }
std::optional<base::TimeDelta> PresentationTimeRecorder::GetAverageLatency()
const { … }
void PresentationTimeRecorder::SetReportPresentationTimeImmediatelyForTest(
bool enable) { … }
namespace {
base::HistogramBase* CreateTimesHistogram(const char* name,
base::TimeDelta maximum) { … }
class PresentationTimeHistogramRecorder
: public PresentationTimeRecorder::PresentationTimeRecorderInternal { … };
}
std::unique_ptr<PresentationTimeRecorder>
CreatePresentationTimeHistogramRecorder(
ui::Compositor* compositor,
const char* presentation_time_histogram_name,
const char* max_latency_histogram_name,
base::TimeDelta maximum,
bool emit_trace_event) { … }
PresentationTimeRecorder::TestApi::TestApi(PresentationTimeRecorder* recorder)
: … { … }
void PresentationTimeRecorder::TestApi::OnCompositingDidCommit(
ui::Compositor* compositor) { … }
void PresentationTimeRecorder::TestApi::OnPresented(
int count,
base::TimeTicks requested_time,
const viz::FrameTimingDetails& frame_timing_details) { … }
}