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

Unified Diff: chrome/browser/net/resource_prefetch_predictor_observer.h

Issue 10416002: Seculative resource prefetching for URLs CL. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Addressing dominich's and willchan's comments. Created 8 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/net/resource_prefetch_predictor_observer.h
diff --git a/chrome/browser/net/resource_prefetch_predictor_observer.h b/chrome/browser/net/resource_prefetch_predictor_observer.h
new file mode 100644
index 0000000000000000000000000000000000000000..a3ef0cc1b0696e6243b3b0bdf2185c342d122ceb
--- /dev/null
+++ b/chrome/browser/net/resource_prefetch_predictor_observer.h
@@ -0,0 +1,43 @@
+// Copyright (c) 2012 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_NET_RESOURCE_PREFETCH_PREDICTOR_OBSERVER_H_
+#define CHROME_BROWSER_NET_RESOURCE_PREFETCH_PREDICTOR_OBSERVER_H_
+#pragma once
+
+#include "base/memory/ref_counted.h"
+#include "chrome/browser/predictors/resource_prefetch_predictor.h"
+
+namespace net {
+class URLRequest;
+}
+
+namespace chrome_browser_net {
+
+class ResourcePrefetchPredictorObserver {
+ public:
+ explicit ResourcePrefetchPredictorObserver(
+ scoped_refptr<predictors::ResourcePrefetchPredictor> predictor);
+ ~ResourcePrefetchPredictorObserver();
+
+ // Parts of the NetworkDelegate that we want to observe.
+ void OnBeforeURLRequest(net::URLRequest* request);
+ void OnBeforeRedirect(net::URLRequest* request);
+ void OnResponseStarted(net::URLRequest* request);
+
+ private:
+ void CallPredictorOnUIThread(
+ net::URLRequest* request,
+ bool is_response,
+ void(predictors::ResourcePrefetchPredictor::*recordFunction)
+ (const predictors::ResourcePrefetchPredictor::URLRequestSummary&)) const;
+
+ scoped_refptr<predictors::ResourcePrefetchPredictor> predictor_;
+
+ DISALLOW_COPY_AND_ASSIGN(ResourcePrefetchPredictorObserver);
+};
+
+} // namespace chrome_browser_net
+
+#endif // CHROME_BROWSER_NET_RESOURCE_PREFETCH_PREDICTOR_OBSERVER_H_

Powered by Google App Engine
This is Rietveld 408576698