chromium/chrome/browser/page_load_metrics/observers/service_worker_page_load_metrics_observer.cc

// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#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[] =;
// Record LCP when the page is eligible for RaceNetworkRequest.
// note: This doesn't mean RaceNetworkRequest is actually dispatched.
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[] =;

// The naming of the following histogram does not follow typical convention of
// other histograms. This is because this metrics is ServiceWorker static
// routing API related, and is intended to be consistent with
// `ServiceWorker.RouterEvaluator.*` metrics, which are recorded in
// //chrome/browser/page_load_metrics/observers/
// service_worker_page_load_metrics_observer.cc. Since we need to record this
// metrics on complete, we are recording them here.
const char kHistogramServiceWorkerSubresourceTotalRouterEvaluationTime[] =;

}  // namespace internal

namespace {

bool IsDocsSite(const GURL& url) {}

bool IsForwardBackLoad(ui::PageTransition transition) {}

// These values are persisted to logs. Entries should not be renumbered and
// numeric values should never be reused.
enum class ServiceWorkerResourceLoadStatus {};

}  // namespace

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() {}