Chromium Code Reviews| 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 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 515 } | 515 } |
| 516 history_service_observer_.RemoveAll(); | 516 history_service_observer_.RemoveAll(); |
| 517 } | 517 } |
| 518 | 518 |
| 519 void ResourcePrefetchPredictor::OnMainFrameRequest( | 519 void ResourcePrefetchPredictor::OnMainFrameRequest( |
| 520 const URLRequestSummary& request) { | 520 const URLRequestSummary& request) { |
| 521 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 521 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 522 DCHECK_EQ(INITIALIZED, initialization_state_); | 522 DCHECK_EQ(INITIALIZED, initialization_state_); |
| 523 | 523 |
| 524 const GURL& main_frame_url = request.navigation_id.main_frame_url; | 524 const GURL& main_frame_url = request.navigation_id.main_frame_url; |
| 525 StartPrefetching(main_frame_url); | 525 if (!config_.ExternalPrefetchingOnly()) |
|
pasko
2016/11/17 15:59:04
so 'external prefetch only' disables all prefetchi
Benoit L
2016/11/21 13:40:32
It disables prefetches triggered by observing a na
| |
| 526 StartPrefetching(main_frame_url); | |
| 526 | 527 |
| 527 // Cleanup older navigations. | 528 // Cleanup older navigations. |
| 528 CleanupAbandonedNavigations(request.navigation_id); | 529 CleanupAbandonedNavigations(request.navigation_id); |
| 529 | 530 |
| 530 // New empty navigation entry. | 531 // New empty navigation entry. |
| 531 inflight_navigations_.insert( | 532 inflight_navigations_.insert( |
| 532 std::make_pair(request.navigation_id, | 533 std::make_pair(request.navigation_id, |
| 533 base::MakeUnique<PageRequestSummary>(main_frame_url))); | 534 base::MakeUnique<PageRequestSummary>(main_frame_url))); |
| 534 } | 535 } |
| 535 | 536 |
| (...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1169 TestObserver::~TestObserver() { | 1170 TestObserver::~TestObserver() { |
| 1170 predictor_->SetObserverForTesting(nullptr); | 1171 predictor_->SetObserverForTesting(nullptr); |
| 1171 } | 1172 } |
| 1172 | 1173 |
| 1173 TestObserver::TestObserver(ResourcePrefetchPredictor* predictor) | 1174 TestObserver::TestObserver(ResourcePrefetchPredictor* predictor) |
| 1174 : predictor_(predictor) { | 1175 : predictor_(predictor) { |
| 1175 predictor_->SetObserverForTesting(this); | 1176 predictor_->SetObserverForTesting(this); |
| 1176 } | 1177 } |
| 1177 | 1178 |
| 1178 } // namespace predictors | 1179 } // namespace predictors |
| OLD | NEW |