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 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 <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 188 const base::Optional<base::TimeDelta> page_end_time; | 188 const base::Optional<base::TimeDelta> page_end_time; |
| 189 | 189 |
| 190 // Extra information supplied to the page load metrics system from the | 190 // Extra information supplied to the page load metrics system from the |
| 191 // renderer for the main frame. | 191 // renderer for the main frame. |
| 192 const PageLoadMetadata main_frame_metadata; | 192 const PageLoadMetadata main_frame_metadata; |
| 193 | 193 |
| 194 // PageLoadMetadata for child frames of the current page load. | 194 // PageLoadMetadata for child frames of the current page load. |
| 195 const PageLoadMetadata child_frame_metadata; | 195 const PageLoadMetadata child_frame_metadata; |
| 196 }; | 196 }; |
| 197 | 197 |
| 198 // Container for various information about a request within a page load. | 198 // Container for various information about a completed request within a page |
| 199 struct ExtraRequestInfo { | 199 // load. |
| 200 ExtraRequestInfo(bool was_cached, | 200 struct ExtraRequestCompleteInfo { |
| 201 int64_t raw_body_bytes, | 201 ExtraRequestCompleteInfo(bool was_cached, |
| 202 bool data_reduction_proxy_used, | 202 int64_t raw_body_bytes, |
| 203 int64_t original_network_content_length); | 203 bool data_reduction_proxy_used, |
| 204 int64_t original_network_content_length, | |
| 205 content::ResourceType found_type); | |
|
Bryan McQuade
2017/04/17 23:32:14
what does 'found' mean in found_type? Any reason n
Pete Williamson
2017/04/18 18:17:27
the intent is that the resource type can be determ
| |
| 204 | 206 |
| 205 ExtraRequestInfo(const ExtraRequestInfo& other); | 207 ExtraRequestCompleteInfo(const ExtraRequestCompleteInfo& other); |
| 206 | 208 |
| 207 ~ExtraRequestInfo(); | 209 ~ExtraRequestCompleteInfo(); |
| 208 | 210 |
| 209 // True if the resource was loaded from cache. | 211 // True if the resource was loaded from cache. |
| 210 const bool was_cached; | 212 const bool was_cached; |
| 211 | 213 |
| 212 // The number of body (not header) prefilter bytes. | 214 // The number of body (not header) prefilter bytes. |
| 213 const int64_t raw_body_bytes; | 215 const int64_t raw_body_bytes; |
| 214 | 216 |
| 215 // Whether this request used Data Reduction Proxy. | 217 // Whether this request used Data Reduction Proxy. |
| 216 const bool data_reduction_proxy_used; | 218 const bool data_reduction_proxy_used; |
| 217 | 219 |
| 218 // The number of body (not header) bytes that the data reduction proxy saw | 220 // The number of body (not header) bytes that the data reduction proxy saw |
| 219 // before it compressed the requests. | 221 // before it compressed the requests. |
| 220 const int64_t original_network_content_length; | 222 const int64_t original_network_content_length; |
| 223 | |
| 224 // The type of the request as gleaned from the ResourceRequestInfo. | |
| 225 const content::ResourceType resource_type; | |
| 226 }; | |
| 227 | |
| 228 // Container for various information about a started request within a page load. | |
| 229 struct ExtraRequestStartInfo { | |
| 230 explicit ExtraRequestStartInfo(content::ResourceType type); | |
| 231 | |
| 232 ExtraRequestStartInfo(const ExtraRequestStartInfo& other); | |
| 233 | |
| 234 ~ExtraRequestStartInfo(); | |
| 235 | |
| 236 // The type of the request as gleaned from the ResourceRequestInfo. | |
|
Bryan McQuade
2017/04/17 23:32:14
if we're already reporting this here, it feels red
RyanSturm
2017/04/17 23:37:32
I think it would either need to be GRID or type to
Pete Williamson
2017/04/18 18:17:27
I'm trying to allow for the possibility that we di
RyanSturm
2017/04/18 18:37:13
AFAIK, there are basically four ways to determine
| |
| 237 const content::ResourceType resource_type; | |
| 221 }; | 238 }; |
| 222 | 239 |
| 223 // Interface for PageLoadMetrics observers. All instances of this class are | 240 // Interface for PageLoadMetrics observers. All instances of this class are |
| 224 // owned by the PageLoadTracker tracking a page load. | 241 // owned by the PageLoadTracker tracking a page load. |
| 225 class PageLoadMetricsObserver { | 242 class PageLoadMetricsObserver { |
| 226 public: | 243 public: |
| 227 // ObservePolicy is used as a return value on some PageLoadMetricsObserver | 244 // ObservePolicy is used as a return value on some PageLoadMetricsObserver |
| 228 // callbacks to indicate whether the observer would like to continue observing | 245 // callbacks to indicate whether the observer would like to continue observing |
| 229 // metric callbacks. Observers that wish to continue observing metric | 246 // metric callbacks. Observers that wish to continue observing metric |
| 230 // callbacks should return CONTINUE_OBSERVING; observers that wish to stop | 247 // callbacks should return CONTINUE_OBSERVING; observers that wish to stop |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 368 // frequently on Android). | 385 // frequently on Android). |
| 369 virtual void OnComplete(const PageLoadTiming& timing, | 386 virtual void OnComplete(const PageLoadTiming& timing, |
| 370 const PageLoadExtraInfo& extra_info) {} | 387 const PageLoadExtraInfo& extra_info) {} |
| 371 | 388 |
| 372 // OnFailedProvisionalLoad is invoked for tracked page loads that did not | 389 // OnFailedProvisionalLoad is invoked for tracked page loads that did not |
| 373 // commit, immediately before the observer is deleted. | 390 // commit, immediately before the observer is deleted. |
| 374 virtual void OnFailedProvisionalLoad( | 391 virtual void OnFailedProvisionalLoad( |
| 375 const FailedProvisionalLoadInfo& failed_provisional_load_info, | 392 const FailedProvisionalLoadInfo& failed_provisional_load_info, |
| 376 const PageLoadExtraInfo& extra_info) {} | 393 const PageLoadExtraInfo& extra_info) {} |
| 377 | 394 |
| 395 // Called whenever a request load begins. | |
| 396 virtual void OnStartedResource( | |
| 397 const ExtraRequestStartInfo& extra_request_start_info) {} | |
| 398 | |
| 378 // Called whenever a request is loaded for this page load. | 399 // Called whenever a request is loaded for this page load. |
| 379 virtual void OnLoadedResource(const ExtraRequestInfo& extra_request_info) {} | 400 virtual void OnLoadedResource( |
| 401 const ExtraRequestCompleteInfo& extra_request_complete_info) {} | |
| 380 }; | 402 }; |
| 381 | 403 |
| 382 } // namespace page_load_metrics | 404 } // namespace page_load_metrics |
| 383 | 405 |
| 384 #endif // CHROME_BROWSER_PAGE_LOAD_METRICS_PAGE_LOAD_METRICS_OBSERVER_H_ | 406 #endif // CHROME_BROWSER_PAGE_LOAD_METRICS_PAGE_LOAD_METRICS_OBSERVER_H_ |
| OLD | NEW |