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 #include "chrome/browser/predictors/resource_prefetcher_manager.h" | 5 #include "chrome/browser/predictors/resource_prefetcher_manager.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
11 #include "base/stl_util.h" | 11 #include "base/stl_util.h" |
12 #include "chrome/browser/predictors/resource_prefetch_predictor.h" | 12 #include "chrome/browser/predictors/resource_prefetch_predictor.h" |
13 #include "content/public/browser/browser_thread.h" | 13 #include "content/public/browser/browser_thread.h" |
14 #include "net/url_request/url_request.h" | 14 #include "net/url_request/url_request.h" |
15 #include "net/url_request/url_request_context_getter.h" | 15 #include "net/url_request/url_request_context_getter.h" |
16 | 16 |
17 using content::BrowserThread; | 17 using content::BrowserThread; |
18 | 18 |
19 namespace predictors { | 19 namespace predictors { |
20 | 20 |
21 ResourcePrefetcherManager::ResourcePrefetcherManager( | 21 ResourcePrefetcherManager::ResourcePrefetcherManager( |
22 ResourcePrefetchPredictor* predictor, | 22 ResourcePrefetchPredictor* predictor, |
23 const ResourcePrefetchPredictorConfig& config, | 23 const LoadingPredictorConfig& config, |
24 net::URLRequestContextGetter* context_getter) | 24 net::URLRequestContextGetter* context_getter) |
25 : predictor_(predictor), | 25 : predictor_(predictor), config_(config), context_getter_(context_getter) { |
26 config_(config), | |
27 context_getter_(context_getter) { | |
28 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 26 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
29 CHECK(predictor_); | 27 CHECK(predictor_); |
30 CHECK(context_getter_); | 28 CHECK(context_getter_); |
31 } | 29 } |
32 | 30 |
33 ResourcePrefetcherManager::~ResourcePrefetcherManager() { | 31 ResourcePrefetcherManager::~ResourcePrefetcherManager() { |
34 DCHECK(prefetcher_map_.empty()) | 32 DCHECK(prefetcher_map_.empty()) |
35 << "Did not call ShutdownOnUIThread or ShutdownOnIOThread. " | 33 << "Did not call ShutdownOnUIThread or ShutdownOnIOThread. " |
36 " Will leak Prefetcher pointers."; | 34 " Will leak Prefetcher pointers."; |
37 } | 35 } |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 prefetcher_map_.erase(it); | 96 prefetcher_map_.erase(it); |
99 } | 97 } |
100 | 98 |
101 net::URLRequestContext* ResourcePrefetcherManager::GetURLRequestContext() { | 99 net::URLRequestContext* ResourcePrefetcherManager::GetURLRequestContext() { |
102 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); | 100 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); |
103 | 101 |
104 return context_getter_->GetURLRequestContext(); | 102 return context_getter_->GetURLRequestContext(); |
105 } | 103 } |
106 | 104 |
107 } // namespace predictors | 105 } // namespace predictors |
OLD | NEW |