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

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

Issue 10827103: Speculative resource prefetching - fixing missing navigations due to server side redirects. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Passing redirect_url as an argument to ResourceDispatcherHostDelegate::OnRequestRedirected. Created 8 years, 4 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_NET_RESOURCE_PREFETCH_PREDICTOR_OBSERVER_H_ 5 #ifndef CHROME_BROWSER_NET_RESOURCE_PREFETCH_PREDICTOR_OBSERVER_H_
6 #define CHROME_BROWSER_NET_RESOURCE_PREFETCH_PREDICTOR_OBSERVER_H_ 6 #define CHROME_BROWSER_NET_RESOURCE_PREFETCH_PREDICTOR_OBSERVER_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/memory/weak_ptr.h" 9 #include "base/memory/weak_ptr.h"
10 #include "chrome/browser/predictors/resource_prefetch_predictor.h" 10 #include "chrome/browser/predictors/resource_prefetch_predictor.h"
11 #include "googleurl/src/gurl.h"
James Hawkins 2012/08/02 18:17:50 Forward declare GURL instead.
Shishir 2012/08/02 18:25:43 Done.
11 #include "webkit/glue/resource_type.h" 12 #include "webkit/glue/resource_type.h"
12 13
13 namespace net { 14 namespace net {
14 class URLRequest; 15 class URLRequest;
15 } 16 }
16 17
17 namespace chrome_browser_net { 18 namespace chrome_browser_net {
18 19
19 // Observes resource requests in the ResourceDispatcherHostDelegate and notifies 20 // Observes resource requests in the ResourceDispatcherHostDelegate and notifies
20 // the ResourcePrefetchPredictor about the ones it is interested in. 21 // the ResourcePrefetchPredictor about the ones it is interested in.
21 // - Has an instance per profile, and is owned by the corresponding 22 // - Has an instance per profile, and is owned by the corresponding
22 // ProfileIOData. 23 // ProfileIOData.
23 // - Needs to be constructed on UI thread. Rest of the functions can only be 24 // - Needs to be constructed on UI thread. Rest of the functions can only be
24 // called on the IO thread. Can be destroyed on UI or IO thread. 25 // called on the IO thread. Can be destroyed on UI or IO thread.
25 class ResourcePrefetchPredictorObserver { 26 class ResourcePrefetchPredictorObserver {
26 public: 27 public:
27 explicit ResourcePrefetchPredictorObserver( 28 explicit ResourcePrefetchPredictorObserver(
28 predictors::ResourcePrefetchPredictor* predictor); 29 predictors::ResourcePrefetchPredictor* predictor);
29 ~ResourcePrefetchPredictorObserver(); 30 ~ResourcePrefetchPredictorObserver();
30 31
31 // Parts of the ResourceDispatcherHostDelegate that we want to observe. 32 // Parts of the ResourceDispatcherHostDelegate that we want to observe.
32 void OnRequestStarted(net::URLRequest* request, 33 void OnRequestStarted(net::URLRequest* request,
33 ResourceType::Type resource_type, 34 ResourceType::Type resource_type,
34 int child_id, 35 int child_id,
35 int route_id); 36 int route_id);
36 void OnRequestRedirected(net::URLRequest* request); 37 void OnRequestRedirected(const GURL& redirect_url, net::URLRequest* request);
37 void OnResponseStarted(net::URLRequest* request); 38 void OnResponseStarted(net::URLRequest* request);
38 39
39 private: 40 private:
40 // Owned by profile. 41 // Owned by profile.
41 base::WeakPtr<predictors::ResourcePrefetchPredictor> predictor_; 42 base::WeakPtr<predictors::ResourcePrefetchPredictor> predictor_;
42 43
43 DISALLOW_COPY_AND_ASSIGN(ResourcePrefetchPredictorObserver); 44 DISALLOW_COPY_AND_ASSIGN(ResourcePrefetchPredictorObserver);
44 }; 45 };
45 46
46 } // namespace chrome_browser_net 47 } // namespace chrome_browser_net
47 48
48 #endif // CHROME_BROWSER_NET_RESOURCE_PREFETCH_PREDICTOR_OBSERVER_H_ 49 #endif // CHROME_BROWSER_NET_RESOURCE_PREFETCH_PREDICTOR_OBSERVER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698