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_METRICS_WEB_CONTENTS_OBSERVER_H_ | 5 #ifndef COMPONENTS_PAGE_LOAD_METRICS_BROWSER_METRICS_WEB_CONTENTS_OBSERVER_H_ |
6 #define COMPONENTS_PAGE_LOAD_METRICS_BROWSER_METRICS_WEB_CONTENTS_OBSERVER_H_ | 6 #define COMPONENTS_PAGE_LOAD_METRICS_BROWSER_METRICS_WEB_CONTENTS_OBSERVER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 int aborted_chain_size, | 113 int aborted_chain_size, |
114 int aborted_chain_size_same_url); | 114 int aborted_chain_size_same_url); |
115 ~PageLoadTracker(); | 115 ~PageLoadTracker(); |
116 void Redirect(content::NavigationHandle* navigation_handle); | 116 void Redirect(content::NavigationHandle* navigation_handle); |
117 void Commit(content::NavigationHandle* navigation_handle); | 117 void Commit(content::NavigationHandle* navigation_handle); |
118 void FailedProvisionalLoad(content::NavigationHandle* navigation_handle); | 118 void FailedProvisionalLoad(content::NavigationHandle* navigation_handle); |
119 void WebContentsHidden(); | 119 void WebContentsHidden(); |
120 void WebContentsShown(); | 120 void WebContentsShown(); |
121 | 121 |
122 // Returns true if the timing was successfully updated. | 122 // Returns true if the timing was successfully updated. |
123 bool UpdateTiming(const PageLoadTiming& timing); | 123 bool UpdateTiming(const PageLoadTiming& timing, |
| 124 const PageLoadMetadata& metadata); |
124 bool HasBackgrounded(); | 125 bool HasBackgrounded(); |
125 | 126 |
126 void set_renderer_tracked(bool renderer_tracked); | 127 void set_renderer_tracked(bool renderer_tracked); |
127 bool renderer_tracked() const { return renderer_tracked_; } | 128 bool renderer_tracked() const { return renderer_tracked_; } |
128 | 129 |
129 int aborted_chain_size() const { return aborted_chain_size_; } | 130 int aborted_chain_size() const { return aborted_chain_size_; } |
130 int aborted_chain_size_same_url() const { | 131 int aborted_chain_size_same_url() const { |
131 return aborted_chain_size_same_url_; | 132 return aborted_chain_size_same_url_; |
132 } | 133 } |
133 | 134 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 base::TimeTicks abort_time_; | 186 base::TimeTicks abort_time_; |
186 | 187 |
187 // We record separate metrics for events that occur after a background, | 188 // We record separate metrics for events that occur after a background, |
188 // because metrics like layout/paint are delayed artificially | 189 // because metrics like layout/paint are delayed artificially |
189 // when they occur in the background. | 190 // when they occur in the background. |
190 base::TimeTicks background_time_; | 191 base::TimeTicks background_time_; |
191 base::TimeTicks foreground_time_; | 192 base::TimeTicks foreground_time_; |
192 bool started_in_foreground_; | 193 bool started_in_foreground_; |
193 | 194 |
194 PageLoadTiming timing_; | 195 PageLoadTiming timing_; |
| 196 PageLoadMetadata metadata_; |
195 | 197 |
196 // This is a subtle member. If a provisional load A gets aborted by | 198 // This is a subtle member. If a provisional load A gets aborted by |
197 // provisional load B, which gets aborted by C that eventually commits, then | 199 // provisional load B, which gets aborted by C that eventually commits, then |
198 // there exists an abort chain of length 2, starting at A's navigation_start. | 200 // there exists an abort chain of length 2, starting at A's navigation_start. |
199 // This is useful because it allows histograming abort chain lengths based on | 201 // This is useful because it allows histograming abort chain lengths based on |
200 // what the last load's transition type is. i.e. holding down F-5 to spam | 202 // what the last load's transition type is. i.e. holding down F-5 to spam |
201 // reload will produce a long chain with the RELOAD transition. | 203 // reload will produce a long chain with the RELOAD transition. |
202 const int aborted_chain_size_; | 204 const int aborted_chain_size_; |
203 | 205 |
204 // This member counts consecutive provisional aborts that share a url. It will | 206 // This member counts consecutive provisional aborts that share a url. It will |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 void NotifyAbortAllLoads(UserAbortType abort_type); | 253 void NotifyAbortAllLoads(UserAbortType abort_type); |
252 void NotifyAbortAllLoadsWithTimestamp(UserAbortType abort_type, | 254 void NotifyAbortAllLoadsWithTimestamp(UserAbortType abort_type, |
253 base::TimeTicks timestamp); | 255 base::TimeTicks timestamp); |
254 // Notify aborted provisional loads that a new navigation occurred. This is | 256 // Notify aborted provisional loads that a new navigation occurred. This is |
255 // used for more consistent attribution tracking for aborted provisional | 257 // used for more consistent attribution tracking for aborted provisional |
256 // loads. This method returns the provisional load that was likely aborted by | 258 // loads. This method returns the provisional load that was likely aborted by |
257 // this navigation, to help instantiate the new PageLoadTracker. | 259 // this navigation, to help instantiate the new PageLoadTracker. |
258 scoped_ptr<PageLoadTracker> NotifyAbortedProvisionalLoadsNewNavigation( | 260 scoped_ptr<PageLoadTracker> NotifyAbortedProvisionalLoadsNewNavigation( |
259 content::NavigationHandle* new_navigation); | 261 content::NavigationHandle* new_navigation); |
260 | 262 |
261 void OnTimingUpdated(content::RenderFrameHost*, const PageLoadTiming& timing); | 263 void OnTimingUpdated(content::RenderFrameHost*, |
| 264 const PageLoadTiming& timing, |
| 265 const PageLoadMetadata& metadata); |
262 | 266 |
263 // True if the web contents is currently in the foreground. | 267 // True if the web contents is currently in the foreground. |
264 bool in_foreground_; | 268 bool in_foreground_; |
265 | 269 |
266 // The PageLoadTrackers must be deleted before the |embedded_interface_|, | 270 // The PageLoadTrackers must be deleted before the |embedded_interface_|, |
267 // because they hold a pointer to the |embedder_interface_|. | 271 // because they hold a pointer to the |embedder_interface_|. |
268 scoped_ptr<PageLoadMetricsEmbedderInterface> embedder_interface_; | 272 scoped_ptr<PageLoadMetricsEmbedderInterface> embedder_interface_; |
269 | 273 |
270 // This map tracks all of the navigations ongoing that are not committed | 274 // This map tracks all of the navigations ongoing that are not committed |
271 // yet. Once a navigation is committed, it moves from the map to | 275 // yet. Once a navigation is committed, it moves from the map to |
(...skipping 10 matching lines...) Expand all Loading... |
282 std::vector<scoped_ptr<PageLoadTracker>> aborted_provisional_loads_; | 286 std::vector<scoped_ptr<PageLoadTracker>> aborted_provisional_loads_; |
283 | 287 |
284 scoped_ptr<PageLoadTracker> committed_load_; | 288 scoped_ptr<PageLoadTracker> committed_load_; |
285 | 289 |
286 DISALLOW_COPY_AND_ASSIGN(MetricsWebContentsObserver); | 290 DISALLOW_COPY_AND_ASSIGN(MetricsWebContentsObserver); |
287 }; | 291 }; |
288 | 292 |
289 } // namespace page_load_metrics | 293 } // namespace page_load_metrics |
290 | 294 |
291 #endif // COMPONENTS_PAGE_LOAD_METRICS_BROWSER_METRICS_WEB_CONTENTS_OBSERVER_H_ | 295 #endif // COMPONENTS_PAGE_LOAD_METRICS_BROWSER_METRICS_WEB_CONTENTS_OBSERVER_H_ |
OLD | NEW |