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 702 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
713 void ResourcePrefetchPredictor::OnMainFrameRedirect( | 713 void ResourcePrefetchPredictor::OnMainFrameRedirect( |
714 const URLRequestSummary& response) { | 714 const URLRequestSummary& response) { |
715 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 715 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
716 DCHECK_EQ(INITIALIZED, initialization_state_); | 716 DCHECK_EQ(INITIALIZED, initialization_state_); |
717 | 717 |
718 const GURL& main_frame_url = response.navigation_id.main_frame_url; | 718 const GURL& main_frame_url = response.navigation_id.main_frame_url; |
719 std::unique_ptr<PageRequestSummary> summary; | 719 std::unique_ptr<PageRequestSummary> summary; |
720 NavigationMap::iterator nav_it = | 720 NavigationMap::iterator nav_it = |
721 inflight_navigations_.find(response.navigation_id); | 721 inflight_navigations_.find(response.navigation_id); |
722 if (nav_it != inflight_navigations_.end()) { | 722 if (nav_it != inflight_navigations_.end()) { |
723 summary.reset(nav_it->second.release()); | 723 summary = std::move(nav_it->second); |
724 inflight_navigations_.erase(nav_it); | 724 inflight_navigations_.erase(nav_it); |
725 } | 725 } |
726 | 726 |
727 // The redirect url may be empty if the URL was invalid. | 727 // The redirect url may be empty if the URL was invalid. |
728 if (response.redirect_url.is_empty()) | 728 if (response.redirect_url.is_empty()) |
729 return; | 729 return; |
730 | 730 |
731 // If we lost the information about the first hop for some reason. | 731 // If we lost the information about the first hop for some reason. |
732 if (!summary) { | 732 if (!summary) { |
733 summary = base::MakeUnique<PageRequestSummary>(main_frame_url); | 733 summary = base::MakeUnique<PageRequestSummary>(main_frame_url); |
(...skipping 759 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1493 TestObserver::~TestObserver() { | 1493 TestObserver::~TestObserver() { |
1494 predictor_->SetObserverForTesting(nullptr); | 1494 predictor_->SetObserverForTesting(nullptr); |
1495 } | 1495 } |
1496 | 1496 |
1497 TestObserver::TestObserver(ResourcePrefetchPredictor* predictor) | 1497 TestObserver::TestObserver(ResourcePrefetchPredictor* predictor) |
1498 : predictor_(predictor) { | 1498 : predictor_(predictor) { |
1499 predictor_->SetObserverForTesting(this); | 1499 predictor_->SetObserverForTesting(this); |
1500 } | 1500 } |
1501 | 1501 |
1502 } // namespace predictors | 1502 } // namespace predictors |
OLD | NEW |