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

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

Issue 2039363003: FirstMeaningfulPaint UMA (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 4 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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 117
118 PageLoadTiming MetricsRenderFrameObserver::GetTiming() const { 118 PageLoadTiming MetricsRenderFrameObserver::GetTiming() const {
119 const blink::WebPerformance& perf = 119 const blink::WebPerformance& perf =
120 render_frame()->GetWebFrame()->performance(); 120 render_frame()->GetWebFrame()->performance();
121 121
122 PageLoadTiming timing; 122 PageLoadTiming timing;
123 double start = perf.navigationStart(); 123 double start = perf.navigationStart();
124 timing.navigation_start = base::Time::FromDoubleT(start); 124 timing.navigation_start = base::Time::FromDoubleT(start);
125 if (perf.responseStart() > 0.0) 125 if (perf.responseStart() > 0.0)
126 timing.response_start = ClampDelta(perf.responseStart(), start); 126 timing.response_start = ClampDelta(perf.responseStart(), start);
127 if (perf.domContentLoadedEventStart() > 0.0) 127 if (perf.domContentLoadedEventStart() > 0.0) {
128 timing.dom_content_loaded_event_start = 128 timing.dom_content_loaded_event_start =
129 ClampDelta(perf.domContentLoadedEventStart(), start); 129 ClampDelta(perf.domContentLoadedEventStart(), start);
130 }
130 if (perf.loadEventStart() > 0.0) 131 if (perf.loadEventStart() > 0.0)
131 timing.load_event_start = ClampDelta(perf.loadEventStart(), start); 132 timing.load_event_start = ClampDelta(perf.loadEventStart(), start);
132 if (perf.firstLayout() > 0.0) 133 if (perf.firstLayout() > 0.0)
133 timing.first_layout = ClampDelta(perf.firstLayout(), start); 134 timing.first_layout = ClampDelta(perf.firstLayout(), start);
134 if (perf.firstPaint() > 0.0) 135 if (perf.firstPaint() > 0.0)
135 timing.first_paint = ClampDelta(perf.firstPaint(), start); 136 timing.first_paint = ClampDelta(perf.firstPaint(), start);
136 if (perf.firstTextPaint() > 0.0) 137 if (perf.firstTextPaint() > 0.0)
137 timing.first_text_paint = ClampDelta(perf.firstTextPaint(), start); 138 timing.first_text_paint = ClampDelta(perf.firstTextPaint(), start);
138 if (perf.firstImagePaint() > 0.0) 139 if (perf.firstImagePaint() > 0.0)
139 timing.first_image_paint = ClampDelta(perf.firstImagePaint(), start); 140 timing.first_image_paint = ClampDelta(perf.firstImagePaint(), start);
140 if (perf.firstContentfulPaint() > 0.0) 141 if (perf.firstContentfulPaint() > 0.0) {
141 timing.first_contentful_paint = 142 timing.first_contentful_paint =
142 ClampDelta(perf.firstContentfulPaint(), start); 143 ClampDelta(perf.firstContentfulPaint(), start);
144 }
145 if (perf.firstMeaningfulPaint() > 0.0) {
146 timing.first_meaningful_paint =
147 ClampDelta(perf.firstMeaningfulPaint(), start);
148 }
143 if (perf.parseStart() > 0.0) 149 if (perf.parseStart() > 0.0)
144 timing.parse_start = ClampDelta(perf.parseStart(), start); 150 timing.parse_start = ClampDelta(perf.parseStart(), start);
145 if (perf.parseStop() > 0.0) 151 if (perf.parseStop() > 0.0)
146 timing.parse_stop = ClampDelta(perf.parseStop(), start); 152 timing.parse_stop = ClampDelta(perf.parseStop(), start);
147 if (timing.parse_start) { 153 if (timing.parse_start) {
148 // 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
149 // time blocked on script load, even if those values are zero. 155 // time blocked on script load, even if those values are zero.
150 timing.parse_blocked_on_script_load_duration = 156 timing.parse_blocked_on_script_load_duration =
151 base::TimeDelta::FromSecondsD(perf.parseBlockedOnScriptLoadDuration()); 157 base::TimeDelta::FromSecondsD(perf.parseBlockedOnScriptLoadDuration());
152 timing.parse_blocked_on_script_load_from_document_write_duration = 158 timing.parse_blocked_on_script_load_from_document_write_duration =
(...skipping 11 matching lines...) Expand all
164 bool no_frame = !render_frame() || !render_frame()->GetWebFrame(); 170 bool no_frame = !render_frame() || !render_frame()->GetWebFrame();
165 DCHECK(!no_frame); 171 DCHECK(!no_frame);
166 return no_frame; 172 return no_frame;
167 } 173 }
168 174
169 void MetricsRenderFrameObserver::OnDestruct() { 175 void MetricsRenderFrameObserver::OnDestruct() {
170 delete this; 176 delete this;
171 } 177 }
172 178
173 } // namespace page_load_metrics 179 } // 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/core.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698