#include "third_party/blink/public/common/page/content_to_visible_time_reporter.h"
#include <utility>
#include "base/functional/bind.h"
#include "base/metrics/histogram_functions.h"
#include "base/strings/strcat.h"
#include "base/time/time.h"
#include "base/trace_event/trace_id_helper.h"
#include "base/trace_event/typed_macros.h"
#include "base/tracing/protos/chrome_track_event.pbzero.h"
#include "components/viz/common/frame_timing_details.h"
#include "third_party/abseil-cpp/absl/cleanup/cleanup.h"
#include "third_party/blink/public/mojom/widget/record_content_to_visible_time_request.mojom.h"
#include "third_party/perfetto/include/perfetto/tracing/event_context.h"
#include "third_party/perfetto/include/perfetto/tracing/track.h"
namespace blink {
namespace {
TabSwitchResult;
const char* GetHistogramSuffix(
bool has_saved_frames,
const mojom::RecordContentToVisibleTimeRequest& start_state) { … }
void RecordBackForwardCacheRestoreMetric(
const base::TimeTicks requested_time,
base::TimeTicks presentation_timestamp) { … }
bool IsLatencyTraceCategoryEnabled() { … }
void RecordTabSwitchTraceEvent(base::TimeTicks start_time,
base::TimeTicks end_time,
TabSwitchResult result,
bool has_saved_frames,
bool destination_is_loaded) { … }
void RecordUnfoldHistogramAndTraceEvent(
base::TimeTicks begin_timestamp,
const viz::FrameTimingDetails& frame_timing_details) { … }
}
ContentToVisibleTimeReporter::ContentToVisibleTimeReporter() = default;
ContentToVisibleTimeReporter::~ContentToVisibleTimeReporter() = default;
ContentToVisibleTimeReporter::SuccessfulPresentationTimeCallback
ContentToVisibleTimeReporter::TabWasShown(
bool has_saved_frames,
mojom::RecordContentToVisibleTimeRequestPtr start_state) { … }
ContentToVisibleTimeReporter::SuccessfulPresentationTimeCallback
ContentToVisibleTimeReporter::TabWasShown(bool has_saved_frames,
base::TimeTicks event_start_time,
bool destination_is_loaded,
bool show_reason_tab_switching,
bool show_reason_bfcache_restore) { … }
ContentToVisibleTimeReporter::SuccessfulPresentationTimeCallback
ContentToVisibleTimeReporter::GetCallbackForNextFrameAfterUnfold(
base::TimeTicks begin_timestamp) { … }
void ContentToVisibleTimeReporter::TabWasHidden() { … }
void ContentToVisibleTimeReporter::
RecordHistogramsAndTraceEventsWithFrameTimingDetails(
TabSwitchResult tab_switch_result,
bool show_reason_tab_switching,
bool show_reason_bfcache_restore,
const viz::FrameTimingDetails& frame_timing_details) { … }
void ContentToVisibleTimeReporter::RecordHistogramsAndTraceEvents(
TabSwitchResult tab_switch_result,
bool show_reason_tab_switching,
bool show_reason_bfcache_restore,
base::TimeTicks presentation_timestamp) { … }
void ContentToVisibleTimeReporter::OverwriteTabSwitchStartState(
mojom::RecordContentToVisibleTimeRequestPtr state,
bool has_saved_frames) { … }
}