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

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

Issue 2806863003: [Page Load Metrics] Structure PageLoadTiming. (Closed)
Patch Set: rebase Created 3 years, 8 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/amp_page_load_metrics_obser ver.h" 5 #include "chrome/browser/page_load_metrics/observers/amp_page_load_metrics_obser ver.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/optional.h" 9 #include "base/optional.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 AMPPageLoadMetricsObserver::OnCommit( 57 AMPPageLoadMetricsObserver::OnCommit(
58 content::NavigationHandle* navigation_handle) { 58 content::NavigationHandle* navigation_handle) {
59 return IsAMPCacheURL(navigation_handle->GetURL()) ? CONTINUE_OBSERVING 59 return IsAMPCacheURL(navigation_handle->GetURL()) ? CONTINUE_OBSERVING
60 : STOP_OBSERVING; 60 : STOP_OBSERVING;
61 } 61 }
62 62
63 void AMPPageLoadMetricsObserver::OnDomContentLoadedEventStart( 63 void AMPPageLoadMetricsObserver::OnDomContentLoadedEventStart(
64 const page_load_metrics::PageLoadTiming& timing, 64 const page_load_metrics::PageLoadTiming& timing,
65 const page_load_metrics::PageLoadExtraInfo& info) { 65 const page_load_metrics::PageLoadExtraInfo& info) {
66 if (!WasStartedInForegroundOptionalEventInForeground( 66 if (!WasStartedInForegroundOptionalEventInForeground(
67 timing.dom_content_loaded_event_start, info)) { 67 timing.document_timing.dom_content_loaded_event_start, info)) {
68 return; 68 return;
69 } 69 }
70 PAGE_LOAD_HISTOGRAM(kHistogramAMPDOMContentLoadedEventFired, 70 PAGE_LOAD_HISTOGRAM(
71 timing.dom_content_loaded_event_start.value()); 71 kHistogramAMPDOMContentLoadedEventFired,
72 timing.document_timing.dom_content_loaded_event_start.value());
72 } 73 }
73 74
74 void AMPPageLoadMetricsObserver::OnLoadEventStart( 75 void AMPPageLoadMetricsObserver::OnLoadEventStart(
75 const page_load_metrics::PageLoadTiming& timing, 76 const page_load_metrics::PageLoadTiming& timing,
76 const page_load_metrics::PageLoadExtraInfo& info) { 77 const page_load_metrics::PageLoadExtraInfo& info) {
77 if (!WasStartedInForegroundOptionalEventInForeground(timing.load_event_start, 78 if (!WasStartedInForegroundOptionalEventInForeground(
78 info)) { 79 timing.document_timing.load_event_start, info)) {
79 return; 80 return;
80 } 81 }
81 PAGE_LOAD_HISTOGRAM(kHistogramAMPLoadEventFired, 82 PAGE_LOAD_HISTOGRAM(kHistogramAMPLoadEventFired,
82 timing.load_event_start.value()); 83 timing.document_timing.load_event_start.value());
83 } 84 }
84 85
85 void AMPPageLoadMetricsObserver::OnFirstLayout( 86 void AMPPageLoadMetricsObserver::OnFirstLayout(
86 const page_load_metrics::PageLoadTiming& timing, 87 const page_load_metrics::PageLoadTiming& timing,
87 const page_load_metrics::PageLoadExtraInfo& info) { 88 const page_load_metrics::PageLoadExtraInfo& info) {
88 if (!WasStartedInForegroundOptionalEventInForeground(timing.first_layout, 89 if (!WasStartedInForegroundOptionalEventInForeground(
89 info)) { 90 timing.document_timing.first_layout, info)) {
90 return; 91 return;
91 } 92 }
92 PAGE_LOAD_HISTOGRAM(kHistogramAMPFirstLayout, timing.first_layout.value()); 93 PAGE_LOAD_HISTOGRAM(kHistogramAMPFirstLayout,
94 timing.document_timing.first_layout.value());
93 } 95 }
94 96
95 void AMPPageLoadMetricsObserver::OnFirstContentfulPaint( 97 void AMPPageLoadMetricsObserver::OnFirstContentfulPaint(
96 const page_load_metrics::PageLoadTiming& timing, 98 const page_load_metrics::PageLoadTiming& timing,
97 const page_load_metrics::PageLoadExtraInfo& info) { 99 const page_load_metrics::PageLoadExtraInfo& info) {
98 if (!WasStartedInForegroundOptionalEventInForeground( 100 if (!WasStartedInForegroundOptionalEventInForeground(
99 timing.first_contentful_paint, info)) { 101 timing.paint_timing.first_contentful_paint, info)) {
100 return; 102 return;
101 } 103 }
102 PAGE_LOAD_HISTOGRAM(kHistogramAMPFirstContentfulPaint, 104 PAGE_LOAD_HISTOGRAM(kHistogramAMPFirstContentfulPaint,
103 timing.first_contentful_paint.value()); 105 timing.paint_timing.first_contentful_paint.value());
104 } 106 }
105 107
106 void AMPPageLoadMetricsObserver::OnParseStart( 108 void AMPPageLoadMetricsObserver::OnParseStart(
107 const page_load_metrics::PageLoadTiming& timing, 109 const page_load_metrics::PageLoadTiming& timing,
108 const page_load_metrics::PageLoadExtraInfo& info) { 110 const page_load_metrics::PageLoadExtraInfo& info) {
109 if (!WasStartedInForegroundOptionalEventInForeground(timing.parse_start, 111 if (!WasStartedInForegroundOptionalEventInForeground(
110 info)) { 112 timing.parse_timing.parse_start, info)) {
111 return; 113 return;
112 } 114 }
113 PAGE_LOAD_HISTOGRAM(kHistogramAMPParseStart, timing.parse_start.value()); 115 PAGE_LOAD_HISTOGRAM(kHistogramAMPParseStart,
116 timing.parse_timing.parse_start.value());
114 } 117 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698