#include "components/page_load_metrics/browser/observers/use_counter_page_load_metrics_observer.h"
#include "base/metrics/histogram_functions.h"
#include "base/rand_util.h"
#include "content/public/browser/navigation_handle.h"
#include "content/public/browser/render_frame_host.h"
#include "services/metrics/public/cpp/ukm_builders.h"
#include "third_party/blink/public/common/user_agent/user_agent_metadata.h"
#include "third_party/blink/public/mojom/use_counter/use_counter_feature.mojom.h"
FeatureType;
UkmFeatureList;
WebFeature;
WebDXFeature;
CSSSampleId;
PermissionsPolicyFeature;
namespace {
void PossiblyWarnFeatureDeprecation(content::RenderFrameHost* rfh,
WebFeature feature) { … }
template <size_t N>
bool TestAndSet(std::bitset<N>& bitset,
blink::UseCounterFeature::EnumValue value) { … }
}
UseCounterMetricsRecorder::UseCounterMetricsRecorder(
bool is_in_fenced_frames_page)
: … { … }
UseCounterMetricsRecorder::~UseCounterMetricsRecorder() = default;
void UseCounterMetricsRecorder::AssertNoMetricsRecordedOrDeferred() { … }
void UseCounterMetricsRecorder::RecordUkmPageVisits(
ukm::SourceId ukm_source_id) { … }
void UseCounterMetricsRecorder::DisableDeferAndFlush() { … }
void UseCounterMetricsRecorder::RecordOrDeferUseCounterFeature(
content::RenderFrameHost* rfh,
const blink::UseCounterFeature& feature) { … }
void UseCounterMetricsRecorder::RecordOrDeferMainFrameWebFeature(
content::RenderFrameHost* rfh,
blink::mojom::WebFeature web_feature) { … }
void UseCounterMetricsRecorder::RecordWebFeatures(ukm::SourceId ukm_source_id) { … }
void UseCounterMetricsRecorder::RecordWebDXFeatures(
ukm::SourceId ukm_source_id) { … }
const base::flat_map<blink::mojom::WebFeature, blink::mojom::WebDXFeature>&
UseCounterMetricsRecorder::GetWebFeatureToWebDXFeatureMap() { … }
const base::flat_map<blink::mojom::CSSSampleId, blink::mojom::WebDXFeature>&
UseCounterMetricsRecorder::GetCSSProperties2WebDXFeatureMap() { … }
const base::flat_map<blink::mojom::CSSSampleId, blink::mojom::WebDXFeature>&
UseCounterMetricsRecorder::GetAnimatedCSSProperties2WebDXFeatureMap() { … }
UseCounterPageLoadMetricsObserver::UseCounterPageLoadMetricsObserver() =
default;
UseCounterPageLoadMetricsObserver::~UseCounterPageLoadMetricsObserver() =
default;
page_load_metrics::PageLoadMetricsObserver::ObservePolicy
UseCounterPageLoadMetricsObserver::OnStart(
content::NavigationHandle* navigation_handle,
const GURL& currently_committed_url,
bool started_in_foreground) { … }
page_load_metrics::PageLoadMetricsObserver::ObservePolicy
UseCounterPageLoadMetricsObserver::OnFencedFramesStart(
content::NavigationHandle* navigation_handle,
const GURL& currently_committed_url) { … }
page_load_metrics::PageLoadMetricsObserver::ObservePolicy
UseCounterPageLoadMetricsObserver::OnPrerenderStart(
content::NavigationHandle* navigation_handle,
const GURL& currently_committed_url) { … }
page_load_metrics::PageLoadMetricsObserver::ObservePolicy
UseCounterPageLoadMetricsObserver::OnCommit(
content::NavigationHandle* navigation_handle) { … }
void UseCounterPageLoadMetricsObserver::DidActivatePrerenderedPage(
content::NavigationHandle* navigation_handle) { … }
void UseCounterPageLoadMetricsObserver::OnFeaturesUsageObserved(
content::RenderFrameHost* rfh,
const std::vector<blink::UseCounterFeature>& features) { … }
void UseCounterPageLoadMetricsObserver::OnComplete(
const page_load_metrics::mojom::PageLoadTiming& timing) { … }
void UseCounterPageLoadMetricsObserver::OnFailedProvisionalLoad(
const page_load_metrics::FailedProvisionalLoadInfo&
failed_provisional_load_info) { … }
page_load_metrics::PageLoadMetricsObserver::ObservePolicy
UseCounterPageLoadMetricsObserver::FlushMetricsOnAppEnterBackground(
const page_load_metrics::mojom::PageLoadTiming& timing) { … }
page_load_metrics::PageLoadMetricsObserver::ObservePolicy
UseCounterPageLoadMetricsObserver::ShouldObserveMimeType(
const std::string& mime_type) const { … }
page_load_metrics::PageLoadMetricsObserver::ObservePolicy
UseCounterPageLoadMetricsObserver::OnEnterBackForwardCache(
const page_load_metrics::mojom::PageLoadTiming& timing) { … }
bool UseCounterPageLoadMetricsObserver::IsInPrerenderingBeforeActivation()
const { … }