| 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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 | 147 |
| 148 if (perf.authorStyleSheetParseDurationBeforeFCP() > 0.0) { | 148 if (perf.authorStyleSheetParseDurationBeforeFCP() > 0.0) { |
| 149 timing.style_sheet_timing.author_style_sheet_parse_duration_before_fcp = | 149 timing.style_sheet_timing.author_style_sheet_parse_duration_before_fcp = |
| 150 base::TimeDelta::FromSecondsD( | 150 base::TimeDelta::FromSecondsD( |
| 151 perf.authorStyleSheetParseDurationBeforeFCP()); | 151 perf.authorStyleSheetParseDurationBeforeFCP()); |
| 152 } | 152 } |
| 153 if (perf.updateStyleDurationBeforeFCP() > 0.0) { |
| 154 timing.style_sheet_timing.update_style_duration_before_fcp = |
| 155 base::TimeDelta::FromSecondsD(perf.updateStyleDurationBeforeFCP()); |
| 156 } |
| 153 return timing; | 157 return timing; |
| 154 } | 158 } |
| 155 | 159 |
| 156 std::unique_ptr<base::Timer> MetricsRenderFrameObserver::CreateTimer() const { | 160 std::unique_ptr<base::Timer> MetricsRenderFrameObserver::CreateTimer() const { |
| 157 return base::WrapUnique(new base::OneShotTimer); | 161 return base::WrapUnique(new base::OneShotTimer); |
| 158 } | 162 } |
| 159 | 163 |
| 160 bool MetricsRenderFrameObserver::HasNoRenderFrame() const { | 164 bool MetricsRenderFrameObserver::HasNoRenderFrame() const { |
| 161 bool no_frame = !render_frame() || !render_frame()->GetWebFrame(); | 165 bool no_frame = !render_frame() || !render_frame()->GetWebFrame(); |
| 162 DCHECK(!no_frame); | 166 DCHECK(!no_frame); |
| 163 return no_frame; | 167 return no_frame; |
| 164 } | 168 } |
| 165 | 169 |
| 166 void MetricsRenderFrameObserver::OnDestruct() { | 170 void MetricsRenderFrameObserver::OnDestruct() { |
| 167 delete this; | 171 delete this; |
| 168 } | 172 } |
| 169 | 173 |
| 170 } // namespace page_load_metrics | 174 } // namespace page_load_metrics |
| OLD | NEW |