OLD | NEW |
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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 } | 54 } |
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::OnFirstContentfulPaint( | 64 void ServiceWorkerPageLoadMetricsObserver::OnFirstContentfulPaintInPage( |
65 const page_load_metrics::PageLoadTiming& timing, | 65 const page_load_metrics::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; |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 } |
OLD | NEW |