Commit 10053295 authored by shishir@chromium.org's avatar shishir@chromium.org

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
parent 66bd551c
...@@ -326,14 +326,6 @@ void ResourcePrefetchPredictor::OnMainFrameRequest( ...@@ -326,14 +326,6 @@ void ResourcePrefetchPredictor::OnMainFrameRequest(
CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DCHECK_EQ(INITIALIZED, initialization_state_); 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. // Cleanup older navigations.
CleanupAbandonedNavigations(request.navigation_id); CleanupAbandonedNavigations(request.navigation_id);
...@@ -416,7 +408,10 @@ void ResourcePrefetchPredictor::Observe( ...@@ -416,7 +408,10 @@ void ResourcePrefetchPredictor::Observe(
const content::WebContents* web_contents = const content::WebContents* web_contents =
content::Source<content::WebContents>(source).ptr(); content::Source<content::WebContents>(source).ptr();
NavigationID navigation_id(*web_contents); 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; break;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment