summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorshishir@chromium.org <shishir@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-01 02:07:14 +0000
committershishir@chromium.org <shishir@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-01 02:07:14 +0000
commit100532954477be3fdab303f11ce625c4d780dcd7 (patch)
tree9f634585b997e32f6d78956516c9342a8e877092 /chrome
parent66bd551cda949f85e6b9cbfbd5cf80a50f536253 (diff)
downloadchromium_src-100532954477be3fdab303f11ce625c4d780dcd7.zip
chromium_src-100532954477be3fdab303f11ce625c4d780dcd7.tar.gz
chromium_src-100532954477be3fdab303f11ce625c4d780dcd7.tar.bz2
Speculative resource prefetching - Test fixes.
- Removing dcheck that two navigations on the same renderview with the same url should not have the same creation time. It looks like it is possible for tests to be able to do this and theoretically it is possible for this to happen in production. The code already this handles this case well, so the check will not be missed. - Add a check to see if WebContents returns empty URL before calling OnNavigationComplete. Review URL: https://chromiumcodereview.appspot.com/10825118 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@149353 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/predictors/resource_prefetch_predictor.cc13
1 files changed, 4 insertions, 9 deletions
diff --git a/chrome/browser/predictors/resource_prefetch_predictor.cc b/chrome/browser/predictors/resource_prefetch_predictor.cc
index 5f247e0..a65f5d5 100644
--- a/chrome/browser/predictors/resource_prefetch_predictor.cc
+++ b/chrome/browser/predictors/resource_prefetch_predictor.cc
@@ -326,14 +326,6 @@ void ResourcePrefetchPredictor::OnMainFrameRequest(
CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DCHECK_EQ(INITIALIZED, initialization_state_);
- // TODO(shishir): Remove this code after verifying that the same navigation is
- // not seen multiple times.
- NavigationMap::const_iterator it =
- inflight_navigations_.find(request.navigation_id);
- if (it != inflight_navigations_.end()) {
- DCHECK(it->first.creation_time != request.navigation_id.creation_time);
- }
-
// Cleanup older navigations.
CleanupAbandonedNavigations(request.navigation_id);
@@ -416,7 +408,10 @@ void ResourcePrefetchPredictor::Observe(
const content::WebContents* web_contents =
content::Source<content::WebContents>(source).ptr();
NavigationID navigation_id(*web_contents);
- OnNavigationComplete(navigation_id);
+ // WebContents can return an empty URL if the navigation entry
+ // corresponding to the navigation has not been created yet.
+ if (!navigation_id.main_frame_url.is_empty())
+ OnNavigationComplete(navigation_id);
break;
}