Chromium Code Reviews| Index: chrome/browser/prerender/prerender_manager.cc |
| diff --git a/chrome/browser/prerender/prerender_manager.cc b/chrome/browser/prerender/prerender_manager.cc |
| index ec50600105588bb40af2ce4460a311662e5220a8..124bd88477e1f5536ccbac9539d3d75dcebe568f 100644 |
| --- a/chrome/browser/prerender/prerender_manager.cc |
| +++ b/chrome/browser/prerender/prerender_manager.cc |
| @@ -427,6 +427,14 @@ bool PrerenderManager::MaybeUsePrerenderedPage(WebContents* web_contents, |
| prerender_data->contents()->prerender_contents()) { |
| if (web_contents == new_web_contents) |
| return false; // Do not swap in to ourself. |
| + |
| + // We cannot swap in if there is no last committed entry, because we would |
| + // show a blank page under an existing entry from the current tab. Even if |
| + // there is a pending entry, it may not commit. |
| + // TODO(creis): If there is a pending navigation and no last committed |
| + // entry, we might be able to transfer the network request instead. |
|
cbentzel
2013/05/17 00:32:15
I'd like to add UMA to see how frequently this hap
Charlie Reis
2013/05/17 23:50:21
Yes, that's a good idea. Just increment a stat he
cbentzel
2013/05/18 21:11:08
For now, I would actually destroy the prerender an
|
| + if (!new_web_contents->GetController().CanPruneAllButVisible()) |
| + return false; |
| } |
| // Do not use the prerendered version if there is an opener object. |
| @@ -520,8 +528,8 @@ bool PrerenderManager::MaybeUsePrerenderedPage(WebContents* web_contents, |
| MarkWebContentsAsPrerendered(new_web_contents, prerender_contents->origin()); |
| // Merge the browsing history. |
| - new_web_contents->GetController().CopyStateFromAndPrune( |
| - &old_web_contents->GetController()); |
| + CHECK(new_web_contents->GetController().CopyStateFromAndPrune( |
| + &old_web_contents->GetController())); |
| CoreTabHelper::FromWebContents(old_web_contents)->delegate()-> |
| SwapTabContents(old_web_contents, new_web_contents); |
| prerender_contents->CommitHistory(new_web_contents); |