Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1805)

Unified Diff: content/browser/tab_contents/tab_contents.cc

Issue 7649009: Merge of 97624 to 835 branch. (Closed) Base URL: svn://svn.chromium.org/chrome/branches/835/src/
Patch Set: Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/tab_contents/tab_contents.h ('k') | content/browser/tab_contents/test_tab_contents.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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() {
« no previous file with comments | « content/browser/tab_contents/tab_contents.h ('k') | content/browser/tab_contents/test_tab_contents.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698