Index: chrome/browser/metrics/first_web_contents_profiler.cc |
diff --git a/chrome/browser/metrics/first_web_contents_profiler.cc b/chrome/browser/metrics/first_web_contents_profiler.cc |
index a95ff37d65df883ea517cd442d3dd8f612f1e33f..ea8f6f8bf1c7c47c1eb6a79f2ec3be3375e26c05 100644 |
--- a/chrome/browser/metrics/first_web_contents_profiler.cc |
+++ b/chrome/browser/metrics/first_web_contents_profiler.cc |
@@ -22,6 +22,7 @@ |
#include "components/startup_metric_utils/startup_metric_utils.h" |
#include "content/public/browser/browser_thread.h" |
#include "content/public/browser/navigation_details.h" |
+#include "content/public/browser/navigation_handle.h" |
namespace { |
@@ -116,6 +117,8 @@ FirstWebContentsProfiler::FirstWebContentsProfiler( |
initial_entry_committed_(false), |
collected_paint_metric_(false), |
collected_load_metric_(false), |
+ collected_main_navigation_start_metric_(false), |
+ collected_main_navigation_finished_metric_(false), |
responsiveness_histogram_(NULL), |
responsiveness_1sec_histogram_(NULL), |
responsiveness_10sec_histogram_(NULL), |
@@ -178,6 +181,43 @@ void FirstWebContentsProfiler::DocumentOnLoadCompletedInMainFrame() { |
FinishedCollectingMetrics(FinishReason::DONE); |
} |
+void FirstWebContentsProfiler::DidStartNavigation( |
+ content::NavigationHandle* navigation_handle) { |
+ if (collected_main_navigation_start_metric_) |
+ return; |
+ if (startup_metric_utils::WasNonBrowserUIDisplayed()) { |
+ FinishedCollectingMetrics(FinishReason::ABANDON_BLOCKING_UI); |
+ return; |
+ } |
+ |
+ if (navigation_handle->IsInMainFrame()) { |
clamy
2015/10/26 17:51:42
I think you could just DCHECK(navigation_handle->I
gab
2015/10/27 15:56:15
Done.
|
+ collected_main_navigation_start_metric_ = true; |
+ startup_metric_utils::RecordFirstWebContentsMainNavigationStart( |
+ base::Time::Now()); |
+ } |
+} |
+ |
+void FirstWebContentsProfiler::DidFinishNavigation( |
+ content::NavigationHandle* navigation_handle) { |
+ if (collected_main_navigation_finished_metric_) |
+ return; |
+ if (startup_metric_utils::WasNonBrowserUIDisplayed()) { |
+ FinishedCollectingMetrics(FinishReason::ABANDON_BLOCKING_UI); |
+ return; |
+ } |
+ |
+ if (navigation_handle->IsInMainFrame()) { |
clamy
2015/10/26 17:51:42
Same here, DCHECK(navigation_handle->IsInMainFrame
gab
2015/10/27 15:56:15
Done.
|
+ if (!navigation_handle->HasCommitted() || |
+ navigation_handle->IsErrorPage()) { |
+ FinishedCollectingMetrics(FinishReason::ABANDON_NAVIGATION_ERROR); |
+ return; |
+ } |
+ collected_main_navigation_finished_metric_ = true; |
+ startup_metric_utils::RecordFirstWebContentsMainNavigationFinished( |
+ base::Time::Now()); |
+ } |
+} |
+ |
void FirstWebContentsProfiler::NavigationEntryCommitted( |
const content::LoadCommittedDetails& load_details) { |
// Abandon profiling on any navigation to a different page as it: |
@@ -188,7 +228,7 @@ void FirstWebContentsProfiler::NavigationEntryCommitted( |
// page that does trigger it. |
if (load_details.is_navigation_to_different_page()) { |
if (initial_entry_committed_) |
- FinishedCollectingMetrics(FinishReason::ABANDON_NAVIGATION); |
+ FinishedCollectingMetrics(FinishReason::ABANDON_NEW_NAVIGATION); |
else |
initial_entry_committed_ = true; |
} |