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

Unified Diff: Source/core/page/HistoryController.cpp

Issue 139103003: Reland "Remove children from HistoryNodes that redirect during back/forward navigation" (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Make trybots happy Created 6 years, 11 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 | « Source/core/page/HistoryController.h ('k') | Source/web/FrameLoaderClientImpl.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/page/HistoryController.cpp
diff --git a/Source/core/page/HistoryController.cpp b/Source/core/page/HistoryController.cpp
index 8e6406a87b4b6e7b0853e421db05991abf521823..cb963d6c45926d15bc63505a5a6885014469159f 100644
--- a/Source/core/page/HistoryController.cpp
+++ b/Source/core/page/HistoryController.cpp
@@ -82,6 +82,26 @@ HistoryNode::HistoryNode(HistoryEntry* entry, HistoryItem* value)
m_entry->m_uniqueNamesToItems.add(target, this);
}
+void HistoryNode::removeChildren()
+{
+ // FIXME: This is inefficient. Figure out a cleaner way to ensure this HistoryNode isn't cached anywhere.
+ for (unsigned i = 0; i < m_children.size(); i++) {
+ m_children[i]->removeChildren();
+
+ HashMap<uint64_t, HistoryNode*>::iterator framesEnd = m_entry->m_framesToItems.end();
+ HashMap<String, HistoryNode*>::iterator uniqueNamesEnd = m_entry->m_uniqueNamesToItems.end();
+ for (HashMap<uint64_t, HistoryNode*>::iterator it = m_entry->m_framesToItems.begin(); it != framesEnd; ++it) {
+ if (it->value == m_children[i])
+ m_entry->m_framesToItems.remove(it);
+ }
+ for (HashMap<String, HistoryNode*>::iterator it = m_entry->m_uniqueNamesToItems.begin(); it != uniqueNamesEnd; ++it) {
+ if (it->value == m_children[i])
+ m_entry->m_uniqueNamesToItems.remove(it);
+ }
+ }
+ m_children.clear();
+}
+
HistoryEntry::HistoryEntry(HistoryItem* root)
{
m_root = HistoryNode::create(this, root);
@@ -277,6 +297,14 @@ HistoryItem* HistoryController::itemForNewChildFrame(Frame* frame) const
return m_currentEntry ? m_currentEntry->itemForFrame(frame) : 0;
}
+void HistoryController::removeChildrenForRedirect(Frame* frame)
+{
+ if (!m_provisionalEntry)
+ return;
+ if (HistoryNode* node = m_provisionalEntry->historyNodeForFrame(frame))
+ node->removeChildren();
+}
+
void HistoryController::createNewBackForwardItem(Frame* targetFrame, HistoryItem* item, bool clipAtTarget)
{
RefPtr<HistoryItem> newItem = item;
« no previous file with comments | « Source/core/page/HistoryController.h ('k') | Source/web/FrameLoaderClientImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698