| OLD | NEW |
| 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 "components/page_load_metrics/renderer/metrics_render_frame_observer.h" | 5 #include "components/page_load_metrics/renderer/metrics_render_frame_observer.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
| 10 #include "base/timer/timer.h" | 10 #include "base/timer/timer.h" |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 return true; | 102 return true; |
| 103 } | 103 } |
| 104 | 104 |
| 105 PageLoadTiming MetricsRenderFrameObserver::GetTiming() const { | 105 PageLoadTiming MetricsRenderFrameObserver::GetTiming() const { |
| 106 const blink::WebPerformance& perf = | 106 const blink::WebPerformance& perf = |
| 107 render_frame()->GetWebFrame()->performance(); | 107 render_frame()->GetWebFrame()->performance(); |
| 108 | 108 |
| 109 PageLoadTiming timing; | 109 PageLoadTiming timing; |
| 110 double start = perf.navigationStart(); | 110 double start = perf.navigationStart(); |
| 111 timing.navigation_start = base::Time::FromDoubleT(start); | 111 timing.navigation_start = base::Time::FromDoubleT(start); |
| 112 timing.worker_start = base::Time::FromDoubleT(perf.workerStart()); |
| 112 timing.response_start = ClampDelta(perf.responseStart(), start); | 113 timing.response_start = ClampDelta(perf.responseStart(), start); |
| 113 timing.dom_loading = ClampDelta(perf.domLoading(), start); | 114 timing.dom_loading = ClampDelta(perf.domLoading(), start); |
| 114 timing.dom_content_loaded_event_start = | 115 timing.dom_content_loaded_event_start = |
| 115 ClampDelta(perf.domContentLoadedEventStart(), start); | 116 ClampDelta(perf.domContentLoadedEventStart(), start); |
| 116 timing.load_event_start = ClampDelta(perf.loadEventStart(), start); | 117 timing.load_event_start = ClampDelta(perf.loadEventStart(), start); |
| 117 timing.first_layout = ClampDelta(perf.firstLayout(), start); | 118 timing.first_layout = ClampDelta(perf.firstLayout(), start); |
| 118 timing.first_paint = ClampDelta(perf.firstPaint(), start); | 119 timing.first_paint = ClampDelta(perf.firstPaint(), start); |
| 119 timing.first_text_paint = ClampDelta(perf.firstTextPaint(), start); | 120 timing.first_text_paint = ClampDelta(perf.firstTextPaint(), start); |
| 120 timing.first_image_paint = ClampDelta(perf.firstImagePaint(), start); | 121 timing.first_image_paint = ClampDelta(perf.firstImagePaint(), start); |
| 121 timing.first_contentful_paint = | 122 timing.first_contentful_paint = |
| (...skipping 12 matching lines...) Expand all Loading... |
| 134 return make_scoped_ptr(new base::OneShotTimer); | 135 return make_scoped_ptr(new base::OneShotTimer); |
| 135 } | 136 } |
| 136 | 137 |
| 137 bool MetricsRenderFrameObserver::HasNoRenderFrame() const { | 138 bool MetricsRenderFrameObserver::HasNoRenderFrame() const { |
| 138 bool no_frame = !render_frame() || !render_frame()->GetWebFrame(); | 139 bool no_frame = !render_frame() || !render_frame()->GetWebFrame(); |
| 139 DCHECK(!no_frame); | 140 DCHECK(!no_frame); |
| 140 return no_frame; | 141 return no_frame; |
| 141 } | 142 } |
| 142 | 143 |
| 143 } // namespace page_load_metrics | 144 } // namespace page_load_metrics |
| OLD | NEW |