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

Side by Side Diff: chrome/renderer/page_load_metrics/metrics_render_frame_observer.cc

Issue 2238543002: Instrument parser blocking script execution time. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments 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/renderer/page_load_metrics/metrics_render_frame_observer.h" 5 #include "chrome/renderer/page_load_metrics/metrics_render_frame_observer.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "base/time/time.h" 10 #include "base/time/time.h"
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 if (perf.parseStop() > 0.0) 151 if (perf.parseStop() > 0.0)
152 timing.parse_stop = ClampDelta(perf.parseStop(), start); 152 timing.parse_stop = ClampDelta(perf.parseStop(), start);
153 if (timing.parse_start) { 153 if (timing.parse_start) {
154 // If we started parsing, record all parser durations such as the amount of 154 // If we started parsing, record all parser durations such as the amount of
155 // time blocked on script load, even if those values are zero. 155 // time blocked on script load, even if those values are zero.
156 timing.parse_blocked_on_script_load_duration = 156 timing.parse_blocked_on_script_load_duration =
157 base::TimeDelta::FromSecondsD(perf.parseBlockedOnScriptLoadDuration()); 157 base::TimeDelta::FromSecondsD(perf.parseBlockedOnScriptLoadDuration());
158 timing.parse_blocked_on_script_load_from_document_write_duration = 158 timing.parse_blocked_on_script_load_from_document_write_duration =
159 base::TimeDelta::FromSecondsD( 159 base::TimeDelta::FromSecondsD(
160 perf.parseBlockedOnScriptLoadFromDocumentWriteDuration()); 160 perf.parseBlockedOnScriptLoadFromDocumentWriteDuration());
161 timing.parse_blocked_on_script_execution_duration =
162 base::TimeDelta::FromSecondsD(
163 perf.parseBlockedOnScriptExecutionDuration());
164 timing.parse_blocked_on_script_execution_from_document_write_duration =
165 base::TimeDelta::FromSecondsD(
166 perf.parseBlockedOnScriptExecutionFromDocumentWriteDuration());
161 } 167 }
162 return timing; 168 return timing;
163 } 169 }
164 170
165 std::unique_ptr<base::Timer> MetricsRenderFrameObserver::CreateTimer() const { 171 std::unique_ptr<base::Timer> MetricsRenderFrameObserver::CreateTimer() const {
166 return base::WrapUnique(new base::OneShotTimer); 172 return base::WrapUnique(new base::OneShotTimer);
167 } 173 }
168 174
169 bool MetricsRenderFrameObserver::HasNoRenderFrame() const { 175 bool MetricsRenderFrameObserver::HasNoRenderFrame() const {
170 bool no_frame = !render_frame() || !render_frame()->GetWebFrame(); 176 bool no_frame = !render_frame() || !render_frame()->GetWebFrame();
171 DCHECK(!no_frame); 177 DCHECK(!no_frame);
172 return no_frame; 178 return no_frame;
173 } 179 }
174 180
175 void MetricsRenderFrameObserver::OnDestruct() { 181 void MetricsRenderFrameObserver::OnDestruct() {
176 delete this; 182 delete this;
177 } 183 }
178 184
179 } // namespace page_load_metrics 185 } // namespace page_load_metrics
OLDNEW
« no previous file with comments | « chrome/common/page_load_metrics/page_load_timing.cc ('k') | third_party/WebKit/Source/core/dom/DocumentParserTiming.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698