Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(55)

Side by Side Diff: chrome/browser/page_load_metrics/page_load_tracker.h

Issue 2481013007: Improve tracking of user initiated page loads. (Closed)
Patch Set: address comments Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 CHROME_BROWSER_PAGE_LOAD_METRICS_PAGE_LOAD_TRACKER_H_ 5 #ifndef CHROME_BROWSER_PAGE_LOAD_METRICS_PAGE_LOAD_TRACKER_H_
6 #define CHROME_BROWSER_PAGE_LOAD_METRICS_PAGE_LOAD_TRACKER_H_ 6 #define CHROME_BROWSER_PAGE_LOAD_METRICS_PAGE_LOAD_TRACKER_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 240
241 // The start URL for this page load (before redirects). 241 // The start URL for this page load (before redirects).
242 GURL start_url_; 242 GURL start_url_;
243 243
244 std::unique_ptr<FailedProvisionalLoadInfo> failed_provisional_load_info_; 244 std::unique_ptr<FailedProvisionalLoadInfo> failed_provisional_load_info_;
245 245
246 // Will be ABORT_NONE if we have not aborted this load yet. Otherwise will 246 // Will be ABORT_NONE if we have not aborted this load yet. Otherwise will
247 // be the first abort action the user performed. 247 // be the first abort action the user performed.
248 UserAbortType abort_type_; 248 UserAbortType abort_type_;
249 249
250 // This boolean is only an approximation. As the aborts pipeline is updated, 250 // Whether the abort for this page load was user initiated. For example, if
251 // more abort types will have this set to true. Currently, this is only set 251 // this page load was aborted by a new navigation, this field tracks whether
252 // for navigations aborting navigations. 252 // that new navigation was user-initiated. This field is only useful if this
253 // page load's abort type is a value other than ABORT_NONE. Note that this
254 // value is currently experimental, and is subject to change. In particular,
255 // this field is never set to true for some abort types, such as stop and
256 // close, since we don't yet have sufficient instrumentation to know if a stop
257 // or close was caused by a user action.
253 bool abort_user_initiated_; 258 bool abort_user_initiated_;
254 259
255 base::TimeTicks abort_time_; 260 base::TimeTicks abort_time_;
256 261
257 // We record separate metrics for events that occur after a background, 262 // We record separate metrics for events that occur after a background,
258 // because metrics like layout/paint are delayed artificially 263 // because metrics like layout/paint are delayed artificially
259 // when they occur in the background. 264 // when they occur in the background.
260 base::TimeTicks background_time_; 265 base::TimeTicks background_time_;
261 base::TimeTicks foreground_time_; 266 base::TimeTicks foreground_time_;
262 bool started_in_foreground_; 267 bool started_in_foreground_;
263 268
264 PageLoadTiming timing_; 269 PageLoadTiming timing_;
265 PageLoadMetadata metadata_; 270 PageLoadMetadata metadata_;
266 271
267 ui::PageTransition page_transition_; 272 ui::PageTransition page_transition_;
268 273
269 // Note: these are only approximations, based on WebContents attribution from 274 // Note: these are only approximations, based on WebContents attribution from
270 // ResourceRequestInfo objects while this is the currently committed load in 275 // ResourceRequestInfo objects while this is the currently committed load in
271 // the WebContents. 276 // the WebContents.
272 int num_cache_requests_; 277 int num_cache_requests_;
273 int num_network_requests_; 278 int num_network_requests_;
274 279
275 // This is derived from the user gesture bit in the renderer. For browser 280 // This is derived from the user gesture bit in the renderer. For browser
276 // initiated navigations this will always be true. 281 // initiated navigations this will always be true.
277 bool user_gesture_; 282 bool user_initiated_;
278 283
279 // This is a subtle member. If a provisional load A gets aborted by 284 // This is a subtle member. If a provisional load A gets aborted by
280 // provisional load B, which gets aborted by C that eventually commits, then 285 // provisional load B, which gets aborted by C that eventually commits, then
281 // there exists an abort chain of length 2, starting at A's navigation_start. 286 // there exists an abort chain of length 2, starting at A's navigation_start.
282 // This is useful because it allows histograming abort chain lengths based on 287 // This is useful because it allows histograming abort chain lengths based on
283 // what the last load's transition type is. i.e. holding down F-5 to spam 288 // what the last load's transition type is. i.e. holding down F-5 to spam
284 // reload will produce a long chain with the RELOAD transition. 289 // reload will produce a long chain with the RELOAD transition.
285 const int aborted_chain_size_; 290 const int aborted_chain_size_;
286 291
287 // This member counts consecutive provisional aborts that share a url. It will 292 // This member counts consecutive provisional aborts that share a url. It will
288 // always be less than or equal to |aborted_chain_size_|. 293 // always be less than or equal to |aborted_chain_size_|.
289 const int aborted_chain_size_same_url_; 294 const int aborted_chain_size_same_url_;
290 295
291 // Interface to chrome features. Must outlive the class. 296 // Interface to chrome features. Must outlive the class.
292 PageLoadMetricsEmbedderInterface* const embedder_interface_; 297 PageLoadMetricsEmbedderInterface* const embedder_interface_;
293 298
294 std::vector<std::unique_ptr<PageLoadMetricsObserver>> observers_; 299 std::vector<std::unique_ptr<PageLoadMetricsObserver>> observers_;
295 300
296 DISALLOW_COPY_AND_ASSIGN(PageLoadTracker); 301 DISALLOW_COPY_AND_ASSIGN(PageLoadTracker);
297 }; 302 };
298 303
299 } // namespace page_load_metrics 304 } // namespace page_load_metrics
300 305
301 #endif // CHROME_BROWSER_PAGE_LOAD_METRICS_PAGE_LOAD_TRACKER_H_ 306 #endif // CHROME_BROWSER_PAGE_LOAD_METRICS_PAGE_LOAD_TRACKER_H_
OLDNEW
« no previous file with comments | « chrome/browser/page_load_metrics/page_load_metrics_observer.cc ('k') | chrome/browser/page_load_metrics/page_load_tracker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698