| 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 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 516 } | 516 } |
| 517 history_service_observer_.RemoveAll(); | 517 history_service_observer_.RemoveAll(); |
| 518 } | 518 } |
| 519 | 519 |
| 520 void ResourcePrefetchPredictor::OnMainFrameRequest( | 520 void ResourcePrefetchPredictor::OnMainFrameRequest( |
| 521 const URLRequestSummary& request) { | 521 const URLRequestSummary& request) { |
| 522 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 522 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 523 DCHECK_EQ(INITIALIZED, initialization_state_); | 523 DCHECK_EQ(INITIALIZED, initialization_state_); |
| 524 | 524 |
| 525 const GURL& main_frame_url = request.navigation_id.main_frame_url; | 525 const GURL& main_frame_url = request.navigation_id.main_frame_url; |
| 526 StartPrefetching(main_frame_url); | 526 if (!config_.ExternalPrefetchingOnly()) |
| 527 StartPrefetching(main_frame_url); |
| 527 | 528 |
| 528 // Cleanup older navigations. | 529 // Cleanup older navigations. |
| 529 CleanupAbandonedNavigations(request.navigation_id); | 530 CleanupAbandonedNavigations(request.navigation_id); |
| 530 | 531 |
| 531 // New empty navigation entry. | 532 // New empty navigation entry. |
| 532 inflight_navigations_.insert( | 533 inflight_navigations_.insert( |
| 533 std::make_pair(request.navigation_id, | 534 std::make_pair(request.navigation_id, |
| 534 base::MakeUnique<PageRequestSummary>(main_frame_url))); | 535 base::MakeUnique<PageRequestSummary>(main_frame_url))); |
| 535 } | 536 } |
| 536 | 537 |
| (...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1170 TestObserver::~TestObserver() { | 1171 TestObserver::~TestObserver() { |
| 1171 predictor_->SetObserverForTesting(nullptr); | 1172 predictor_->SetObserverForTesting(nullptr); |
| 1172 } | 1173 } |
| 1173 | 1174 |
| 1174 TestObserver::TestObserver(ResourcePrefetchPredictor* predictor) | 1175 TestObserver::TestObserver(ResourcePrefetchPredictor* predictor) |
| 1175 : predictor_(predictor) { | 1176 : predictor_(predictor) { |
| 1176 predictor_->SetObserverForTesting(this); | 1177 predictor_->SetObserverForTesting(this); |
| 1177 } | 1178 } |
| 1178 | 1179 |
| 1179 } // namespace predictors | 1180 } // namespace predictors |
| OLD | NEW |