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

Side by Side Diff: chrome/browser/predictors/resource_prefetch_predictor.h

Issue 15517005: Remove references to Profile from browser_context_keyed_service. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase & style Created 7 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 unified diff | Download patch | Annotate | Revision Log
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_PREDICTORS_RESOURCE_PREFETCH_PREDICTOR_H_ 5 #ifndef CHROME_BROWSER_PREDICTORS_RESOURCE_PREFETCH_PREDICTOR_H_
6 #define CHROME_BROWSER_PREDICTORS_RESOURCE_PREFETCH_PREDICTOR_H_ 6 #define CHROME_BROWSER_PREDICTORS_RESOURCE_PREFETCH_PREDICTOR_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 // * ResourcePrefetcherManager - Manages the ResourcePrefetchers that do the 63 // * ResourcePrefetcherManager - Manages the ResourcePrefetchers that do the
64 // prefetching on the IO thread. The manager is owned by the 64 // prefetching on the IO thread. The manager is owned by the
65 // ResourcePrefetchPredictor and interfaces between the predictor on the UI 65 // ResourcePrefetchPredictor and interfaces between the predictor on the UI
66 // thread and the prefetchers on the IO thread. 66 // thread and the prefetchers on the IO thread.
67 // * ResourcePrefetcher - Lives entirely on the IO thread, owned by the 67 // * ResourcePrefetcher - Lives entirely on the IO thread, owned by the
68 // ResourcePrefetcherManager, and issues net::URLRequest to fetch resources. 68 // ResourcePrefetcherManager, and issues net::URLRequest to fetch resources.
69 // 69 //
70 // TODO(shishir): Do speculative prefetching for https resources and/or https 70 // TODO(shishir): Do speculative prefetching for https resources and/or https
71 // main frame urls. 71 // main frame urls.
72 class ResourcePrefetchPredictor 72 class ResourcePrefetchPredictor
73 : public ProfileKeyedService, 73 : public BrowserContextKeyedService,
74 public content::NotificationObserver, 74 public content::NotificationObserver,
75 public base::SupportsWeakPtr<ResourcePrefetchPredictor> { 75 public base::SupportsWeakPtr<ResourcePrefetchPredictor> {
76 public: 76 public:
77 // Stores the data that we need to get from the URLRequest. 77 // Stores the data that we need to get from the URLRequest.
78 struct URLRequestSummary { 78 struct URLRequestSummary {
79 URLRequestSummary(); 79 URLRequestSummary();
80 URLRequestSummary(const URLRequestSummary& other); 80 URLRequestSummary(const URLRequestSummary& other);
81 ~URLRequestSummary(); 81 ~URLRequestSummary();
82 82
83 NavigationID navigation_id; 83 NavigationID navigation_id;
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 static bool IsHandledSubresource(net::URLRequest* request); 175 static bool IsHandledSubresource(net::URLRequest* request);
176 176
177 // Returns true if the request (should have a response in it) is cacheable. 177 // Returns true if the request (should have a response in it) is cacheable.
178 static bool IsCacheable(const net::URLRequest* request); 178 static bool IsCacheable(const net::URLRequest* request);
179 179
180 // content::NotificationObserver methods OVERRIDE. 180 // content::NotificationObserver methods OVERRIDE.
181 virtual void Observe(int type, 181 virtual void Observe(int type,
182 const content::NotificationSource& source, 182 const content::NotificationSource& source,
183 const content::NotificationDetails& details) OVERRIDE; 183 const content::NotificationDetails& details) OVERRIDE;
184 184
185 // ProfileKeyedService methods OVERRIDE. 185 // BrowserContextKeyedService methods OVERRIDE.
186 virtual void Shutdown() OVERRIDE; 186 virtual void Shutdown() OVERRIDE;
187 187
188 // Functions called on different network events pertaining to the loading of 188 // Functions called on different network events pertaining to the loading of
189 // main frame resource or sub resources. 189 // main frame resource or sub resources.
190 void OnMainFrameRequest(const URLRequestSummary& request); 190 void OnMainFrameRequest(const URLRequestSummary& request);
191 void OnMainFrameResponse(const URLRequestSummary& response); 191 void OnMainFrameResponse(const URLRequestSummary& response);
192 void OnMainFrameRedirect(const URLRequestSummary& response); 192 void OnMainFrameRedirect(const URLRequestSummary& response);
193 void OnSubresourceResponse(const URLRequestSummary& response); 193 void OnSubresourceResponse(const URLRequestSummary& response);
194 void OnSubresourceLoadedFromMemory(const NavigationID& navigation_id, 194 void OnSubresourceLoadedFromMemory(const NavigationID& navigation_id,
195 const GURL& resource_url, 195 const GURL& resource_url,
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 303
304 ResultsMap results_map_; 304 ResultsMap results_map_;
305 STLValueDeleter<ResultsMap> results_map_deleter_; 305 STLValueDeleter<ResultsMap> results_map_deleter_;
306 306
307 DISALLOW_COPY_AND_ASSIGN(ResourcePrefetchPredictor); 307 DISALLOW_COPY_AND_ASSIGN(ResourcePrefetchPredictor);
308 }; 308 };
309 309
310 } // namespace predictors 310 } // namespace predictors
311 311
312 #endif // CHROME_BROWSER_PREDICTORS_RESOURCE_PREFETCH_PREDICTOR_H_ 312 #endif // CHROME_BROWSER_PREDICTORS_RESOURCE_PREFETCH_PREDICTOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698