| 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 "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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 timing.parse_blocked_on_script_load_from_document_write_duration = | 137 timing.parse_blocked_on_script_load_from_document_write_duration = |
| 138 base::TimeDelta::FromSecondsD( | 138 base::TimeDelta::FromSecondsD( |
| 139 perf.parseBlockedOnScriptLoadFromDocumentWriteDuration()); | 139 perf.parseBlockedOnScriptLoadFromDocumentWriteDuration()); |
| 140 timing.parse_blocked_on_script_execution_duration = | 140 timing.parse_blocked_on_script_execution_duration = |
| 141 base::TimeDelta::FromSecondsD( | 141 base::TimeDelta::FromSecondsD( |
| 142 perf.parseBlockedOnScriptExecutionDuration()); | 142 perf.parseBlockedOnScriptExecutionDuration()); |
| 143 timing.parse_blocked_on_script_execution_from_document_write_duration = | 143 timing.parse_blocked_on_script_execution_from_document_write_duration = |
| 144 base::TimeDelta::FromSecondsD( | 144 base::TimeDelta::FromSecondsD( |
| 145 perf.parseBlockedOnScriptExecutionFromDocumentWriteDuration()); | 145 perf.parseBlockedOnScriptExecutionFromDocumentWriteDuration()); |
| 146 } | 146 } |
| 147 |
| 148 if (perf.authorStyleSheetParseDurationBeforeFCP() > 0.0) { |
| 149 timing.style_sheet_timing.author_style_sheet_parse_duration_before_fcp = |
| 150 base::TimeDelta::FromSecondsD( |
| 151 perf.authorStyleSheetParseDurationBeforeFCP()); |
| 152 } |
| 147 return timing; | 153 return timing; |
| 148 } | 154 } |
| 149 | 155 |
| 150 std::unique_ptr<base::Timer> MetricsRenderFrameObserver::CreateTimer() const { | 156 std::unique_ptr<base::Timer> MetricsRenderFrameObserver::CreateTimer() const { |
| 151 return base::WrapUnique(new base::OneShotTimer); | 157 return base::WrapUnique(new base::OneShotTimer); |
| 152 } | 158 } |
| 153 | 159 |
| 154 bool MetricsRenderFrameObserver::HasNoRenderFrame() const { | 160 bool MetricsRenderFrameObserver::HasNoRenderFrame() const { |
| 155 bool no_frame = !render_frame() || !render_frame()->GetWebFrame(); | 161 bool no_frame = !render_frame() || !render_frame()->GetWebFrame(); |
| 156 DCHECK(!no_frame); | 162 DCHECK(!no_frame); |
| 157 return no_frame; | 163 return no_frame; |
| 158 } | 164 } |
| 159 | 165 |
| 160 void MetricsRenderFrameObserver::OnDestruct() { | 166 void MetricsRenderFrameObserver::OnDestruct() { |
| 161 delete this; | 167 delete this; |
| 162 } | 168 } |
| 163 | 169 |
| 164 } // namespace page_load_metrics | 170 } // namespace page_load_metrics |
| OLD | NEW |