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

Side by Side Diff: chrome/browser/net/resource_prefetch_predictor_observer.h

Issue 462423004: Revert CL 117933003. Re-add resource speculative prefetching code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase to fix patch failure Created 6 years, 3 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/net/resource_prefetch_predictor_observer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_NET_RESOURCE_PREFETCH_PREDICTOR_OBSERVER_H_
6 #define CHROME_BROWSER_NET_RESOURCE_PREFETCH_PREDICTOR_OBSERVER_H_
7
8 #include "base/basictypes.h"
9 #include "base/memory/weak_ptr.h"
10 #include "chrome/browser/predictors/resource_prefetch_predictor.h"
11 #include "content/public/common/resource_type.h"
12
13 namespace net {
14 class URLRequest;
15 }
16
17 class GURL;
18
19 namespace chrome_browser_net {
20
21 // Observes resource requests in the ResourceDispatcherHostDelegate and notifies
22 // the ResourcePrefetchPredictor about the ones it is interested in.
23 // - Has an instance per profile, and is owned by the corresponding
24 // ProfileIOData.
25 // - Needs to be constructed on UI thread. Rest of the functions can only be
26 // called on the IO thread. Can be destroyed on UI or IO thread.
27 class ResourcePrefetchPredictorObserver {
28 public:
29 explicit ResourcePrefetchPredictorObserver(
30 predictors::ResourcePrefetchPredictor* predictor);
31 ~ResourcePrefetchPredictorObserver();
32
33 // Parts of the ResourceDispatcherHostDelegate that we want to observe.
34 void OnRequestStarted(net::URLRequest* request,
35 content::ResourceType resource_type,
36 int child_id,
37 int frame_id);
38 void OnRequestRedirected(const GURL& redirect_url, net::URLRequest* request);
39 void OnResponseStarted(net::URLRequest* request);
40
41 private:
42 // Owned by profile.
43 base::WeakPtr<predictors::ResourcePrefetchPredictor> predictor_;
44
45 DISALLOW_COPY_AND_ASSIGN(ResourcePrefetchPredictorObserver);
46 };
47
48 } // namespace chrome_browser_net
49
50 #endif // CHROME_BROWSER_NET_RESOURCE_PREFETCH_PREDICTOR_OBSERVER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/net/resource_prefetch_predictor_observer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698