| 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 #include <memory> | 9 #include <memory> |
| 10 #include <string> | 10 #include <string> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
| 15 #include "chrome/browser/predictors/resource_prefetch_common.h" | 15 #include "chrome/browser/predictors/resource_prefetch_common.h" |
| 16 #include "chrome/browser/predictors/resource_prefetcher.h" | 16 #include "chrome/browser/predictors/resource_prefetcher.h" |
| 17 | 17 |
| 18 namespace net { | 18 namespace net { |
| 19 class URLRequestContextGetter; | 19 class URLRequestContextGetter; |
| 20 } | 20 } |
| 21 | 21 |
| 22 namespace predictors { | 22 namespace predictors { |
| 23 | 23 |
| 24 struct NavigationID; | |
| 25 class ResourcePrefetchPredictor; | 24 class ResourcePrefetchPredictor; |
| 26 | 25 |
| 27 // Manages prefetches for multiple navigations. | 26 // Manages prefetches for multiple navigations. |
| 28 // - Created and owned by the resource prefetch predictor. | 27 // - Created and owned by the resource prefetch predictor. |
| 29 // - Needs to be refcounted as it is de-referenced on two different threads. | 28 // - Needs to be refcounted as it is de-referenced on two different threads. |
| 30 // - Created on the UI thread, but most functions are called in the IO thread. | 29 // - Created on the UI thread, but most functions are called in the IO thread. |
| 31 // - Will only allow one inflight prefresh per host. | 30 // - Will only allow one inflight prefresh per host. |
| 32 class ResourcePrefetcherManager | 31 class ResourcePrefetcherManager |
| 33 : public ResourcePrefetcher::Delegate, | 32 : public ResourcePrefetcher::Delegate, |
| 34 public base::RefCountedThreadSafe<ResourcePrefetcherManager> { | 33 public base::RefCountedThreadSafe<ResourcePrefetcherManager> { |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 net::URLRequestContextGetter* const context_getter_; | 69 net::URLRequestContextGetter* const context_getter_; |
| 71 | 70 |
| 72 std::map<std::string, std::unique_ptr<ResourcePrefetcher>> prefetcher_map_; | 71 std::map<std::string, std::unique_ptr<ResourcePrefetcher>> prefetcher_map_; |
| 73 | 72 |
| 74 DISALLOW_COPY_AND_ASSIGN(ResourcePrefetcherManager); | 73 DISALLOW_COPY_AND_ASSIGN(ResourcePrefetcherManager); |
| 75 }; | 74 }; |
| 76 | 75 |
| 77 } // namespace predictors | 76 } // namespace predictors |
| 78 | 77 |
| 79 #endif // CHROME_BROWSER_PREDICTORS_RESOURCE_PREFETCHER_MANAGER_H_ | 78 #endif // CHROME_BROWSER_PREDICTORS_RESOURCE_PREFETCHER_MANAGER_H_ |
| OLD | NEW |