Remove GetPendingSiteInstance from NavigationControllerDelegate.
It was previously needed to use a SiteInstance to locate a commit but this is no
longer true. This also moves the restore_type reset until commit time and changes
tests expectations accordingly.
BUG=369661
Review URL: https://codereview.chromium.org/1268453003
Cr-Commit-Position: refs/heads/master@{#341192}
diff --git a/content/browser/frame_host/navigation_controller_impl.cc b/content/browser/frame_host/navigation_controller_impl.cc
index 5d176c0..01f5332 100644
--- a/content/browser/frame_host/navigation_controller_impl.cc
+++ b/content/browser/frame_host/navigation_controller_impl.cc
@@ -813,10 +813,14 @@
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
@@ -1164,7 +1168,7 @@
// 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()));
@@ -1730,15 +1734,6 @@
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(