Index: components/page_load_metrics/browser/metrics_web_contents_observer.h |
diff --git a/components/page_load_metrics/browser/metrics_web_contents_observer.h b/components/page_load_metrics/browser/metrics_web_contents_observer.h |
index 524e1c01beef82435c40f99efa2e02853ec841e3..81be06694cbfbcc8872d8d4fd5c2b774ea8ef8d0 100644 |
--- a/components/page_load_metrics/browser/metrics_web_contents_observer.h |
+++ b/components/page_load_metrics/browser/metrics_web_contents_observer.h |
@@ -8,7 +8,6 @@ |
#include <map> |
#include "base/macros.h" |
-#include "base/observer_list.h" |
#include "base/time/time.h" |
#include "components/page_load_metrics/browser/page_load_metrics_observer.h" |
#include "components/page_load_metrics/common/page_load_timing.h" |
@@ -73,6 +72,11 @@ const char kHistogramFirstBackground[] = |
const char kHistogramFirstForeground[] = |
"PageLoad.Timing2.NavigationToFirstForeground"; |
+const char kHistogramBackgroundBeforePaint[] = |
+ "PageLoad.Timing2.NavigationToFirstBackground.AfterCommit.BeforePaint"; |
+const char kHistogramBackgroundBeforeCommit[] = |
+ "PageLoad.Timing2.NavigationToFirstBackground.BeforeCommit"; |
+ |
const char kProvisionalEvents[] = "PageLoad.Events.Provisional"; |
const char kCommittedEvents[] = "PageLoad.Events.Committed"; |
const char kBackgroundProvisionalEvents[] = |
@@ -222,16 +226,24 @@ class PageLoadTracker { |
void set_renderer_tracked(bool renderer_tracked); |
bool renderer_tracked() { return renderer_tracked_; } |
+ const UserAbortType abort_type() { return abort_type_; } |
Alexei Svitkine (slow)
2015/12/15 19:40:16
I meant:
UserAbortType abort_type() const { retur
|
+ const base::TimeTicks abort_time() { return abort_time_; } |
+ |
void AddObserver(scoped_ptr<PageLoadMetricsObserver> observer); |
+ // If the user performs some abort-like action while we are tracking this page |
+ // load, notify the tracker. Note that we may not classify this as an abort if |
+ // we've already performed a first paint. |
+ void NotifyAbort(UserAbortType abort_type, base::TimeTicks timestamp); |
+ void UpdateAbort(UserAbortType abort_type, base::TimeTicks timestamp); |
+ |
private: |
PageLoadExtraInfo GetPageLoadMetricsInfo(); |
// Only valid to call post-commit. |
const GURL& committed_url(); |
- base::TimeDelta GetBackgroundDelta(); |
- void RecordTimingHistograms(); |
- void RecordRappor(); |
+ void RecordTimingHistograms(const PageLoadExtraInfo& info); |
+ void RecordRappor(const PageLoadExtraInfo& info); |
// Whether the renderer should be sending timing IPCs to this page load. |
bool renderer_tracked_; |
@@ -241,6 +253,11 @@ class PageLoadTracker { |
// The navigation start in TimeTicks, not the wall time reported by Blink. |
const base::TimeTicks navigation_start_; |
+ // Will be ABORT_NONE if we have not aborted this load yet. Otherwise will |
+ // be the first abort action the user performed. |
+ UserAbortType abort_type_; |
+ base::TimeTicks abort_time_; |
+ |
// We record separate metrics for events that occur after a background, |
// because metrics like layout/paint are delayed artificially |
// when they occur in the background. |
@@ -285,15 +302,20 @@ class MetricsWebContentsObserver |
content::NavigationHandle* navigation_handle) override; |
void DidRedirectNavigation( |
content::NavigationHandle* navigation_handle) override; |
- |
+ void NavigationStopped() override; |
void WasShown() override; |
void WasHidden() override; |
- |
void RenderProcessGone(base::TerminationStatus status) override; |
private: |
friend class content::WebContentsUserData<MetricsWebContentsObserver>; |
+ // Notify all loads, provisional and committed, that we performed an action |
+ // that might abort them. |
+ void NotifyAbortAllLoads(UserAbortType abort_type); |
+ void NotifyAbortAllLoadsWithTimestamp(UserAbortType abort_type, |
+ base::TimeTicks timestamp); |
+ |
void OnTimingUpdated(content::RenderFrameHost*, const PageLoadTiming& timing); |
// True if the web contents is currently in the foreground. |
@@ -309,6 +331,14 @@ class MetricsWebContentsObserver |
// valid until commit time, when we remove it from the map. |
std::map<content::NavigationHandle*, scoped_ptr<PageLoadTracker>> |
provisional_loads_; |
+ |
+ // Tracks aborted provisional loads for a little bit longer than usual (one |
+ // more navigation commit at the max), in order to better understand how the |
+ // navigation failed. This is because most provisional loads are destroyed and |
+ // vanish before we get signal about what caused the abort (new navigation, |
+ // stop button, etc.). |
+ std::vector<scoped_ptr<PageLoadTracker>> aborted_provisional_loads_; |
+ |
scoped_ptr<PageLoadTracker> committed_load_; |
DISALLOW_COPY_AND_ASSIGN(MetricsWebContentsObserver); |