| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #ifndef COMPONENTS_PAGE_LOAD_METRICS_BROWSER_PAGE_LOAD_METRICS_WEB_CONTENTS_OBSE
RVER_H_ | 5 #ifndef COMPONENTS_PAGE_LOAD_METRICS_BROWSER_PAGE_LOAD_METRICS_WEB_CONTENTS_OBSE
RVER_H_ |
| 6 #define COMPONENTS_PAGE_LOAD_METRICS_BROWSER_PAGE_LOAD_METRICS_WEB_CONTENTS_OBSE
RVER_H_ | 6 #define COMPONENTS_PAGE_LOAD_METRICS_BROWSER_PAGE_LOAD_METRICS_WEB_CONTENTS_OBSE
RVER_H_ |
| 7 | 7 |
| 8 #include "base/containers/scoped_ptr_map.h" | 8 #include "base/containers/scoped_ptr_map.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 PAGE_LOAD_LAST_ENTRY | 56 PAGE_LOAD_LAST_ENTRY |
| 57 }; | 57 }; |
| 58 | 58 |
| 59 class PageLoadTracker { | 59 class PageLoadTracker { |
| 60 public: | 60 public: |
| 61 explicit PageLoadTracker(bool in_foreground); | 61 explicit PageLoadTracker(bool in_foreground); |
| 62 ~PageLoadTracker(); | 62 ~PageLoadTracker(); |
| 63 void Commit(); | 63 void Commit(); |
| 64 void WebContentsHidden(); | 64 void WebContentsHidden(); |
| 65 | 65 |
| 66 // If the final destination of the navigation is one of the origins included |
| 67 // in the stale-while-revalidate experiment, call this method. See |
| 68 // https://docs.google.com/document/d/1nBhr25nSJgoyAh4S1-U5h2sH70Iz4RR0NAfXNL7
9G5Y/edit |
| 69 // for the design doc. |
| 70 void IncludeInStaleWhileRevalidateExperiment(); |
| 71 |
| 66 // Returns true if the timing was successfully updated. | 72 // Returns true if the timing was successfully updated. |
| 67 bool UpdateTiming(const PageLoadTiming& timing); | 73 bool UpdateTiming(const PageLoadTiming& timing); |
| 68 void RecordEvent(PageLoadEvent event); | 74 void RecordEvent(PageLoadEvent event); |
| 69 | 75 |
| 70 private: | 76 private: |
| 71 void RecordTimingHistograms(); | 77 void RecordTimingHistograms(); |
| 72 | 78 |
| 73 bool has_commit_; | 79 bool has_commit_; |
| 74 | 80 |
| 75 // We record separate metrics for events that occur after a background, | 81 // We record separate metrics for events that occur after a background, |
| 76 // because metrics like layout/paint are delayed artificially | 82 // because metrics like layout/paint are delayed artificially |
| 77 // when they occur in the bacground. | 83 // when they occur in the bacground. |
| 78 base::TimeTicks background_time_; | 84 base::TimeTicks background_time_; |
| 79 bool started_in_foreground_; | 85 bool started_in_foreground_; |
| 86 bool include_in_stale_while_revalidate_experiment_; |
| 80 | 87 |
| 81 PageLoadTiming timing_; | 88 PageLoadTiming timing_; |
| 82 | 89 |
| 83 DISALLOW_COPY_AND_ASSIGN(PageLoadTracker); | 90 DISALLOW_COPY_AND_ASSIGN(PageLoadTracker); |
| 84 }; | 91 }; |
| 85 | 92 |
| 86 // MetricsWebContentsObserver logs page load UMA metrics based on | 93 // MetricsWebContentsObserver logs page load UMA metrics based on |
| 87 // IPC messages received from a MetricsRenderFrameObserver. | 94 // IPC messages received from a MetricsRenderFrameObserver. |
| 88 class MetricsWebContentsObserver | 95 class MetricsWebContentsObserver |
| 89 : public content::WebContentsObserver, | 96 : public content::WebContentsObserver, |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 base::ScopedPtrMap<content::NavigationHandle*, scoped_ptr<PageLoadTracker>> | 130 base::ScopedPtrMap<content::NavigationHandle*, scoped_ptr<PageLoadTracker>> |
| 124 provisional_loads_; | 131 provisional_loads_; |
| 125 scoped_ptr<PageLoadTracker> committed_load_; | 132 scoped_ptr<PageLoadTracker> committed_load_; |
| 126 | 133 |
| 127 DISALLOW_COPY_AND_ASSIGN(MetricsWebContentsObserver); | 134 DISALLOW_COPY_AND_ASSIGN(MetricsWebContentsObserver); |
| 128 }; | 135 }; |
| 129 | 136 |
| 130 } // namespace page_load_metrics | 137 } // namespace page_load_metrics |
| 131 | 138 |
| 132 #endif // COMPONENTS_PAGE_LOAD_METRICS_BROWSER_PAGE_LOAD_METRICS_WEB_CONTENTS_O
BSERVER_H_ | 139 #endif // COMPONENTS_PAGE_LOAD_METRICS_BROWSER_PAGE_LOAD_METRICS_WEB_CONTENTS_O
BSERVER_H_ |
| OLD | NEW |