Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(36)

Unified Diff: chrome/browser/page_load_metrics/observers/service_worker_page_load_metrics_observer.cc

Issue 2916033002: Add page/document timing UMAs for search without service worker (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/page_load_metrics/observers/service_worker_page_load_metrics_observer.cc
diff --git a/chrome/browser/page_load_metrics/observers/service_worker_page_load_metrics_observer.cc b/chrome/browser/page_load_metrics/observers/service_worker_page_load_metrics_observer.cc
index 07d663c74dcf1e21739b712dcbb24ae7e6341f03..c83e18101db1e8f9717a05d83b8e325d5577ff55 100644
--- a/chrome/browser/page_load_metrics/observers/service_worker_page_load_metrics_observer.cc
+++ b/chrome/browser/page_load_metrics/observers/service_worker_page_load_metrics_observer.cc
@@ -74,6 +74,25 @@ const char kHistogramServiceWorkerLoadSearch[] =
"PageLoad.Clients.ServiceWorker.DocumentTiming.NavigationToLoadEventFired."
"search";
+const char kHistogramServiceWorkerFirstContentfulPaintSearchNoSW[] =
+ "PageLoad.Clients.ServiceWorker.PaintTiming."
+ "NavigationToFirstContentfulPaint.search_no_sw";
+const char kHistogramServiceWorkerParseStartToFirstContentfulPaintSearchNoSW[] =
+ "PageLoad.Clients.ServiceWorker.PaintTiming."
+ "ParseStartToFirstContentfulPaint.search_no_sw";
+const char kHistogramServiceWorkerFirstMeaningfulPaintSearchNoSW[] =
+ "PageLoad.Clients.ServiceWorker.Experimental.PaintTiming."
+ "NavigationToFirstMeaningfulPaint.search_no_sw";
+const char kHistogramServiceWorkerParseStartToFirstMeaningfulPaintSearchNoSW[] =
+ "PageLoad.Clients.ServiceWorker.Experimental.PaintTiming."
+ "ParseStartToFirstMeaningfulPaint.search_no_sw";
+const char kHistogramServiceWorkerDomContentLoadedSearchNoSW[] =
+ "PageLoad.Clients.ServiceWorker.DocumentTiming."
+ "NavigationToDOMContentLoadedEventFired.search_no_sw";
+const char kHistogramServiceWorkerLoadSearchNoSW[] =
+ "PageLoad.Clients.ServiceWorker.DocumentTiming.NavigationToLoadEventFired."
+ "search_no_sw";
+
} // namespace internal
namespace {
@@ -96,8 +115,22 @@ ServiceWorkerPageLoadMetricsObserver::ServiceWorkerPageLoadMetricsObserver() {}
void ServiceWorkerPageLoadMetricsObserver::OnFirstContentfulPaintInPage(
const page_load_metrics::mojom::PageLoadTiming& timing,
const page_load_metrics::PageLoadExtraInfo& info) {
- if (!IsServiceWorkerControlled(info))
+ if (!IsServiceWorkerControlled(info)) {
+ if (!WasStartedInForegroundOptionalEventInForeground(
+ timing.paint_timing->first_contentful_paint, info) ||
+ !FromGWSPageLoadMetricsLogger::IsGoogleSearchResultUrl(info.url)) {
+ return;
+ }
+ PAGE_LOAD_HISTOGRAM(
+ internal::kHistogramServiceWorkerFirstContentfulPaintSearchNoSW,
+ timing.paint_timing->first_contentful_paint.value());
+ PAGE_LOAD_HISTOGRAM(
+ internal::
+ kHistogramServiceWorkerParseStartToFirstContentfulPaintSearchNoSW,
+ timing.paint_timing->first_contentful_paint.value() -
+ timing.parse_timing->parse_start.value());
return;
+ }
if (!WasStartedInForegroundOptionalEventInForeground(
timing.paint_timing->first_contentful_paint, info)) {
PAGE_LOAD_HISTOGRAM(
@@ -135,12 +168,23 @@ void ServiceWorkerPageLoadMetricsObserver::
OnFirstMeaningfulPaintInMainFrameDocument(
const page_load_metrics::mojom::PageLoadTiming& timing,
const page_load_metrics::PageLoadExtraInfo& info) {
- if (!IsServiceWorkerControlled(info))
- return;
if (!WasStartedInForegroundOptionalEventInForeground(
timing.paint_timing->first_meaningful_paint, info)) {
return;
}
+ if (!IsServiceWorkerControlled(info)) {
+ if (!FromGWSPageLoadMetricsLogger::IsGoogleSearchResultUrl(info.url))
+ return;
+ PAGE_LOAD_HISTOGRAM(
+ internal::kHistogramServiceWorkerFirstMeaningfulPaintSearchNoSW,
+ timing.paint_timing->first_meaningful_paint.value());
+ PAGE_LOAD_HISTOGRAM(
+ internal::
+ kHistogramServiceWorkerParseStartToFirstMeaningfulPaintSearchNoSW,
+ timing.paint_timing->first_meaningful_paint.value() -
+ timing.parse_timing->parse_start.value());
+ return;
+ }
PAGE_LOAD_HISTOGRAM(internal::kHistogramServiceWorkerFirstMeaningfulPaint,
timing.paint_timing->first_meaningful_paint.value());
PAGE_LOAD_HISTOGRAM(
@@ -170,12 +214,18 @@ void ServiceWorkerPageLoadMetricsObserver::
void ServiceWorkerPageLoadMetricsObserver::OnDomContentLoadedEventStart(
const page_load_metrics::mojom::PageLoadTiming& timing,
const page_load_metrics::PageLoadExtraInfo& info) {
- if (!IsServiceWorkerControlled(info))
- return;
if (!WasStartedInForegroundOptionalEventInForeground(
timing.document_timing->dom_content_loaded_event_start, info)) {
return;
}
+ if (!IsServiceWorkerControlled(info)) {
+ if (!FromGWSPageLoadMetricsLogger::IsGoogleSearchResultUrl(info.url))
+ return;
+ PAGE_LOAD_HISTOGRAM(
+ internal::kHistogramServiceWorkerDomContentLoadedSearchNoSW,
+ timing.document_timing->dom_content_loaded_event_start.value());
+ return;
+ }
PAGE_LOAD_HISTOGRAM(
internal::kHistogramServiceWorkerDomContentLoaded,
timing.document_timing->dom_content_loaded_event_start.value());
@@ -193,11 +243,16 @@ void ServiceWorkerPageLoadMetricsObserver::OnDomContentLoadedEventStart(
void ServiceWorkerPageLoadMetricsObserver::OnLoadEventStart(
const page_load_metrics::mojom::PageLoadTiming& timing,
const page_load_metrics::PageLoadExtraInfo& info) {
- if (!IsServiceWorkerControlled(info))
- return;
if (!WasStartedInForegroundOptionalEventInForeground(
timing.document_timing->load_event_start, info))
return;
+ if (!IsServiceWorkerControlled(info)) {
+ if (!FromGWSPageLoadMetricsLogger::IsGoogleSearchResultUrl(info.url))
+ return;
+ PAGE_LOAD_HISTOGRAM(internal::kHistogramServiceWorkerLoadSearchNoSW,
+ timing.document_timing->load_event_start.value());
+ return;
+ }
PAGE_LOAD_HISTOGRAM(internal::kHistogramServiceWorkerLoad,
timing.document_timing->load_event_start.value());
if (IsInboxSite(info.url)) {

Powered by Google App Engine
This is Rietveld 408576698