#include "chrome/browser/page_load_metrics/observers/service_worker_page_load_metrics_observer.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/page_load_metrics/observers/from_gws_page_load_metrics_observer.h"
#include "components/page_load_metrics/browser/page_load_metrics_observer_delegate.h"
#include "components/page_load_metrics/browser/page_load_metrics_util.h"
#include "content/public/browser/navigation_handle.h"
#include "net/http/http_response_headers.h"
#include "services/metrics/public/cpp/metrics_utils.h"
#include "services/metrics/public/cpp/ukm_builders.h"
#include "services/metrics/public/cpp/ukm_recorder.h"
#include "third_party/blink/public/common/loader/loading_behavior_flag.h"
namespace internal {
const char kHistogramServiceWorkerParseStart[] = …;
const char kHistogramServiceWorkerParseStartForwardBack[] = …;
const char kHistogramServiceWorkerParseStartForwardBackNoStore[] = …;
const char kBackgroundHistogramServiceWorkerParseStart[] = …;
const char kHistogramServiceWorkerFirstPaint[] = …;
const char kHistogramServiceWorkerFirstContentfulPaint[] = …;
const char kHistogramServiceWorkerFirstContentfulPaintForwardBack[] = …;
const char kHistogramServiceWorkerFirstContentfulPaintForwardBackNoStore[] = …;
const char kHistogramServiceWorkerFirstContentfulPaintSkippableFetchHandler[] = …;
const char
kHistogramServiceWorkerFirstContentfulPaintNonSkippableFetchHandler[] = …;
const char
kHistogramServiceWorkerFirstContentfulPaintRaceNetworkRequestEligible[] = …;
const char kBackgroundHistogramServiceWorkerFirstContentfulPaint[] = …;
const char kHistogramServiceWorkerParseStartToFirstContentfulPaint[] = …;
const char kHistogramServiceWorkerDomContentLoaded[] = …;
const char kHistogramServiceWorkerLoad[] = …;
const char kHistogramServiceWorkerLargestContentfulPaint[] = …;
const char
kHistogramServiceWorkerLargestContentfulPaintSkippableFetchHandler[] = …;
const char
kHistogramServiceWorkerLargestContentfulPaintNonSkippableFetchHandler[] = …;
const char
kHistogramServiceWorkerLargestContentfulPaintRaceNetworkRequestEligible[] = …;
const char kHistogramServiceWorkerParseStartSearch[] = …;
const char kHistogramServiceWorkerFirstContentfulPaintSearch[] = …;
const char kHistogramServiceWorkerParseStartToFirstContentfulPaintSearch[] = …;
const char kHistogramServiceWorkerDomContentLoadedSearch[] = …;
const char kHistogramServiceWorkerLoadSearch[] = …;
const char kHistogramNoServiceWorkerFirstContentfulPaintSearch[] = …;
const char kHistogramNoServiceWorkerParseStartToFirstContentfulPaintSearch[] = …;
const char kHistogramNoServiceWorkerDomContentLoadedSearch[] = …;
const char kHistogramNoServiceWorkerLoadSearch[] = …;
const char kHistogramServiceWorkerFirstContentfulPaintDocs[] = …;
const char kHistogramNoServiceWorkerFirstContentfulPaintDocs[] = …;
const char kHistogramServiceWorkerSubresourceTotalRouterEvaluationTime[] = …;
}
namespace {
bool IsDocsSite(const GURL& url) { … }
bool IsForwardBackLoad(ui::PageTransition transition) { … }
enum class ServiceWorkerResourceLoadStatus { … };
}
ServiceWorkerPageLoadMetricsObserver::ServiceWorkerPageLoadMetricsObserver() { … }
page_load_metrics::PageLoadMetricsObserver::ObservePolicy
ServiceWorkerPageLoadMetricsObserver::OnFencedFramesStart(
content::NavigationHandle* navigation_handle,
const GURL& currently_committed_url) { … }
page_load_metrics::PageLoadMetricsObserver::ObservePolicy
ServiceWorkerPageLoadMetricsObserver::OnPrerenderStart(
content::NavigationHandle* navigation_handle,
const GURL& currently_committed_url) { … }
page_load_metrics::PageLoadMetricsObserver::ObservePolicy
ServiceWorkerPageLoadMetricsObserver::OnCommit(
content::NavigationHandle* navigation_handle) { … }
void ServiceWorkerPageLoadMetricsObserver::OnFirstPaintInPage(
const page_load_metrics::mojom::PageLoadTiming& timing) { … }
void ServiceWorkerPageLoadMetricsObserver::OnFirstContentfulPaintInPage(
const page_load_metrics::mojom::PageLoadTiming& timing) { … }
void ServiceWorkerPageLoadMetricsObserver::OnDomContentLoadedEventStart(
const page_load_metrics::mojom::PageLoadTiming& timing) { … }
void ServiceWorkerPageLoadMetricsObserver::OnLoadEventStart(
const page_load_metrics::mojom::PageLoadTiming& timing) { … }
void ServiceWorkerPageLoadMetricsObserver::OnFirstInputInPage(
const page_load_metrics::mojom::PageLoadTiming& timing) { … }
void ServiceWorkerPageLoadMetricsObserver::OnParseStart(
const page_load_metrics::mojom::PageLoadTiming& timing) { … }
void ServiceWorkerPageLoadMetricsObserver::OnLoadingBehaviorObserved(
content::RenderFrameHost* rfh,
int behavior_flags) { … }
void ServiceWorkerPageLoadMetricsObserver::OnComplete(
const page_load_metrics::mojom::PageLoadTiming& timing) { … }
page_load_metrics::PageLoadMetricsObserver::ObservePolicy
ServiceWorkerPageLoadMetricsObserver::FlushMetricsOnAppEnterBackground(
const page_load_metrics::mojom::PageLoadTiming& timing) { … }
void ServiceWorkerPageLoadMetricsObserver::RecordTimingHistograms() { … }
bool ServiceWorkerPageLoadMetricsObserver::IsServiceWorkerControlled() { … }
bool ServiceWorkerPageLoadMetricsObserver::
IsServiceWorkerFetchHandlerSkippable() { … }
bool ServiceWorkerPageLoadMetricsObserver::
IsServiceWorkerEligibleForRaceNetworkRequest() { … }
void ServiceWorkerPageLoadMetricsObserver::RecordSubresourceLoad() { … }