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

Unified Diff: chrome/browser/predictors/glowplug_collector.cc

Issue 2896713003: Create LoadingDataCollector class and have observers rely on it instead of ResourcePrefetchPredictor (Closed)
Patch Set: Created 3 years, 7 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/predictors/glowplug_collector.cc
diff --git a/chrome/browser/predictors/glowplug_collector.cc b/chrome/browser/predictors/glowplug_collector.cc
new file mode 100644
index 0000000000000000000000000000000000000000..c188682cc0f4135f7bc4f2a1c5ca8ecf5a38f1b4
--- /dev/null
+++ b/chrome/browser/predictors/glowplug_collector.cc
@@ -0,0 +1,64 @@
+// 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.
+
+#include "chrome/browser/predictors/glowplug_collector.h"
+#include "chrome/browser/predictors/resource_prefetch_predictor.h"
+#include "content/public/browser/resource_request_info.h"
+#include "content/public/common/resource_type.h"
+#include "net/url_request/url_request.h"
+
+namespace predictors {
+
+// static
+bool GlowplugCollector::ShouldRecordRequest(
Benoit L 2017/05/22 13:37:16 nit: Can you migrate the logic, instead of just fo
trevordixon 2017/05/24 20:39:24 Moved the static methods over. I'll look into the
trevordixon 2017/05/24 20:39:24 Moved the static methods over. I'll look into the
+ net::URLRequest* request,
+ content::ResourceType resource_type) {
+ return ResourcePrefetchPredictor::ShouldRecordRequest(request, resource_type);
+}
+
+// static
+bool GlowplugCollector::ShouldRecordResponse(net::URLRequest* response) {
+ return ResourcePrefetchPredictor::ShouldRecordResponse(response);
+}
+
+// static
+bool GlowplugCollector::ShouldRecordRedirect(net::URLRequest* response) {
+ return ResourcePrefetchPredictor::ShouldRecordResponse(response);
+}
+
+////////////////////////////////////////////////////////////////////////////////
Benoit L 2017/05/22 13:37:16 nit: Remove this. It was in the code initially, an
trevordixon 2017/05/23 13:05:15 Done.
+// GlowplugCollector
+
+GlowplugCollector::GlowplugCollector(ResourcePrefetchPredictor* predictor)
+ : predictor_(predictor) {}
+
+GlowplugCollector::~GlowplugCollector() {}
+
+void GlowplugCollector::RecordURLRequest(
+ const ResourcePrefetchPredictor::URLRequestSummary& request) {
+ predictor_->RecordURLRequest(request);
+}
+
+void GlowplugCollector::RecordURLResponse(
+ const ResourcePrefetchPredictor::URLRequestSummary& response) {
+ predictor_->RecordURLResponse(response);
+}
+
+void GlowplugCollector::RecordURLRedirect(
+ const ResourcePrefetchPredictor::URLRequestSummary& response) {
+ predictor_->RecordURLRedirect(response);
+}
+
+void GlowplugCollector::RecordMainFrameLoadComplete(
+ const NavigationID& navigation_id) {
+ predictor_->RecordMainFrameLoadComplete(navigation_id);
+}
+
+void GlowplugCollector::RecordFirstContentfulPaint(
+ const NavigationID& navigation_id,
+ const base::TimeTicks& first_contentful_paint) {
+ predictor_->RecordFirstContentfulPaint(navigation_id, first_contentful_paint);
+}
+
+} // namespace predictors

Powered by Google App Engine
This is Rietveld 408576698