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

Unified Diff: chrome/browser/page_load_metrics/page_load_metrics_observer.h

Issue 2780003003: Send an event to the page load metrics to track resource starting. (Closed)
Patch Set: Second round of RyanSturm feedback Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/page_load_metrics/page_load_metrics_observer.h
diff --git a/chrome/browser/page_load_metrics/page_load_metrics_observer.h b/chrome/browser/page_load_metrics/page_load_metrics_observer.h
index 11a98896bd91bf72d28f0f68b05251f2ef5229f3..6607825064812c58a3ce2699c6df90e16a54b0be 100644
--- a/chrome/browser/page_load_metrics/page_load_metrics_observer.h
+++ b/chrome/browser/page_load_metrics/page_load_metrics_observer.h
@@ -195,16 +195,18 @@ struct PageLoadExtraInfo {
const PageLoadMetadata child_frame_metadata;
};
-// Container for various information about a request within a page load.
-struct ExtraRequestInfo {
- ExtraRequestInfo(bool was_cached,
- int64_t raw_body_bytes,
- bool data_reduction_proxy_used,
- int64_t original_network_content_length);
+// Container for various information about a completed request within a page
+// load.
+struct ExtraRequestCompleteInfo {
+ ExtraRequestCompleteInfo(bool was_cached,
+ int64_t raw_body_bytes,
+ bool data_reduction_proxy_used,
+ int64_t original_network_content_length,
+ 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
- ExtraRequestInfo(const ExtraRequestInfo& other);
+ ExtraRequestCompleteInfo(const ExtraRequestCompleteInfo& other);
- ~ExtraRequestInfo();
+ ~ExtraRequestCompleteInfo();
// True if the resource was loaded from cache.
const bool was_cached;
@@ -218,6 +220,21 @@ struct ExtraRequestInfo {
// The number of body (not header) bytes that the data reduction proxy saw
// before it compressed the requests.
const int64_t original_network_content_length;
+
+ // The type of the request as gleaned from the ResourceRequestInfo.
+ const content::ResourceType resource_type;
+};
+
+// Container for various information about a started request within a page load.
+struct ExtraRequestStartInfo {
+ explicit ExtraRequestStartInfo(content::ResourceType type);
+
+ ExtraRequestStartInfo(const ExtraRequestStartInfo& other);
+
+ ~ExtraRequestStartInfo();
+
+ // 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
+ const content::ResourceType resource_type;
};
// Interface for PageLoadMetrics observers. All instances of this class are
@@ -375,8 +392,13 @@ class PageLoadMetricsObserver {
const FailedProvisionalLoadInfo& failed_provisional_load_info,
const PageLoadExtraInfo& extra_info) {}
+ // Called whenever a request load begins.
+ virtual void OnStartedResource(
+ const ExtraRequestStartInfo& extra_request_start_info) {}
+
// Called whenever a request is loaded for this page load.
- virtual void OnLoadedResource(const ExtraRequestInfo& extra_request_info) {}
+ virtual void OnLoadedResource(
+ const ExtraRequestCompleteInfo& extra_request_complete_info) {}
};
} // namespace page_load_metrics

Powered by Google App Engine
This is Rietveld 408576698