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

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

Issue 2457583007: [PageLoadMetrics] Create page load timing metrics for H2/QUIC/H1 pages (Closed)
Patch Set: Fix test Created 4 years, 1 month 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/page_load_metrics/observers/protocol_page_load_metrics_ observer.h"
6
7 #include "chrome/browser/page_load_metrics/page_load_metrics_util.h"
8
9 page_load_metrics::PageLoadMetricsObserver::ObservePolicy
10 ProtocolPageLoadMetricsObserver::OnCommit(
11 content::NavigationHandle* navigation_handle) {
12 connection_info_ = navigation_handle->GetConnectionInfo();
13 return CONTINUE_OBSERVING;
14 }
15
16 void ProtocolPageLoadMetricsObserver::OnFirstContentfulPaint(
17 const page_load_metrics::PageLoadTiming& timing,
18 const page_load_metrics::PageLoadExtraInfo& extra_info) {
19 switch (connection_info_) {
20 case net::HttpResponseInfo::CONNECTION_INFO_UNKNOWN:
21 case net::HttpResponseInfo::CONNECTION_INFO_DEPRECATED_SPDY2:
22 case net::HttpResponseInfo::CONNECTION_INFO_DEPRECATED_SPDY3:
23 case net::HttpResponseInfo::CONNECTION_INFO_DEPRECATED_HTTP2_14:
24 case net::HttpResponseInfo::CONNECTION_INFO_DEPRECATED_HTTP2_15:
25 case net::HttpResponseInfo::CONNECTION_INFO_HTTP0_9:
26 case net::HttpResponseInfo::CONNECTION_INFO_HTTP1_0:
27 case net::HttpResponseInfo::NUM_OF_CONNECTION_INFOS:
28 return;
29 case net::HttpResponseInfo::CONNECTION_INFO_HTTP1_1:
Charlie Harrison 2016/10/31 15:27:17 Did you consider merging 1.1 and 1.0 traffic?
jkarlin 2016/10/31 16:50:06 There are substantial differences between 1.1 and
Bryan McQuade 2016/11/05 00:24:02 If we're only going to log 1.1 I think we should r
30 PAGE_LOAD_HISTOGRAM(
31 "PageLoad.Clients.Protocol.H1.PaintTiming."
32 "ParseStartToFirstContentfulPaint",
33 timing.first_contentful_paint.value() - timing.parse_start.value());
34 break;
35 case net::HttpResponseInfo::CONNECTION_INFO_HTTP2:
36 PAGE_LOAD_HISTOGRAM(
37 "PageLoad.Clients.Protocol.H2.PaintTiming."
38 "ParseStartToFirstContentfulPaint",
39 timing.first_contentful_paint.value() - timing.parse_start.value());
40 break;
41 case net::HttpResponseInfo::CONNECTION_INFO_QUIC:
42 PAGE_LOAD_HISTOGRAM(
43 "PageLoad.Clients.Protocol.QUIC.PaintTiming."
44 "ParseStartToFirstContentfulPaint",
45 timing.first_contentful_paint.value() - timing.parse_start.value());
46 break;
47 }
48 }
49
50 void ProtocolPageLoadMetricsObserver::OnFirstMeaningfulPaint(
51 const page_load_metrics::PageLoadTiming& timing,
52 const page_load_metrics::PageLoadExtraInfo& extra_info) {
53 switch (connection_info_) {
54 case net::HttpResponseInfo::CONNECTION_INFO_UNKNOWN:
55 case net::HttpResponseInfo::CONNECTION_INFO_DEPRECATED_SPDY2:
56 case net::HttpResponseInfo::CONNECTION_INFO_DEPRECATED_SPDY3:
57 case net::HttpResponseInfo::CONNECTION_INFO_DEPRECATED_HTTP2_14:
58 case net::HttpResponseInfo::CONNECTION_INFO_DEPRECATED_HTTP2_15:
59 case net::HttpResponseInfo::CONNECTION_INFO_HTTP0_9:
60 case net::HttpResponseInfo::CONNECTION_INFO_HTTP1_0:
61 case net::HttpResponseInfo::NUM_OF_CONNECTION_INFOS:
62 return;
63 case net::HttpResponseInfo::CONNECTION_INFO_HTTP1_1:
64 PAGE_LOAD_HISTOGRAM(
65 "PageLoad.Clients.Protocol.H1.Experimental.PaintTiming."
66 "ParseStartToFirstMeaningfulPaint",
67 timing.first_meaningful_paint.value() - timing.parse_start.value());
68 break;
69 case net::HttpResponseInfo::CONNECTION_INFO_HTTP2:
70 PAGE_LOAD_HISTOGRAM(
71 "PageLoad.Clients.Protocol.H2.Experimental.PaintTiming."
72 "ParseStartToFirstMeaningfulPaint",
73 timing.first_meaningful_paint.value() - timing.parse_start.value());
74 break;
75 case net::HttpResponseInfo::CONNECTION_INFO_QUIC:
76 PAGE_LOAD_HISTOGRAM(
77 "PageLoad.Clients.Protocol.QUIC.Experimental.PaintTiming."
78 "ParseStartToFirstMeaningfulPaint",
79 timing.first_meaningful_paint.value() - timing.parse_start.value());
80 break;
81 }
82 }
83
84 void ProtocolPageLoadMetricsObserver::OnDomContentLoadedEventStart(
85 const page_load_metrics::PageLoadTiming& timing,
86 const page_load_metrics::PageLoadExtraInfo& extra_info) {
87 switch (connection_info_) {
88 case net::HttpResponseInfo::CONNECTION_INFO_UNKNOWN:
89 case net::HttpResponseInfo::CONNECTION_INFO_DEPRECATED_SPDY2:
90 case net::HttpResponseInfo::CONNECTION_INFO_DEPRECATED_SPDY3:
91 case net::HttpResponseInfo::CONNECTION_INFO_DEPRECATED_HTTP2_14:
92 case net::HttpResponseInfo::CONNECTION_INFO_DEPRECATED_HTTP2_15:
93 case net::HttpResponseInfo::CONNECTION_INFO_HTTP0_9:
94 case net::HttpResponseInfo::CONNECTION_INFO_HTTP1_0:
95 case net::HttpResponseInfo::NUM_OF_CONNECTION_INFOS:
96 return;
97 case net::HttpResponseInfo::CONNECTION_INFO_HTTP1_1:
98 PAGE_LOAD_HISTOGRAM(
99 "PageLoad.Clients.Protocol.H1.DocumentTiming."
100 "NavigationToDOMContentLoadedEventFired",
101 timing.dom_content_loaded_event_start.value());
102 break;
103 case net::HttpResponseInfo::CONNECTION_INFO_HTTP2:
104 PAGE_LOAD_HISTOGRAM(
105 "PageLoad.Clients.Protocol.H2.DocumentTiming."
106 "NavigationToDOMContentLoadedEventFired",
107 timing.dom_content_loaded_event_start.value());
108 break;
109 case net::HttpResponseInfo::CONNECTION_INFO_QUIC:
110 PAGE_LOAD_HISTOGRAM(
111 "PageLoad.Clients.Protocol.QUIC.DocumentTiming."
112 "NavigationToDOMContentLoadedEventFired",
113 timing.dom_content_loaded_event_start.value());
114 break;
115 }
116 }
117
118 void ProtocolPageLoadMetricsObserver::OnLoadEventStart(
119 const page_load_metrics::PageLoadTiming& timing,
120 const page_load_metrics::PageLoadExtraInfo& extra_info) {
121 switch (connection_info_) {
122 case net::HttpResponseInfo::CONNECTION_INFO_UNKNOWN:
123 case net::HttpResponseInfo::CONNECTION_INFO_DEPRECATED_SPDY2:
124 case net::HttpResponseInfo::CONNECTION_INFO_DEPRECATED_SPDY3:
125 case net::HttpResponseInfo::CONNECTION_INFO_DEPRECATED_HTTP2_14:
126 case net::HttpResponseInfo::CONNECTION_INFO_DEPRECATED_HTTP2_15:
127 case net::HttpResponseInfo::CONNECTION_INFO_HTTP0_9:
128 case net::HttpResponseInfo::CONNECTION_INFO_HTTP1_0:
129 case net::HttpResponseInfo::NUM_OF_CONNECTION_INFOS:
130 return;
131 case net::HttpResponseInfo::CONNECTION_INFO_HTTP1_1:
132 PAGE_LOAD_HISTOGRAM(
133 "PageLoad.Clients.Protocol.H1.DocumentTiming."
134 "NavigationToLoadEventFired",
135 timing.load_event_start.value());
136 break;
137 case net::HttpResponseInfo::CONNECTION_INFO_HTTP2:
138 PAGE_LOAD_HISTOGRAM(
139 "PageLoad.Clients.Protocol.H2.DocumentTiming."
140 "NavigationToLoadEventFired",
141 timing.load_event_start.value());
142 break;
143 case net::HttpResponseInfo::CONNECTION_INFO_QUIC:
144 PAGE_LOAD_HISTOGRAM(
145 "PageLoad.Clients.Protocol.QUIC.DocumentTiming."
146 "NavigationToLoadEventFired",
147 timing.load_event_start.value());
148 break;
149 }
150 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698