| 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 #include "chrome/browser/metrics/first_web_contents_profiler.h" | 5 #include "chrome/browser/metrics/first_web_contents_profiler.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/location.h" | 9 #include "base/location.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 content::NavigationHandle* navigation_handle) { | 159 content::NavigationHandle* navigation_handle) { |
| 160 if (collected_main_navigation_finished_metric_) { | 160 if (collected_main_navigation_finished_metric_) { |
| 161 // Abandon profiling on a top-level navigation to a different page as it: | 161 // Abandon profiling on a top-level navigation to a different page as it: |
| 162 // (1) is no longer a fair timing; and | 162 // (1) is no longer a fair timing; and |
| 163 // (2) can cause http://crbug.com/525209 where one of the timing | 163 // (2) can cause http://crbug.com/525209 where one of the timing |
| 164 // heuristics (e.g. first paint) didn't fire for the initial content | 164 // heuristics (e.g. first paint) didn't fire for the initial content |
| 165 // but fires after a lot of idle time when the user finally navigates | 165 // but fires after a lot of idle time when the user finally navigates |
| 166 // to another page that does trigger it. | 166 // to another page that does trigger it. |
| 167 if (navigation_handle->IsInMainFrame() && | 167 if (navigation_handle->IsInMainFrame() && |
| 168 navigation_handle->HasCommitted() && | 168 navigation_handle->HasCommitted() && |
| 169 !navigation_handle->IsSamePage()) { | 169 !navigation_handle->IsSameDocument()) { |
| 170 FinishedCollectingMetrics(FinishReason::ABANDON_NEW_NAVIGATION); | 170 FinishedCollectingMetrics(FinishReason::ABANDON_NEW_NAVIGATION); |
| 171 } | 171 } |
| 172 return; | 172 return; |
| 173 } | 173 } |
| 174 | 174 |
| 175 if (startup_metric_utils::WasNonBrowserUIDisplayed()) { | 175 if (startup_metric_utils::WasNonBrowserUIDisplayed()) { |
| 176 FinishedCollectingMetrics(FinishReason::ABANDON_BLOCKING_UI); | 176 FinishedCollectingMetrics(FinishReason::ABANDON_BLOCKING_UI); |
| 177 return; | 177 return; |
| 178 } | 178 } |
| 179 | 179 |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 const bool single_tab = browser_list->size() == 1 && tab_strip->count() == 1; | 249 const bool single_tab = browser_list->size() == 1 && tab_strip->count() == 1; |
| 250 | 250 |
| 251 // FirstWebContentsProfiler owns itself and is also bound to | 251 // FirstWebContentsProfiler owns itself and is also bound to |
| 252 // |web_contents|'s lifetime by observing WebContentsDestroyed(). | 252 // |web_contents|'s lifetime by observing WebContentsDestroyed(). |
| 253 new FirstWebContentsProfiler(web_contents, | 253 new FirstWebContentsProfiler(web_contents, |
| 254 single_tab ? WebContentsWorkload::SINGLE_TAB | 254 single_tab ? WebContentsWorkload::SINGLE_TAB |
| 255 : WebContentsWorkload::MULTI_TABS); | 255 : WebContentsWorkload::MULTI_TABS); |
| 256 } | 256 } |
| 257 | 257 |
| 258 } // namespace metrics | 258 } // namespace metrics |
| OLD | NEW |