Index: content/browser/tab_contents/tab_contents.cc |
=================================================================== |
--- content/browser/tab_contents/tab_contents.cc (revision 96734) |
+++ content/browser/tab_contents/tab_contents.cc (working copy) |
@@ -371,6 +371,13 @@ |
return render_manager_.current_host()->site_instance(); |
} |
+SiteInstance* TabContents::GetPendingSiteInstance() const { |
+ RenderViewHost* dest_rvh = render_manager_.pending_render_view_host() ? |
+ render_manager_.pending_render_view_host() : |
+ render_manager_.current_host(); |
+ return dest_rvh->site_instance(); |
+} |
+ |
bool TabContents::ShouldDisplayURL() { |
// Don't hide the url in view source mode and with interstitials. |
NavigationEntry* entry = controller_.GetActiveEntry(); |
@@ -584,12 +591,29 @@ |
return true; |
} |
-void TabContents::SetHistoryLengthAndClear(int history_length) { |
+void TabContents::SetHistoryLengthAndPrune(const SiteInstance* site_instance, |
+ int history_length, |
+ int32 minimum_page_id) { |
+ // SetHistoryLengthAndPrune doesn't handle pending cross-site navigations |
+ // cleanly. Since it's only used when swapping in instant and prerendered |
+ // TabContents, checks are done at a higher level to ensure that the pages |
+ // are not swapped in during this case. |
+ if (render_manager_.pending_render_view_host()) { |
+ NOTREACHED(); |
+ return; |
+ } |
RenderViewHost* rvh = render_view_host(); |
- if (!rvh) |
+ if (!rvh) { |
+ NOTREACHED(); |
return; |
- rvh->Send(new ViewMsg_SetHistoryLengthAndClear(rvh->routing_id(), |
- history_length)); |
+ } |
+ if (site_instance && rvh->site_instance() != site_instance) { |
+ NOTREACHED(); |
+ return; |
+ } |
+ rvh->Send(new ViewMsg_SetHistoryLengthAndPrune(rvh->routing_id(), |
+ history_length, |
+ minimum_page_id)); |
} |
void TabContents::Stop() { |