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

Side by Side Diff: chrome/browser/page_load_metrics/page_load_metrics_observer.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 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 CHROME_BROWSER_PAGE_LOAD_METRICS_PAGE_LOAD_METRICS_OBSERVER_H_ 5 #ifndef CHROME_BROWSER_PAGE_LOAD_METRICS_PAGE_LOAD_METRICS_OBSERVER_H_
6 #define CHROME_BROWSER_PAGE_LOAD_METRICS_PAGE_LOAD_METRICS_OBSERVER_H_ 6 #define CHROME_BROWSER_PAGE_LOAD_METRICS_PAGE_LOAD_METRICS_OBSERVER_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/optional.h" 9 #include "base/optional.h"
10 #include "chrome/common/page_load_metrics/page_load_timing.h" 10 #include "chrome/common/page_load_metrics/page_load_timing.h"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 63
64 base::TimeDelta time_to_failed_provisional_load; 64 base::TimeDelta time_to_failed_provisional_load;
65 net::Error error; 65 net::Error error;
66 }; 66 };
67 67
68 struct PageLoadExtraInfo { 68 struct PageLoadExtraInfo {
69 PageLoadExtraInfo( 69 PageLoadExtraInfo(
70 const base::Optional<base::TimeDelta>& first_background_time, 70 const base::Optional<base::TimeDelta>& first_background_time,
71 const base::Optional<base::TimeDelta>& first_foreground_time, 71 const base::Optional<base::TimeDelta>& first_foreground_time,
72 bool started_in_foreground, 72 bool started_in_foreground,
73 bool user_gesture, 73 bool user_initiated,
74 const GURL& committed_url, 74 const GURL& committed_url,
75 const GURL& start_url, 75 const GURL& start_url,
76 UserAbortType abort_type, 76 UserAbortType abort_type,
77 bool abort_user_initiated, 77 bool abort_user_initiated,
78 const base::Optional<base::TimeDelta>& time_to_abort, 78 const base::Optional<base::TimeDelta>& time_to_abort,
79 int num_cache_requests, 79 int num_cache_requests,
80 int num_network_requests, 80 int num_network_requests,
81 const PageLoadMetadata& metadata); 81 const PageLoadMetadata& metadata);
82 82
83 PageLoadExtraInfo(const PageLoadExtraInfo& other); 83 PageLoadExtraInfo(const PageLoadExtraInfo& other);
84 84
85 ~PageLoadExtraInfo(); 85 ~PageLoadExtraInfo();
86 86
87 // The first time that the page was backgrounded since the navigation started. 87 // The first time that the page was backgrounded since the navigation started.
88 const base::Optional<base::TimeDelta> first_background_time; 88 const base::Optional<base::TimeDelta> first_background_time;
89 89
90 // The first time that the page was foregrounded since the navigation started. 90 // The first time that the page was foregrounded since the navigation started.
91 const base::Optional<base::TimeDelta> first_foreground_time; 91 const base::Optional<base::TimeDelta> first_foreground_time;
92 92
93 // True if the page load started in the foreground. 93 // True if the page load started in the foreground.
94 const bool started_in_foreground; 94 const bool started_in_foreground;
95 95
96 // True if this is either a browser initiated navigation or the user_gesture 96 // True if this is either a browser initiated navigation or the user_gesture
97 // bit is true in the renderer. 97 // bit is true in the renderer.
98 const bool user_gesture; 98 const bool user_initiated;
99 99
100 // Committed URL. If the page load did not commit, |committed_url| will be 100 // Committed URL. If the page load did not commit, |committed_url| will be
101 // empty. 101 // empty.
102 const GURL committed_url; 102 const GURL committed_url;
103 103
104 // The URL that started the navigation, before redirects. 104 // The URL that started the navigation, before redirects.
105 const GURL start_url; 105 const GURL start_url;
106 106
107 // The abort time and time to abort for this page load. If the page was not 107 // The abort time and time to abort for this page load. If the page was not
108 // aborted, |abort_type| will be |ABORT_NONE|. 108 // aborted, |abort_type| will be |ABORT_NONE|.
109 const UserAbortType abort_type; 109 const UserAbortType abort_type;
110 110
111 // Whether the abort for this page load was user initiated. For example, if
112 // this page load was aborted by a new navigation, this field tracks whether
113 // that new navigation was user-initiated. This field is only useful if this
114 // page load's abort type is a value other than ABORT_NONE. Note that this
115 // value is currently experimental, and is subject to change. In particular,
116 // this field is never set to true for some abort types, such as stop and
117 // close, since we don't yet have sufficient instrumentation to know if a stop
118 // or close was caused by a user action.
119 //
111 // TODO(csharrison): If more metadata for aborts is needed we should provide a 120 // TODO(csharrison): If more metadata for aborts is needed we should provide a
112 // better abstraction. Note that this is an approximation. 121 // better abstraction. Note that this is an approximation.
113 bool abort_user_initiated; 122 bool abort_user_initiated;
114 123
115 const base::Optional<base::TimeDelta> time_to_abort; 124 const base::Optional<base::TimeDelta> time_to_abort;
116 125
117 // Note: these are only approximations, based on WebContents attribution from 126 // Note: these are only approximations, based on WebContents attribution from
118 // ResourceRequestInfo objects while this is the currently committed load in 127 // ResourceRequestInfo objects while this is the currently committed load in
119 // the WebContents. 128 // the WebContents.
120 int num_cache_requests; 129 int num_cache_requests;
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 // OnFailedProvisionalLoad is invoked for tracked page loads that did not 270 // OnFailedProvisionalLoad is invoked for tracked page loads that did not
262 // commit, immediately before the observer is deleted. 271 // commit, immediately before the observer is deleted.
263 virtual void OnFailedProvisionalLoad( 272 virtual void OnFailedProvisionalLoad(
264 const FailedProvisionalLoadInfo& failed_provisional_load_info, 273 const FailedProvisionalLoadInfo& failed_provisional_load_info,
265 const PageLoadExtraInfo& extra_info) {} 274 const PageLoadExtraInfo& extra_info) {}
266 }; 275 };
267 276
268 } // namespace page_load_metrics 277 } // namespace page_load_metrics
269 278
270 #endif // CHROME_BROWSER_PAGE_LOAD_METRICS_PAGE_LOAD_METRICS_OBSERVER_H_ 279 #endif // CHROME_BROWSER_PAGE_LOAD_METRICS_PAGE_LOAD_METRICS_OBSERVER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698