| 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_PREFETCHER_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_PREDICTORS_RESOURCE_PREFETCHER_MANAGER_H_ |
| 6 #define CHROME_BROWSER_PREDICTORS_RESOURCE_PREFETCHER_MANAGER_H_ | 6 #define CHROME_BROWSER_PREDICTORS_RESOURCE_PREFETCHER_MANAGER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 PrefetchKeyType key_type, | 49 PrefetchKeyType key_type, |
| 50 scoped_ptr<ResourcePrefetcher::RequestVector> requests); | 50 scoped_ptr<ResourcePrefetcher::RequestVector> requests); |
| 51 | 51 |
| 52 // Stops the ResourcePrefetcher for the input navigation, if one was in | 52 // Stops the ResourcePrefetcher for the input navigation, if one was in |
| 53 // progress. | 53 // progress. |
| 54 void MaybeRemovePrefetch(const NavigationID& navigation_id); | 54 void MaybeRemovePrefetch(const NavigationID& navigation_id); |
| 55 | 55 |
| 56 // ResourcePrefetcher::Delegate methods. | 56 // ResourcePrefetcher::Delegate methods. |
| 57 virtual void ResourcePrefetcherFinished( | 57 virtual void ResourcePrefetcherFinished( |
| 58 ResourcePrefetcher* prefetcher, | 58 ResourcePrefetcher* prefetcher, |
| 59 ResourcePrefetcher::RequestVector* requests) OVERRIDE; | 59 ResourcePrefetcher::RequestVector* requests) override; |
| 60 virtual net::URLRequestContext* GetURLRequestContext() OVERRIDE; | 60 virtual net::URLRequestContext* GetURLRequestContext() override; |
| 61 | 61 |
| 62 private: | 62 private: |
| 63 friend class base::RefCountedThreadSafe<ResourcePrefetcherManager>; | 63 friend class base::RefCountedThreadSafe<ResourcePrefetcherManager>; |
| 64 friend class MockResourcePrefetcherManager; | 64 friend class MockResourcePrefetcherManager; |
| 65 | 65 |
| 66 typedef std::map<std::string, ResourcePrefetcher*> PrefetcherMap; | 66 typedef std::map<std::string, ResourcePrefetcher*> PrefetcherMap; |
| 67 | 67 |
| 68 virtual ~ResourcePrefetcherManager(); | 68 virtual ~ResourcePrefetcherManager(); |
| 69 | 69 |
| 70 // UI Thread. |predictor_| needs to be called on the UI thread. | 70 // UI Thread. |predictor_| needs to be called on the UI thread. |
| 71 void ResourcePrefetcherFinishedOnUI( | 71 void ResourcePrefetcherFinishedOnUI( |
| 72 const NavigationID& navigation_id, | 72 const NavigationID& navigation_id, |
| 73 PrefetchKeyType key_type, | 73 PrefetchKeyType key_type, |
| 74 scoped_ptr<ResourcePrefetcher::RequestVector> requests); | 74 scoped_ptr<ResourcePrefetcher::RequestVector> requests); |
| 75 | 75 |
| 76 ResourcePrefetchPredictor* predictor_; | 76 ResourcePrefetchPredictor* predictor_; |
| 77 const ResourcePrefetchPredictorConfig config_; | 77 const ResourcePrefetchPredictorConfig config_; |
| 78 net::URLRequestContextGetter* const context_getter_; | 78 net::URLRequestContextGetter* const context_getter_; |
| 79 | 79 |
| 80 PrefetcherMap prefetcher_map_; // Owns the ResourcePrefetcher pointers. | 80 PrefetcherMap prefetcher_map_; // Owns the ResourcePrefetcher pointers. |
| 81 | 81 |
| 82 DISALLOW_COPY_AND_ASSIGN(ResourcePrefetcherManager); | 82 DISALLOW_COPY_AND_ASSIGN(ResourcePrefetcherManager); |
| 83 }; | 83 }; |
| 84 | 84 |
| 85 } // namespace predictors | 85 } // namespace predictors |
| 86 | 86 |
| 87 #endif // CHROME_BROWSER_PREDICTORS_RESOURCE_PREFETCHER_MANAGER_H_ | 87 #endif // CHROME_BROWSER_PREDICTORS_RESOURCE_PREFETCHER_MANAGER_H_ |
| OLD | NEW |