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

Side by Side Diff: chrome/browser/page_load_metrics/observers/service_worker_page_load_metrics_observer.cc

Issue 2874663005: [Page Load Metrics] Add mojom file to page load metrics. (Closed)
Patch Set: Remove unnecessary variable 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/page_load_metrics/observers/service_worker_page_load_me trics_observer.h" 5 #include "chrome/browser/page_load_metrics/observers/service_worker_page_load_me trics_observer.h"
6 6
7 #include "chrome/browser/page_load_metrics/page_load_metrics_util.h" 7 #include "chrome/browser/page_load_metrics/page_load_metrics_util.h"
8 #include "third_party/WebKit/public/platform/WebLoadingBehaviorFlag.h" 8 #include "third_party/WebKit/public/platform/WebLoadingBehaviorFlag.h"
9 9
10 namespace internal { 10 namespace internal {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 55
56 bool IsInboxSite(const GURL& url) { 56 bool IsInboxSite(const GURL& url) {
57 return url.host_piece() == "inbox.google.com"; 57 return url.host_piece() == "inbox.google.com";
58 } 58 }
59 59
60 } // namespace 60 } // namespace
61 61
62 ServiceWorkerPageLoadMetricsObserver::ServiceWorkerPageLoadMetricsObserver() {} 62 ServiceWorkerPageLoadMetricsObserver::ServiceWorkerPageLoadMetricsObserver() {}
63 63
64 void ServiceWorkerPageLoadMetricsObserver::OnFirstContentfulPaintInPage( 64 void ServiceWorkerPageLoadMetricsObserver::OnFirstContentfulPaintInPage(
65 const page_load_metrics::PageLoadTiming& timing, 65 const page_load_metrics::mojom::PageLoadTiming& timing,
66 const page_load_metrics::PageLoadExtraInfo& info) { 66 const page_load_metrics::PageLoadExtraInfo& info) {
67 if (!IsServiceWorkerControlled(info)) 67 if (!IsServiceWorkerControlled(info))
68 return; 68 return;
69 if (!WasStartedInForegroundOptionalEventInForeground( 69 if (!WasStartedInForegroundOptionalEventInForeground(
70 timing.paint_timing.first_contentful_paint, info)) { 70 timing.paint_timing->first_contentful_paint, info)) {
71 PAGE_LOAD_HISTOGRAM( 71 PAGE_LOAD_HISTOGRAM(
72 internal::kBackgroundHistogramServiceWorkerFirstContentfulPaint, 72 internal::kBackgroundHistogramServiceWorkerFirstContentfulPaint,
73 timing.paint_timing.first_contentful_paint.value()); 73 timing.paint_timing->first_contentful_paint.value());
74 return; 74 return;
75 } 75 }
76 PAGE_LOAD_HISTOGRAM(internal::kHistogramServiceWorkerFirstContentfulPaint, 76 PAGE_LOAD_HISTOGRAM(internal::kHistogramServiceWorkerFirstContentfulPaint,
77 timing.paint_timing.first_contentful_paint.value()); 77 timing.paint_timing->first_contentful_paint.value());
78 PAGE_LOAD_HISTOGRAM( 78 PAGE_LOAD_HISTOGRAM(
79 internal::kHistogramServiceWorkerParseStartToFirstContentfulPaint, 79 internal::kHistogramServiceWorkerParseStartToFirstContentfulPaint,
80 timing.paint_timing.first_contentful_paint.value() - 80 timing.paint_timing->first_contentful_paint.value() -
81 timing.parse_timing.parse_start.value()); 81 timing.parse_timing->parse_start.value());
82 82
83 if (IsInboxSite(info.url)) { 83 if (IsInboxSite(info.url)) {
84 PAGE_LOAD_HISTOGRAM( 84 PAGE_LOAD_HISTOGRAM(
85 internal::kHistogramServiceWorkerFirstContentfulPaintInbox, 85 internal::kHistogramServiceWorkerFirstContentfulPaintInbox,
86 timing.paint_timing.first_contentful_paint.value()); 86 timing.paint_timing->first_contentful_paint.value());
87 PAGE_LOAD_HISTOGRAM( 87 PAGE_LOAD_HISTOGRAM(
88 internal::kHistogramServiceWorkerParseStartToFirstContentfulPaintInbox, 88 internal::kHistogramServiceWorkerParseStartToFirstContentfulPaintInbox,
89 timing.paint_timing.first_contentful_paint.value() - 89 timing.paint_timing->first_contentful_paint.value() -
90 timing.parse_timing.parse_start.value()); 90 timing.parse_timing->parse_start.value());
91 } 91 }
92 } 92 }
93 93
94 void ServiceWorkerPageLoadMetricsObserver::OnDomContentLoadedEventStart( 94 void ServiceWorkerPageLoadMetricsObserver::OnDomContentLoadedEventStart(
95 const page_load_metrics::PageLoadTiming& timing, 95 const page_load_metrics::mojom::PageLoadTiming& timing,
96 const page_load_metrics::PageLoadExtraInfo& info) { 96 const page_load_metrics::PageLoadExtraInfo& info) {
97 if (!IsServiceWorkerControlled(info)) 97 if (!IsServiceWorkerControlled(info))
98 return; 98 return;
99 if (!WasStartedInForegroundOptionalEventInForeground( 99 if (!WasStartedInForegroundOptionalEventInForeground(
100 timing.document_timing.dom_content_loaded_event_start, info)) { 100 timing.document_timing->dom_content_loaded_event_start, info)) {
101 return; 101 return;
102 } 102 }
103 PAGE_LOAD_HISTOGRAM( 103 PAGE_LOAD_HISTOGRAM(
104 internal::kHistogramServiceWorkerDomContentLoaded, 104 internal::kHistogramServiceWorkerDomContentLoaded,
105 timing.document_timing.dom_content_loaded_event_start.value()); 105 timing.document_timing->dom_content_loaded_event_start.value());
106 if (IsInboxSite(info.url)) { 106 if (IsInboxSite(info.url)) {
107 PAGE_LOAD_HISTOGRAM( 107 PAGE_LOAD_HISTOGRAM(
108 internal::kHistogramServiceWorkerDomContentLoadedInbox, 108 internal::kHistogramServiceWorkerDomContentLoadedInbox,
109 timing.document_timing.dom_content_loaded_event_start.value()); 109 timing.document_timing->dom_content_loaded_event_start.value());
110 } 110 }
111 } 111 }
112 112
113 void ServiceWorkerPageLoadMetricsObserver::OnLoadEventStart( 113 void ServiceWorkerPageLoadMetricsObserver::OnLoadEventStart(
114 const page_load_metrics::PageLoadTiming& timing, 114 const page_load_metrics::mojom::PageLoadTiming& timing,
115 const page_load_metrics::PageLoadExtraInfo& info) { 115 const page_load_metrics::PageLoadExtraInfo& info) {
116 if (!IsServiceWorkerControlled(info)) 116 if (!IsServiceWorkerControlled(info))
117 return; 117 return;
118 if (!WasStartedInForegroundOptionalEventInForeground( 118 if (!WasStartedInForegroundOptionalEventInForeground(
119 timing.document_timing.load_event_start, info)) 119 timing.document_timing->load_event_start, info))
120 return; 120 return;
121 PAGE_LOAD_HISTOGRAM(internal::kHistogramServiceWorkerLoad, 121 PAGE_LOAD_HISTOGRAM(internal::kHistogramServiceWorkerLoad,
122 timing.document_timing.load_event_start.value()); 122 timing.document_timing->load_event_start.value());
123 if (IsInboxSite(info.url)) { 123 if (IsInboxSite(info.url)) {
124 PAGE_LOAD_HISTOGRAM(internal::kHistogramServiceWorkerLoadInbox, 124 PAGE_LOAD_HISTOGRAM(internal::kHistogramServiceWorkerLoadInbox,
125 timing.document_timing.load_event_start.value()); 125 timing.document_timing->load_event_start.value());
126 } 126 }
127 } 127 }
128 128
129 void ServiceWorkerPageLoadMetricsObserver::OnParseStart( 129 void ServiceWorkerPageLoadMetricsObserver::OnParseStart(
130 const page_load_metrics::PageLoadTiming& timing, 130 const page_load_metrics::mojom::PageLoadTiming& timing,
131 const page_load_metrics::PageLoadExtraInfo& info) { 131 const page_load_metrics::PageLoadExtraInfo& info) {
132 if (!IsServiceWorkerControlled(info)) 132 if (!IsServiceWorkerControlled(info))
133 return; 133 return;
134 if (WasStartedInForegroundOptionalEventInForeground( 134 if (WasStartedInForegroundOptionalEventInForeground(
135 timing.parse_timing.parse_start, info)) { 135 timing.parse_timing->parse_start, info)) {
136 PAGE_LOAD_HISTOGRAM(internal::kHistogramServiceWorkerParseStart, 136 PAGE_LOAD_HISTOGRAM(internal::kHistogramServiceWorkerParseStart,
137 timing.parse_timing.parse_start.value()); 137 timing.parse_timing->parse_start.value());
138 } else { 138 } else {
139 PAGE_LOAD_HISTOGRAM(internal::kBackgroundHistogramServiceWorkerParseStart, 139 PAGE_LOAD_HISTOGRAM(internal::kBackgroundHistogramServiceWorkerParseStart,
140 timing.parse_timing.parse_start.value()); 140 timing.parse_timing->parse_start.value());
141 } 141 }
142 } 142 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698