| 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_prefetch_predictor.h" | 5 #include "chrome/browser/predictors/resource_prefetch_predictor.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 555 std::vector<GURL> urls; | 555 std::vector<GURL> urls; |
| 556 PrefetchKeyType key_type; | 556 PrefetchKeyType key_type; |
| 557 if (!GetPrefetchData(navigation_id, &urls, &key_type)) { | 557 if (!GetPrefetchData(navigation_id, &urls, &key_type)) { |
| 558 // No prefetching data at host or URL level. | 558 // No prefetching data at host or URL level. |
| 559 return; | 559 return; |
| 560 } | 560 } |
| 561 | 561 |
| 562 BrowserThread::PostTask( | 562 BrowserThread::PostTask( |
| 563 BrowserThread::IO, FROM_HERE, | 563 BrowserThread::IO, FROM_HERE, |
| 564 base::Bind(&ResourcePrefetcherManager::MaybeAddPrefetch, | 564 base::Bind(&ResourcePrefetcherManager::MaybeAddPrefetch, |
| 565 prefetch_manager_, navigation_id, key_type, urls)); | 565 prefetch_manager_, navigation_id, urls)); |
| 566 } | 566 } |
| 567 | 567 |
| 568 void ResourcePrefetchPredictor::StopPrefetching( | 568 void ResourcePrefetchPredictor::StopPrefetching( |
| 569 const NavigationID& navigation_id) { | 569 const NavigationID& navigation_id) { |
| 570 if (!prefetch_manager_.get()) // Not enabled. | 570 if (!prefetch_manager_.get()) // Not enabled. |
| 571 return; | 571 return; |
| 572 | 572 |
| 573 BrowserThread::PostTask( | 573 BrowserThread::PostTask( |
| 574 BrowserThread::IO, FROM_HERE, | 574 BrowserThread::IO, FROM_HERE, |
| 575 base::Bind(&ResourcePrefetcherManager::MaybeRemovePrefetch, | 575 base::Bind(&ResourcePrefetcherManager::MaybeRemovePrefetch, |
| (...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 927 // HistoryService is already loaded. Continue with Initialization. | 927 // HistoryService is already loaded. Continue with Initialization. |
| 928 OnHistoryAndCacheLoaded(); | 928 OnHistoryAndCacheLoaded(); |
| 929 return; | 929 return; |
| 930 } | 930 } |
| 931 DCHECK(!history_service_observer_.IsObserving(history_service)); | 931 DCHECK(!history_service_observer_.IsObserving(history_service)); |
| 932 history_service_observer_.Add(history_service); | 932 history_service_observer_.Add(history_service); |
| 933 return; | 933 return; |
| 934 } | 934 } |
| 935 | 935 |
| 936 } // namespace predictors | 936 } // namespace predictors |
| OLD | NEW |