| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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> |
| 11 | 11 |
| 12 #include "base/containers/scoped_ptr_map.h" |
| 12 #include "base/gtest_prod_util.h" | 13 #include "base/gtest_prod_util.h" |
| 13 #include "base/memory/linked_ptr.h" | 14 #include "base/memory/linked_ptr.h" |
| 14 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
| 15 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
| 16 #include "base/scoped_observer.h" | 17 #include "base/scoped_observer.h" |
| 17 #include "base/task/cancelable_task_tracker.h" | 18 #include "base/task/cancelable_task_tracker.h" |
| 18 #include "base/time/time.h" | 19 #include "base/time/time.h" |
| 19 #include "chrome/browser/predictors/resource_prefetch_common.h" | 20 #include "chrome/browser/predictors/resource_prefetch_common.h" |
| 20 #include "chrome/browser/predictors/resource_prefetch_predictor_tables.h" | 21 #include "chrome/browser/predictors/resource_prefetch_predictor_tables.h" |
| 21 #include "chrome/browser/predictors/resource_prefetcher.h" | 22 #include "chrome/browser/predictors/resource_prefetcher.h" |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 private: | 163 private: |
| 163 DISALLOW_COPY_AND_ASSIGN(Result); | 164 DISALLOW_COPY_AND_ASSIGN(Result); |
| 164 }; | 165 }; |
| 165 | 166 |
| 166 typedef ResourcePrefetchPredictorTables::ResourceRow ResourceRow; | 167 typedef ResourcePrefetchPredictorTables::ResourceRow ResourceRow; |
| 167 typedef ResourcePrefetchPredictorTables::ResourceRows ResourceRows; | 168 typedef ResourcePrefetchPredictorTables::ResourceRows ResourceRows; |
| 168 typedef ResourcePrefetchPredictorTables::PrefetchData PrefetchData; | 169 typedef ResourcePrefetchPredictorTables::PrefetchData PrefetchData; |
| 169 typedef ResourcePrefetchPredictorTables::PrefetchDataMap PrefetchDataMap; | 170 typedef ResourcePrefetchPredictorTables::PrefetchDataMap PrefetchDataMap; |
| 170 typedef std::map<NavigationID, linked_ptr<std::vector<URLRequestSummary> > > | 171 typedef std::map<NavigationID, linked_ptr<std::vector<URLRequestSummary> > > |
| 171 NavigationMap; | 172 NavigationMap; |
| 172 typedef std::map<NavigationID, Result*> ResultsMap; | 173 typedef ScopedPtrMap<NavigationID, scoped_ptr<Result>> ResultsMap; |
| 173 | 174 |
| 174 // Returns true if the main page request is supported for prediction. | 175 // Returns true if the main page request is supported for prediction. |
| 175 static bool IsHandledMainPage(net::URLRequest* request); | 176 static bool IsHandledMainPage(net::URLRequest* request); |
| 176 | 177 |
| 177 // Returns true if the subresource request is supported for prediction. | 178 // Returns true if the subresource request is supported for prediction. |
| 178 static bool IsHandledSubresource(net::URLRequest* request); | 179 static bool IsHandledSubresource(net::URLRequest* request); |
| 179 | 180 |
| 180 // Returns true if the request (should have a response in it) is cacheable. | 181 // Returns true if the request (should have a response in it) is cacheable. |
| 181 static bool IsCacheable(const net::URLRequest* request); | 182 static bool IsCacheable(const net::URLRequest* request); |
| 182 | 183 |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 base::CancelableTaskTracker history_lookup_consumer_; | 314 base::CancelableTaskTracker history_lookup_consumer_; |
| 314 | 315 |
| 315 // Map of all the navigations in flight to their resource requests. | 316 // Map of all the navigations in flight to their resource requests. |
| 316 NavigationMap inflight_navigations_; | 317 NavigationMap inflight_navigations_; |
| 317 | 318 |
| 318 // Copy of the data in the predictor tables. | 319 // Copy of the data in the predictor tables. |
| 319 scoped_ptr<PrefetchDataMap> url_table_cache_; | 320 scoped_ptr<PrefetchDataMap> url_table_cache_; |
| 320 scoped_ptr<PrefetchDataMap> host_table_cache_; | 321 scoped_ptr<PrefetchDataMap> host_table_cache_; |
| 321 | 322 |
| 322 ResultsMap results_map_; | 323 ResultsMap results_map_; |
| 323 STLValueDeleter<ResultsMap> results_map_deleter_; | |
| 324 | 324 |
| 325 ScopedObserver<history::HistoryService, history::HistoryServiceObserver> | 325 ScopedObserver<history::HistoryService, history::HistoryServiceObserver> |
| 326 history_service_observer_; | 326 history_service_observer_; |
| 327 | 327 |
| 328 DISALLOW_COPY_AND_ASSIGN(ResourcePrefetchPredictor); | 328 DISALLOW_COPY_AND_ASSIGN(ResourcePrefetchPredictor); |
| 329 }; | 329 }; |
| 330 | 330 |
| 331 } // namespace predictors | 331 } // namespace predictors |
| 332 | 332 |
| 333 #endif // CHROME_BROWSER_PREDICTORS_RESOURCE_PREFETCH_PREDICTOR_H_ | 333 #endif // CHROME_BROWSER_PREDICTORS_RESOURCE_PREFETCH_PREDICTOR_H_ |
| OLD | NEW |