Chromium Code Reviews| 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 <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 116 base::TimeTicks abort_time() const { return abort_time_; } | 116 base::TimeTicks abort_time() const { return abort_time_; } |
| 117 | 117 |
| 118 void AddObserver(scoped_ptr<PageLoadMetricsObserver> observer); | 118 void AddObserver(scoped_ptr<PageLoadMetricsObserver> observer); |
| 119 | 119 |
| 120 // If the user performs some abort-like action while we are tracking this page | 120 // If the user performs some abort-like action while we are tracking this page |
| 121 // load, notify the tracker. Note that we may not classify this as an abort if | 121 // load, notify the tracker. Note that we may not classify this as an abort if |
| 122 // we've already performed a first paint. | 122 // we've already performed a first paint. |
| 123 void NotifyAbort(UserAbortType abort_type, const base::TimeTicks& timestamp); | 123 void NotifyAbort(UserAbortType abort_type, const base::TimeTicks& timestamp); |
| 124 void UpdateAbort(UserAbortType abort_type, const base::TimeTicks& timestamp); | 124 void UpdateAbort(UserAbortType abort_type, const base::TimeTicks& timestamp); |
| 125 | 125 |
| 126 void set_is_using_lofi(bool is_using_lofi); | |
| 127 void set_was_fetched_via_data_reduction_proxy( | |
| 128 bool was_fetched_via_data_reduction_proxy); | |
| 129 | |
| 126 private: | 130 private: |
| 127 PageLoadExtraInfo GetPageLoadMetricsInfo(); | 131 PageLoadExtraInfo GetPageLoadMetricsInfo(); |
| 128 // Only valid to call post-commit. | 132 // Only valid to call post-commit. |
| 129 const GURL& committed_url(); | 133 const GURL& committed_url(); |
| 130 | 134 |
| 131 void RecordTimingHistograms(const PageLoadExtraInfo& info); | 135 void RecordTimingHistograms(const PageLoadExtraInfo& info); |
| 132 void UpdateAbortInternal(UserAbortType abort_type, | 136 void UpdateAbortInternal(UserAbortType abort_type, |
| 133 const base::TimeTicks& timestamp); | 137 const base::TimeTicks& timestamp); |
| 134 | 138 |
| 135 // Whether the renderer should be sending timing IPCs to this page load. | 139 // Whether the renderer should be sending timing IPCs to this page load. |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 155 base::TimeTicks foreground_time_; | 159 base::TimeTicks foreground_time_; |
| 156 bool started_in_foreground_; | 160 bool started_in_foreground_; |
| 157 | 161 |
| 158 PageLoadTiming timing_; | 162 PageLoadTiming timing_; |
| 159 | 163 |
| 160 // Interface to chrome features. Must outlive the class. | 164 // Interface to chrome features. Must outlive the class. |
| 161 PageLoadMetricsEmbedderInterface* const embedder_interface_; | 165 PageLoadMetricsEmbedderInterface* const embedder_interface_; |
| 162 | 166 |
| 163 std::vector<scoped_ptr<PageLoadMetricsObserver>> observers_; | 167 std::vector<scoped_ptr<PageLoadMetricsObserver>> observers_; |
| 164 | 168 |
| 169 bool is_using_lofi_; | |
|
bengr
2016/02/26 22:53:57
Add comments.
RyanSturm
2016/03/01 19:36:04
Done.
| |
| 170 bool was_fetched_via_data_reduction_proxy_; | |
| 171 | |
| 165 DISALLOW_COPY_AND_ASSIGN(PageLoadTracker); | 172 DISALLOW_COPY_AND_ASSIGN(PageLoadTracker); |
| 166 }; | 173 }; |
| 167 | 174 |
| 168 // MetricsWebContentsObserver tracks page loads and loading metrics | 175 // MetricsWebContentsObserver tracks page loads and loading metrics |
| 169 // related data based on IPC messages received from a | 176 // related data based on IPC messages received from a |
| 170 // MetricsRenderFrameObserver. | 177 // MetricsRenderFrameObserver. |
| 171 class MetricsWebContentsObserver | 178 class MetricsWebContentsObserver |
| 172 : public content::WebContentsObserver, | 179 : public content::WebContentsObserver, |
| 173 public content::WebContentsUserData<MetricsWebContentsObserver> { | 180 public content::WebContentsUserData<MetricsWebContentsObserver> { |
| 174 public: | 181 public: |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 228 std::vector<scoped_ptr<PageLoadTracker>> aborted_provisional_loads_; | 235 std::vector<scoped_ptr<PageLoadTracker>> aborted_provisional_loads_; |
| 229 | 236 |
| 230 scoped_ptr<PageLoadTracker> committed_load_; | 237 scoped_ptr<PageLoadTracker> committed_load_; |
| 231 | 238 |
| 232 DISALLOW_COPY_AND_ASSIGN(MetricsWebContentsObserver); | 239 DISALLOW_COPY_AND_ASSIGN(MetricsWebContentsObserver); |
| 233 }; | 240 }; |
| 234 | 241 |
| 235 } // namespace page_load_metrics | 242 } // namespace page_load_metrics |
| 236 | 243 |
| 237 #endif // COMPONENTS_PAGE_LOAD_METRICS_BROWSER_PAGE_LOAD_METRICS_WEB_CONTENTS_O BSERVER_H_ | 244 #endif // COMPONENTS_PAGE_LOAD_METRICS_BROWSER_PAGE_LOAD_METRICS_WEB_CONTENTS_O BSERVER_H_ |
| OLD | NEW |