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

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

Issue 2560043004: [PageLoadMetrics] Record bytes usage per page (Closed)
Patch Set: Fix test Created 3 years, 11 months 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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 const base::Optional<base::TimeDelta>& first_foreground_time, 111 const base::Optional<base::TimeDelta>& first_foreground_time,
112 bool started_in_foreground, 112 bool started_in_foreground,
113 UserInitiatedInfo user_initiated_info, 113 UserInitiatedInfo user_initiated_info,
114 const GURL& committed_url, 114 const GURL& committed_url,
115 const GURL& start_url, 115 const GURL& start_url,
116 UserAbortType abort_type, 116 UserAbortType abort_type,
117 UserInitiatedInfo abort_user_initiated_info, 117 UserInitiatedInfo abort_user_initiated_info,
118 const base::Optional<base::TimeDelta>& time_to_abort, 118 const base::Optional<base::TimeDelta>& time_to_abort,
119 int num_cache_requests, 119 int num_cache_requests,
120 int num_network_requests, 120 int num_network_requests,
121 int64_t cache_bytes,
122 int64_t net_bytes,
121 const PageLoadMetadata& metadata); 123 const PageLoadMetadata& metadata);
122 124
123 PageLoadExtraInfo(const PageLoadExtraInfo& other); 125 PageLoadExtraInfo(const PageLoadExtraInfo& other);
124 126
125 ~PageLoadExtraInfo(); 127 ~PageLoadExtraInfo();
126 128
127 // The first time that the page was backgrounded since the navigation started. 129 // The first time that the page was backgrounded since the navigation started.
128 const base::Optional<base::TimeDelta> first_background_time; 130 const base::Optional<base::TimeDelta> first_background_time;
129 131
130 // The first time that the page was foregrounded since the navigation started. 132 // The first time that the page was foregrounded since the navigation started.
(...skipping 30 matching lines...) Expand all
161 UserInitiatedInfo abort_user_initiated_info; 163 UserInitiatedInfo abort_user_initiated_info;
162 164
163 const base::Optional<base::TimeDelta> time_to_abort; 165 const base::Optional<base::TimeDelta> time_to_abort;
164 166
165 // Note: these are only approximations, based on WebContents attribution from 167 // Note: these are only approximations, based on WebContents attribution from
166 // ResourceRequestInfo objects while this is the currently committed load in 168 // ResourceRequestInfo objects while this is the currently committed load in
167 // the WebContents. 169 // the WebContents.
168 int num_cache_requests; 170 int num_cache_requests;
169 int num_network_requests; 171 int num_network_requests;
170 172
173 // The number of body (not header) prefilter bytes consumed by requests for
174 // the page.
175 int64_t cache_bytes;
176 int64_t network_bytes;
177
171 // Extra information supplied to the page load metrics system from the 178 // Extra information supplied to the page load metrics system from the
172 // renderer. 179 // renderer.
173 const PageLoadMetadata metadata; 180 const PageLoadMetadata metadata;
174 }; 181 };
175 182
176 // Interface for PageLoadMetrics observers. All instances of this class are 183 // Interface for PageLoadMetrics observers. All instances of this class are
177 // owned by the PageLoadTracker tracking a page load. 184 // owned by the PageLoadTracker tracking a page load.
178 class PageLoadMetricsObserver { 185 class PageLoadMetricsObserver {
179 public: 186 public:
180 // ObservePolicy is used as a return value on some PageLoadMetricsObserver 187 // ObservePolicy is used as a return value on some PageLoadMetricsObserver
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 // be invoked for page loads that did not meet the criteria for being tracked 298 // be invoked for page loads that did not meet the criteria for being tracked
292 // at the time the navigation completed. The PageLoadTiming struct contains 299 // at the time the navigation completed. The PageLoadTiming struct contains
293 // timing data and the PageLoadExtraInfo struct contains other useful data 300 // timing data and the PageLoadExtraInfo struct contains other useful data
294 // collected over the course of the page load. Most observers should not need 301 // collected over the course of the page load. Most observers should not need
295 // to implement these callbacks, and should implement the On* timing callbacks 302 // to implement these callbacks, and should implement the On* timing callbacks
296 // instead. 303 // instead.
297 304
298 // OnComplete is invoked for tracked page loads that committed, immediately 305 // OnComplete is invoked for tracked page loads that committed, immediately
299 // before the observer is deleted. Observers that implement OnComplete may 306 // before the observer is deleted. Observers that implement OnComplete may
300 // also want to implement FlushMetricsOnAppEnterBackground, to avoid loss of 307 // also want to implement FlushMetricsOnAppEnterBackground, to avoid loss of
301 // data if the application is killed while in the background. 308 // data if the application is killed while in the background (this happens
309 // frequently on Android).
302 virtual void OnComplete(const PageLoadTiming& timing, 310 virtual void OnComplete(const PageLoadTiming& timing,
303 const PageLoadExtraInfo& extra_info) {} 311 const PageLoadExtraInfo& extra_info) {}
304 312
305 // OnFailedProvisionalLoad is invoked for tracked page loads that did not 313 // OnFailedProvisionalLoad is invoked for tracked page loads that did not
306 // commit, immediately before the observer is deleted. 314 // commit, immediately before the observer is deleted.
307 virtual void OnFailedProvisionalLoad( 315 virtual void OnFailedProvisionalLoad(
308 const FailedProvisionalLoadInfo& failed_provisional_load_info, 316 const FailedProvisionalLoadInfo& failed_provisional_load_info,
309 const PageLoadExtraInfo& extra_info) {} 317 const PageLoadExtraInfo& extra_info) {}
310 }; 318 };
311 319
312 } // namespace page_load_metrics 320 } // namespace page_load_metrics
313 321
314 #endif // CHROME_BROWSER_PAGE_LOAD_METRICS_PAGE_LOAD_METRICS_OBSERVER_H_ 322 #endif // CHROME_BROWSER_PAGE_LOAD_METRICS_PAGE_LOAD_METRICS_OBSERVER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698