#include "content/browser/renderer_host/back_forward_cache_metrics.h"
#include "base/debug/crash_logging.h"
#include "base/debug/dump_without_crashing.h"
#include "base/metrics/histogram_macros.h"
#include "base/metrics/metrics_hashes.h"
#include "base/metrics/sparse_histogram.h"
#include "components/back_forward_cache/disabled_reason_id.h"
#include "content/browser/devtools/devtools_instrumentation.h"
#include "content/browser/renderer_host/back_forward_cache_impl.h"
#include "content/browser/renderer_host/frame_tree_node.h"
#include "content/browser/renderer_host/navigation_entry_impl.h"
#include "content/browser/renderer_host/navigation_request.h"
#include "content/browser/renderer_host/render_process_host_impl.h"
#include "content/browser/renderer_host/should_swap_browsing_instance.h"
#include "content/browser/site_instance_impl.h"
#include "content/common/debug_utils.h"
#include "content/public/browser/back_forward_cache.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/navigation_details.h"
#include "content/public/browser/reload_type.h"
#include "services/metrics/public/cpp/ukm_builders.h"
#include "services/metrics/public/cpp/ukm_recorder.h"
#include "services/metrics/public/cpp/ukm_source_id.h"
#include "third_party/blink/public/common/scheduler/web_scheduler_tracked_feature.h"
#include "ui/accessibility/ax_event.h"
#include "url/gurl.h"
#include "url/origin.h"
namespace content {
namespace {
base::TickClock* g_mock_time_clock_for_testing = …;
base::TimeDelta ClampTime(base::TimeDelta time) { … }
base::TimeTicks Now() { … }
}
void BackForwardCacheMetrics::OverrideTimeForTesting(base::TickClock* clock) { … }
bool BackForwardCacheMetrics::IsCrossDocumentMainFrameHistoryNavigation(
NavigationRequest* navigation) { … }
scoped_refptr<BackForwardCacheMetrics>
BackForwardCacheMetrics::CreateOrReuseBackForwardCacheMetricsForNavigation(
NavigationEntryImpl* previous_entry,
bool is_main_frame_navigation,
int64_t committing_document_sequence_number) { … }
BackForwardCacheMetrics::BackForwardCacheMetrics(
int64_t document_sequence_number)
: … { … }
BackForwardCacheMetrics::~BackForwardCacheMetrics() = default;
void BackForwardCacheMetrics::MainFrameDidStartNavigationToDocument() { … }
void BackForwardCacheMetrics::DidCommitNavigation(
NavigationRequest* navigation,
bool back_forward_cache_allowed) { … }
namespace {
void RecordDisabledForRenderFrameHostReasonUKM(ukm::SourceId source_id,
uint64_t reason) { … }
}
void BackForwardCacheMetrics::RecordHistoryNavigationUKM(
NavigationRequest* navigation) { … }
void BackForwardCacheMetrics::MainFrameDidNavigateAwayFromDocument() { … }
void BackForwardCacheMetrics::RecordFeatureUsage(
RenderFrameHostImpl* main_frame) { … }
void BackForwardCacheMetrics::CollectFeatureUsageFromSubtree(
RenderFrameHostImpl* rfh,
const url::Origin& main_frame_origin) { … }
void BackForwardCacheMetrics::AddNotRestoredFlattenedReasonsToExistingResult(
BackForwardCacheCanStoreDocumentResult& flattened) { … }
void BackForwardCacheMetrics::SetNotRestoredReasons(
BackForwardCacheCanStoreDocumentResultWithTree& can_store) { … }
blink::mojom::BackForwardCacheNotRestoredReasonsPtr
BackForwardCacheMetrics::GetWebExposedNotRestoredReasons() { … }
void BackForwardCacheMetrics::UpdateNotRestoredReasonsForNavigation(
NavigationRequest* navigation) { … }
void BackForwardCacheMetrics::RecordHistoryNavigationUMA(
NavigationRequest* navigation,
bool back_forward_cache_allowed) const { … }
void BackForwardCacheMetrics::RecordEvictedAfterDocumentRestored(
EvictedAfterDocumentRestoredReason reason) { … }
uint64_t BackForwardCacheMetrics::MetricValue(
BackForwardCache::DisabledReason reason) { … }
void BackForwardCacheMetrics::SetBrowsingInstanceSwapResult(
std::optional<ShouldSwapBrowsingInstance> reason,
RenderFrameHostImpl* navigated_away_rfh) { … }
void BackForwardCacheMetrics::SetRelatedActiveContentsInfo(
RenderFrameHostImpl* navigated_away_rfh) { … }
bool BackForwardCacheMetrics::DidSwapBrowsingInstance() const { … }
std::string BackForwardCacheMetrics::GetPageStoredResultString() { … }
}