Chromium Code Reviews| 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..c49426b01c2fd88b73a23501e47418d9e362f3a3 100644 |
| --- a/content/browser/frame_host/navigation_controller_impl.cc |
| +++ b/content/browser/frame_host/navigation_controller_impl.cc |
| @@ -813,10 +813,15 @@ 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() != nullptr || |
| + pending_entry_->restore_type() != NavigationEntryImpl::RESTORE_NONE); |
| + if (pending_entry_index_ != -1 && |
| + pending_entry_->site_instance() == nullptr && |
| + pending_entry_->restore_type() != NavigationEntryImpl::RESTORE_NONE) |
|
Charlie Reis
2015/07/30 16:55:14
Let's simplify these to:
DCHECK(!pending_entry_ |
Fabrice (no longer in Chrome)
2015/07/30 17:18:41
Done.
I find the explicit nullptr comparison to be
|
| + 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 +1162,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 +1728,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( |