Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(89)

Unified Diff: chrome/browser/predictors/resource_prefetch_predictor.cc

Issue 10827103: Speculative resource prefetching - fixing missing navigations due to server side redirects. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fixing comment. Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 5f247e0151d04ad6f3cc1ed8c07f0dfe897ad7d6..107c1beaf5135e9b1bf7d6d58195fe4650355109 100644
--- a/chrome/browser/predictors/resource_prefetch_predictor.cc
+++ b/chrome/browser/predictors/resource_prefetch_predictor.cc
@@ -88,7 +88,8 @@ ResourcePrefetchPredictor::URLRequestSummary::URLRequestSummary(
resource_url(other.resource_url),
resource_type(other.resource_type),
mime_type(other.mime_type),
- was_cached(other.was_cached) {
+ was_cached(other.was_cached),
+ redirect_url(other.redirect_url) {
mmenke 2012/08/01 15:39:53 Completely unrelated, but while you're here, mind
Shishir 2012/08/01 18:07:49 Done.
}
ResourcePrefetchPredictor::URLRequestSummary::~URLRequestSummary() {
@@ -353,7 +354,18 @@ 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
+ // redirect url as a new navigation.
mmenke 2012/08/01 10:25:37 This comment is phrased/placed really oddly, since
Shishir 2012/08/01 18:07:49 Done.
+ if (response.redirect_url.is_empty())
mmenke 2012/08/01 10:25:37 When does this happen? Think a comment would be r
Shishir 2012/08/01 18:07:49 Done.
+ 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(

Powered by Google App Engine
This is Rietveld 408576698