Chromium Code Reviews| Index: chrome/browser/predictors/resource_prefetch_predictor.cc |
| diff --git a/chrome/browser/predictors/resource_prefetch_predictor.cc b/chrome/browser/predictors/resource_prefetch_predictor.cc |
| index a65f5d5967bff06fc78f6409c9c9fb3dcf4c4697..d173eea9bc5fcb3588fa67a3cc48ad389ae17511 100644 |
| --- a/chrome/browser/predictors/resource_prefetch_predictor.cc |
| +++ b/chrome/browser/predictors/resource_prefetch_predictor.cc |
| @@ -84,11 +84,12 @@ ResourcePrefetchPredictor::URLRequestSummary::URLRequestSummary() |
| ResourcePrefetchPredictor::URLRequestSummary::URLRequestSummary( |
| const URLRequestSummary& other) |
| - : navigation_id(other.navigation_id), |
| - resource_url(other.resource_url), |
| - resource_type(other.resource_type), |
| - mime_type(other.mime_type), |
| - was_cached(other.was_cached) { |
| + : navigation_id(other.navigation_id), |
| + resource_url(other.resource_url), |
| + resource_type(other.resource_type), |
| + mime_type(other.mime_type), |
| + was_cached(other.was_cached), |
| + redirect_url(other.redirect_url) { |
| } |
| ResourcePrefetchPredictor::URLRequestSummary::~URLRequestSummary() { |
| @@ -345,7 +346,20 @@ void ResourcePrefetchPredictor::OnMainFrameRedirect( |
| const URLRequestSummary& response) { |
| CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| + // Remove the older navigation. |
| inflight_navigations_.erase(response.navigation_id); |
| + |
| + // We do not see another navigation start for a redirect, so record the |
|
James Hawkins
2012/08/02 18:17:50
nit: Don't use pronouns in comments (we); pronouns
Shishir
2012/08/02 18:25:43
Done.
|
| + // redirect url as a new navigation. |
| + |
| + // The redirect url may be empty if the url was invalid. |
| + if (response.redirect_url.is_empty()) |
| + return; |
| + |
| + NavigationID navigation_id(response.navigation_id); |
| + navigation_id.main_frame_url = response.redirect_url; |
| + inflight_navigations_.insert(std::make_pair( |
| + navigation_id, std::vector<URLRequestSummary>())); |
| } |
| void ResourcePrefetchPredictor::OnSubresourceResponse( |