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

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

Issue 994803004: Add Clone and disallow copy construction for NavigationEntryImpl. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cleanup Created 5 years, 9 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 6610cb1202c04ab2360021ba4a1df4f4aba3f4ea..0b0f411a1a041f52893e84357af935f7fe81c0df 100644
--- a/content/browser/frame_host/navigation_controller_impl.cc
+++ b/content/browser/frame_host/navigation_controller_impl.cc
@@ -1050,7 +1050,7 @@ void NavigationControllerImpl::RendererDidNavigateToNewPage(
if (pending_entry_ &&
(!pending_entry_->site_instance() ||
pending_entry_->site_instance() == rfh->GetSiteInstance())) {
- new_entry = new NavigationEntryImpl(*pending_entry_);
+ new_entry = pending_entry_->Clone();
update_virtual_url = new_entry->update_virtual_url_with_url();
} else {
@@ -1260,8 +1260,7 @@ void NavigationControllerImpl::RendererDidNavigateNewSubframe(
// band with the actual navigations.
DCHECK(GetLastCommittedEntry()) << "ClassifyNavigation should guarantee "
<< "that a last committed entry exists.";
- NavigationEntryImpl* new_entry =
- new NavigationEntryImpl(*GetLastCommittedEntry());
+ NavigationEntryImpl* new_entry = GetLastCommittedEntry()->Clone();
new_entry->SetPageID(params.page_id);
InsertOrReplaceEntry(new_entry, false);
}
@@ -1805,12 +1804,14 @@ void NavigationControllerImpl::InsertEntriesFrom(
DCHECK_LE(max_index, source.GetEntryCount());
size_t insert_index = 0;
for (int i = 0; i < max_index; i++) {
- // When cloning a tab, copy all entries except interstitial pages
- if (source.entries_[i].get()->GetPageType() !=
- PAGE_TYPE_INTERSTITIAL) {
+ // When cloning a tab, copy all entries except interstitial pages.
+ if (source.entries_[i].get()->GetPageType() != PAGE_TYPE_INTERSTITIAL) {
+ // TODO(creis): Once we start sharing FrameNavigationEntries between
+ // NavigationEntries, it will not be safe to share them with another tab.
+ // Must have a version of Clone that recreates them.
entries_.insert(entries_.begin() + insert_index++,
linked_ptr<NavigationEntryImpl>(
- new NavigationEntryImpl(*source.entries_[i])));
+ source.entries_[i]->Clone()));
}
}
}
« no previous file with comments | « no previous file | content/browser/frame_host/navigation_entry_impl.h » ('j') | content/browser/frame_host/navigation_entry_impl.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698