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

Side by Side Diff: chrome/browser/page_load_metrics/metrics_web_contents_observer.cc

Issue 2238543002: Instrument parser blocking script execution time. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comment Created 4 years, 3 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/metrics_web_contents_observer.h" 5 #include "chrome/browser/page_load_metrics/metrics_web_contents_observer.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <ostream> 8 #include <ostream>
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 108
109 if (timing.parse_stop) { 109 if (timing.parse_stop) {
110 const base::TimeDelta parse_duration = 110 const base::TimeDelta parse_duration =
111 timing.parse_stop.value() - timing.parse_start.value(); 111 timing.parse_stop.value() - timing.parse_start.value();
112 if (timing.parse_blocked_on_script_load_duration > parse_duration) { 112 if (timing.parse_blocked_on_script_load_duration > parse_duration) {
113 NOTREACHED() << "Invalid parse_blocked_on_script_load_duration " 113 NOTREACHED() << "Invalid parse_blocked_on_script_load_duration "
114 << timing.parse_blocked_on_script_load_duration 114 << timing.parse_blocked_on_script_load_duration
115 << " for parse duration " << parse_duration; 115 << " for parse duration " << parse_duration;
116 return false; 116 return false;
117 } 117 }
118 if (timing.parse_blocked_on_script_execution_duration > parse_duration) {
119 NOTREACHED() << "Invalid parse_blocked_on_script_execution_duration "
120 << timing.parse_blocked_on_script_execution_duration
121 << " for parse duration " << parse_duration;
122 return false;
123 }
118 } 124 }
119 125
120 if (timing.parse_blocked_on_script_load_from_document_write_duration > 126 if (timing.parse_blocked_on_script_load_from_document_write_duration >
121 timing.parse_blocked_on_script_load_duration) { 127 timing.parse_blocked_on_script_load_duration) {
122 NOTREACHED() 128 NOTREACHED()
123 << "Invalid parse_blocked_on_script_load_from_document_write_duration " 129 << "Invalid parse_blocked_on_script_load_from_document_write_duration "
124 << timing.parse_blocked_on_script_load_from_document_write_duration 130 << timing.parse_blocked_on_script_load_from_document_write_duration
125 << " for parse_blocked_on_script_load_duration " 131 << " for parse_blocked_on_script_load_duration "
126 << timing.parse_blocked_on_script_load_duration; 132 << timing.parse_blocked_on_script_load_duration;
127 return false; 133 return false;
128 } 134 }
129 135
136 if (timing.parse_blocked_on_script_execution_from_document_write_duration >
137 timing.parse_blocked_on_script_execution_duration) {
138 NOTREACHED()
139 << "Invalid "
Charlie Harrison 2016/09/07 14:57:37 Fix up the formatting here.
Bryan McQuade 2016/09/07 18:26:09 I think this is the best formatting option for bet
Charlie Harrison 2016/09/07 18:32:50 Ah you're right. Missed the underscores here. Sorr
140 "parse_blocked_on_script_execution_from_document_write_duration "
141 << timing.parse_blocked_on_script_execution_from_document_write_duration
142 << " for parse_blocked_on_script_execution_duration "
143 << timing.parse_blocked_on_script_execution_duration;
144 return false;
145 }
146
130 if (!EventsInOrder(timing.parse_stop, 147 if (!EventsInOrder(timing.parse_stop,
131 timing.dom_content_loaded_event_start)) { 148 timing.dom_content_loaded_event_start)) {
132 NOTREACHED() << "Invalid parse_stop " << timing.parse_stop 149 NOTREACHED() << "Invalid parse_stop " << timing.parse_stop
133 << " for dom_content_loaded_event_start " 150 << " for dom_content_loaded_event_start "
134 << timing.dom_content_loaded_event_start; 151 << timing.dom_content_loaded_event_start;
135 return false; 152 return false;
136 } 153 }
137 154
138 if (!EventsInOrder(timing.dom_content_loaded_event_start, 155 if (!EventsInOrder(timing.dom_content_loaded_event_start,
139 timing.load_event_start)) { 156 timing.load_event_start)) {
(...skipping 912 matching lines...) Expand 10 before | Expand all | Expand 10 after
1052 if (navigation_handle->IsSamePage() || navigation_handle->IsErrorPage()) 1069 if (navigation_handle->IsSamePage() || navigation_handle->IsErrorPage())
1053 return false; 1070 return false;
1054 const std::string& mime_type = web_contents()->GetContentsMimeType(); 1071 const std::string& mime_type = web_contents()->GetContentsMimeType();
1055 if (mime_type != "text/html" && mime_type != "application/xhtml+xml") 1072 if (mime_type != "text/html" && mime_type != "application/xhtml+xml")
1056 return false; 1073 return false;
1057 } 1074 }
1058 return true; 1075 return true;
1059 } 1076 }
1060 1077
1061 } // namespace page_load_metrics 1078 } // namespace page_load_metrics
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698