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

Unified Diff: chrome/browser/page_load_metrics/observers/resource_tracking_page_load_metrics_observer.h

Issue 2780003003: Send an event to the page load metrics to track resource starting. (Closed)
Patch Set: CR feedback per RyanSturm 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/observers/resource_tracking_page_load_metrics_observer.h
diff --git a/chrome/browser/page_load_metrics/observers/resource_tracking_page_load_metrics_observer.h b/chrome/browser/page_load_metrics/observers/resource_tracking_page_load_metrics_observer.h
new file mode 100644
index 0000000000000000000000000000000000000000..f8472ccbdbe6807f305f5a2744abd03b9a427c5f
--- /dev/null
+++ b/chrome/browser/page_load_metrics/observers/resource_tracking_page_load_metrics_observer.h
@@ -0,0 +1,47 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_PAGE_LOAD_METRICS_OBSERVERS_RESOURCE_TRACKING_PAGE_LOAD_METRICS_OBSERVER_H_
+#define CHROME_BROWSER_PAGE_LOAD_METRICS_OBSERVERS_RESOURCE_TRACKING_PAGE_LOAD_METRICS_OBSERVER_H_
+
+#include <stdint.h>
+
+#include "chrome/browser/page_load_metrics/page_load_metrics_observer.h"
+
+namespace page_load_metrics {
+
+class ResourceTrackingPageLoadMetricsObserver
+ : public page_load_metrics::PageLoadMetricsObserver {
+ public:
+ ResourceTrackingPageLoadMetricsObserver();
+ ~ResourceTrackingPageLoadMetricsObserver() override;
+
+ // Called by the PageLoadMetrics framework when we start a new request, so we
+ // can update our data structures to be able to calculate a resource done
+ // percentage.
+ void OnStartedResource(
+ const ExtraRequestStartInfo& extra_request_start_info) override;
+
+ // Called by the PageLoadMetrics framework when we start a new request, so we
+ // can update our data structures to be able to calculate a resource done
+ // percentage.
+ void OnLoadedResource(
+ const ExtraRequestCompleteInfo& extra_request_complete_info) override;
+
+ // For the specified type, get the count of requests started and completed.
RyanSturm 2017/04/17 19:57:08 Can you update this comment to reflect that |type|
Pete Williamson 2017/04/17 20:46:36 Done.
+ void GetCountsForType(const content::ResourceType type,
+ int64_t* started_count,
+ int64_t* completed_count);
+
+ private:
+ // TODO(petewil): Some way to keep track of what we've seen
+ // TODO(petewil): Some way to inform our keeper of aggregate results when they
+ // change.};
RyanSturm 2017/04/17 19:57:08 nit: s/change.};/change./
Pete Williamson 2017/04/17 20:46:36 Done.
+ int64_t started_count_;
+ int64_t completed_count_;
+};
+
+} // namespace page_load_metrics
+
+#endif // CHROME_BROWSER_PAGE_LOAD_METRICS_OBSERVERS_RESOURCE_TRACKING_PAGE_LOAD_METRICS_OBSERVER_H_

Powered by Google App Engine
This is Rietveld 408576698