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

Unified Diff: content/browser/frame_host/navigation_controller_impl.cc

Issue 1268453003: Remove GetPendingSiteInstance from NavigationControllerDelegate. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Restore pending_entry_index_ Created 5 years, 5 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
Index: content/browser/frame_host/navigation_controller_impl.cc
diff --git a/content/browser/frame_host/navigation_controller_impl.cc b/content/browser/frame_host/navigation_controller_impl.cc
index 01da9c130f57d116b8f931aa1b342e906fe7d8d5..884ff89d2985219784488fdb6645fc7c3c767810 100644
--- a/content/browser/frame_host/navigation_controller_impl.cc
+++ b/content/browser/frame_host/navigation_controller_impl.cc
@@ -813,10 +813,14 @@ bool NavigationControllerImpl::RendererDidNavigate(
details->previous_entry_index = -1;
}
- // If we have a pending entry at this point, it should have a SiteInstance.
- // Restored entries start out with a null SiteInstance, but we should have
- // assigned one in NavigateToPendingEntry.
- DCHECK(pending_entry_index_ == -1 || pending_entry_->site_instance());
+ // If there is a pending entry at this point, it should have a SiteInstance,
+ // except for restored entries.
+ DCHECK(pending_entry_index_ == -1 ||
+ pending_entry_->site_instance() ||
+ pending_entry_->restore_type() != NavigationEntryImpl::RESTORE_NONE);
+ if (pending_entry_ &&
+ pending_entry_->restore_type() != NavigationEntryImpl::RESTORE_NONE)
+ pending_entry_->set_restore_type(NavigationEntryImpl::RESTORE_NONE);
// If we are doing a cross-site reload, we need to replace the existing
// navigation entry, not add another entry to the history. This has the side
@@ -1157,7 +1161,7 @@ void NavigationControllerImpl::RendererDidNavigateToExistingPage(
// The site instance will normally be the same except during session restore,
// when no site instance will be assigned.
- DCHECK(entry->site_instance() == NULL ||
+ DCHECK(entry->site_instance() == nullptr ||
entry->site_instance() == rfh->GetSiteInstance());
entry->set_site_instance(
static_cast<SiteInstanceImpl*>(rfh->GetSiteInstance()));
@@ -1723,15 +1727,6 @@ void NavigationControllerImpl::NavigateToPendingEntry(ReloadType reload_type) {
if (!success)
DiscardNonCommittedEntries();
-
- // If the entry is being restored and doesn't have a SiteInstance yet, fill
- // it in now that we know. This allows us to find the entry when it commits.
- if (pending_entry_ && !pending_entry_->site_instance() &&
- pending_entry_->restore_type() != NavigationEntryImpl::RESTORE_NONE) {
- pending_entry_->set_site_instance(static_cast<SiteInstanceImpl*>(
- delegate_->GetPendingSiteInstance()));
- pending_entry_->set_restore_type(NavigationEntryImpl::RESTORE_NONE);
- }
}
bool NavigationControllerImpl::NavigateToPendingEntryInternal(

Powered by Google App Engine
This is Rietveld 408576698