Index: content/browser/tab_contents/tab_contents.cc |
diff --git a/content/browser/tab_contents/tab_contents.cc b/content/browser/tab_contents/tab_contents.cc |
index 26aa66a93671f607c4a759b0b4d211a622564f76..43304027449d9ee4fba93f9fd329bb1bb8e57c53 100644 |
--- a/content/browser/tab_contents/tab_contents.cc |
+++ b/content/browser/tab_contents/tab_contents.cc |
@@ -125,14 +125,17 @@ |
// - After RDH receives a response and determines that it is safe and not a |
// download, it pauses the response to first run the old page's onunload |
// handler. It does this by asynchronously calling the OnCrossSiteResponse |
-// method of TabContents on the UI thread, which sends a ClosePage message |
+// method of TabContents on the UI thread, which sends a SwapOut message |
// to the current RVH. |
-// - Once the onunload handler is finished, a ClosePage_ACK message is sent to |
+// - Once the onunload handler is finished, a SwapOut_ACK message is sent to |
// the ResourceDispatcherHost, who unpauses the response. Data is then sent |
// to the pending RVH. |
// - The pending renderer sends a FrameNavigate message that invokes the |
// DidNavigate method. This replaces the current RVH with the |
// pending RVH and goes back to the NORMAL RendererState. |
+// - The previous renderer is kept swapped out in RenderViewHostManager in case |
+// the user goes back. The process only stays live if another tab is using |
+// it, but if so, the existing frame relationships will be maintained. |
namespace { |
@@ -2018,7 +2021,9 @@ void TabContents::DidNavigate(RenderViewHost* rvh, |
void TabContents::UpdateState(RenderViewHost* rvh, |
int32 page_id, |
const std::string& state) { |
- DCHECK(rvh == render_view_host()); |
+ // Ensure that this state update comes from either the active RVH or one of |
+ // the swapped out RVHs. We don't expect to hear from any other RVHs. |
+ DCHECK(rvh == render_view_host() || render_manager_.IsSwappedOut(rvh)); |
// We must be prepared to handle state updates for any page, these occur |
// when the user is scrolling and entering form data, as well as when we're |
@@ -2027,7 +2032,7 @@ void TabContents::UpdateState(RenderViewHost* rvh, |
// NavigationEntry and update it when it is notified via the delegate. |
int entry_index = controller_.GetEntryIndexWithPageID( |
- GetSiteInstance(), page_id); |
+ rvh->site_instance(), page_id); |
if (entry_index < 0) |
return; |
NavigationEntry* entry = controller_.GetEntryAtIndex(entry_index); |