Chromium Code Reviews| 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 45780c10314b8299d30896b9c7e4127739fec65b..93841b0003c824a185af23a8cb4a4e54118068d0 100644 |
| --- a/components/page_load_metrics/browser/metrics_web_contents_observer.h |
| +++ b/components/page_load_metrics/browser/metrics_web_contents_observer.h |
| @@ -12,6 +12,7 @@ |
| #include "content/public/browser/web_contents.h" |
| #include "content/public/browser/web_contents_observer.h" |
| #include "content/public/browser/web_contents_user_data.h" |
| +#include "net/base/net_errors.h" |
| namespace content { |
| class NavigationHandle; |
| @@ -24,6 +25,36 @@ class Message; |
| namespace page_load_metrics { |
| +// If you add or remove elements from this enum, make sure you update the enum |
|
Alexei Svitkine (slow)
2015/10/02 14:57:14
Nit: Please rephrase this, as current comment impl
|
| +// value in histograms.xml. |
| +enum PageLoadEvent { |
| + PAGE_LOAD_STARTED, |
| + |
| + // A provisional load is a load before it commits, i.e. before it receives the |
| + // first bytes of the response body or knows the encoding of the response |
| + // body. A load failed before it was committed for any reason, e.g. from a |
| + // user abort or a network timeout. |
| + PAGE_LOAD_FAILED_BEFORE_COMMIT, |
| + |
| + // A subset of PAGE_LOAD_FAILED_BEFORE_COMMIT, this counts the |
| + // specific failures due to user aborts. |
| + PAGE_LOAD_ABORTED_BEFORE_COMMIT, |
| + |
| + // When a load is aborted anytime before the page's first layout, we increase |
| + // these counts. This includes all failed provisional loads. |
| + PAGE_LOAD_ABORTED_BEFORE_FIRST_LAYOUT, |
| + |
| + // We increase this count if a page load successfully has a layout. |
| + // Differentiate between loads that were backgrounded before first layout. |
| + // Note that a load that is backgrounded, then foregrounded before first |
| + // layout will still end up in the backgrounded bucket. |
| + PAGE_LOAD_SUCCESSFUL_FIRST_LAYOUT_FOREGROUND, |
| + PAGE_LOAD_SUCCESSFUL_FIRST_LAYOUT_BACKGROUND, |
| + |
| + // Add values before this final count. |
| + PAGE_LOAD_LAST_ENTRY |
| +}; |
| + |
| class PageLoadTracker { |
| public: |
| explicit PageLoadTracker(bool in_foreground); |
| @@ -33,6 +64,7 @@ class PageLoadTracker { |
| // Returns true if the timing was successfully updated. |
| bool UpdateTiming(const PageLoadTiming& timing); |
| + void RecordEvent(PageLoadEvent event); |
| private: |
| void RecordTimingHistograms(); |