| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #if !defined(OS_ANDROID) | 5 #if !defined(OS_ANDROID) |
| 6 | 6 |
| 7 #include "chrome/browser/metrics/first_web_contents_profiler.h" | 7 #include "chrome/browser/metrics/first_web_contents_profiler.h" |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 | 80 |
| 81 void FirstWebContentsProfiler::DidStartNavigation( | 81 void FirstWebContentsProfiler::DidStartNavigation( |
| 82 content::NavigationHandle* navigation_handle) { | 82 content::NavigationHandle* navigation_handle) { |
| 83 if (collected_main_navigation_start_metric_) | 83 if (collected_main_navigation_start_metric_) |
| 84 return; | 84 return; |
| 85 if (startup_metric_utils::WasNonBrowserUIDisplayed()) { | 85 if (startup_metric_utils::WasNonBrowserUIDisplayed()) { |
| 86 FinishedCollectingMetrics(FinishReason::ABANDON_BLOCKING_UI); | 86 FinishedCollectingMetrics(FinishReason::ABANDON_BLOCKING_UI); |
| 87 return; | 87 return; |
| 88 } | 88 } |
| 89 | 89 |
| 90 // TODO(carlosk): this DCHECK is hit when PlzNavigate is enabled. See |
| 91 // crbug.com/610771. |
| 90 // The first navigation has to be the main frame's. | 92 // The first navigation has to be the main frame's. |
| 91 DCHECK(navigation_handle->IsInMainFrame()); | 93 DCHECK(navigation_handle->IsInMainFrame()); |
| 92 | 94 |
| 93 collected_main_navigation_start_metric_ = true; | 95 collected_main_navigation_start_metric_ = true; |
| 94 startup_metric_utils::RecordFirstWebContentsMainNavigationStart( | 96 startup_metric_utils::RecordFirstWebContentsMainNavigationStart( |
| 95 base::TimeTicks::Now()); | 97 base::TimeTicks::Now()); |
| 96 } | 98 } |
| 97 | 99 |
| 98 void FirstWebContentsProfiler::DidFinishNavigation( | 100 void FirstWebContentsProfiler::DidFinishNavigation( |
| 99 content::NavigationHandle* navigation_handle) { | 101 content::NavigationHandle* navigation_handle) { |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 } | 157 } |
| 156 if (!collected_load_metric_) { | 158 if (!collected_load_metric_) { |
| 157 UMA_HISTOGRAM_ENUMERATION("Startup.FirstWebContents.FinishReason_NoLoad", | 159 UMA_HISTOGRAM_ENUMERATION("Startup.FirstWebContents.FinishReason_NoLoad", |
| 158 finish_reason, FinishReason::ENUM_MAX); | 160 finish_reason, FinishReason::ENUM_MAX); |
| 159 } | 161 } |
| 160 | 162 |
| 161 delete this; | 163 delete this; |
| 162 } | 164 } |
| 163 | 165 |
| 164 #endif // !defined(OS_ANDROID) | 166 #endif // !defined(OS_ANDROID) |
| OLD | NEW |