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

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

Issue 145493005: Keep frames to navigate alive in HistoryController::goToEntry() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 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
Index: Source/core/page/HistoryController.cpp
diff --git a/Source/core/page/HistoryController.cpp b/Source/core/page/HistoryController.cpp
index cb963d6c45926d15bc63505a5a6885014469159f..09534be653b561e8e2abb0a9f4d8c93c475b1a29 100644
--- a/Source/core/page/HistoryController.cpp
+++ b/Source/core/page/HistoryController.cpp
@@ -153,6 +153,22 @@ void HistoryController::updateBackForwardListForFragmentScroll(Frame* frame, His
createNewBackForwardItem(frame, item, false);
}
+class HistoryController::HistoryFrameLoad {
+public:
+ HistoryFrameLoad(Frame* frame, HistoryItem* item)
+ : m_frame(frame)
+ , m_item(item)
+ {
+ }
+
+ Frame* frame() { return m_frame.get(); }
+ HistoryItem* item() { return m_item; }
+
+private:
+ RefPtr<Frame> m_frame;
+ HistoryItem* m_item;
+};
+
void HistoryController::goToEntry(PassOwnPtr<HistoryEntry> targetEntry, ResourceRequestCachePolicy cachePolicy)
{
HistoryFrameLoadSet sameDocumentLoads;
@@ -162,10 +178,10 @@ void HistoryController::goToEntry(PassOwnPtr<HistoryEntry> targetEntry, Resource
if (m_currentEntry)
recursiveGoToEntry(m_page->mainFrame(), sameDocumentLoads, differentDocumentLoads);
else
- differentDocumentLoads.set(m_page->mainFrame(), m_provisionalEntry->root());
+ differentDocumentLoads.set(m_page->mainFrame(), adoptPtr(new HistoryFrameLoad(m_page->mainFrame(), m_provisionalEntry->root())));
if (sameDocumentLoads.isEmpty() && differentDocumentLoads.isEmpty())
- sameDocumentLoads.set(m_page->mainFrame(), m_provisionalEntry->root());
+ sameDocumentLoads.set(m_page->mainFrame(), adoptPtr(new HistoryFrameLoad(m_page->mainFrame(), m_provisionalEntry->root())));
if (differentDocumentLoads.isEmpty()) {
m_previousEntry = m_currentEntry.release();
@@ -173,9 +189,9 @@ void HistoryController::goToEntry(PassOwnPtr<HistoryEntry> targetEntry, Resource
}
for (HistoryFrameLoadSet::iterator it = sameDocumentLoads.begin(); it != sameDocumentLoads.end(); ++it)
- it->key->loader().loadHistoryItem(it->value, HistorySameDocumentLoad, cachePolicy);
+ it->key->loader().loadHistoryItem(it->value->item(), HistorySameDocumentLoad, cachePolicy);
Nate Chapin 2014/01/23 18:19:11 Rather than checking m_client in loadHistoryItem()
for (HistoryFrameLoadSet::iterator it = differentDocumentLoads.begin(); it != differentDocumentLoads.end(); ++it)
- it->key->loader().loadHistoryItem(it->value, HistoryDifferentDocumentLoad, cachePolicy);
+ it->key->loader().loadHistoryItem(it->value->item(), HistoryDifferentDocumentLoad, cachePolicy);
}
void HistoryController::recursiveGoToEntry(Frame* frame, HistoryFrameLoadSet& sameDocumentLoads, HistoryFrameLoadSet& differentDocumentLoads)
@@ -189,9 +205,9 @@ void HistoryController::recursiveGoToEntry(Frame* frame, HistoryFrameLoadSet& sa
if (!oldItem || (newItem != oldItem && newItem->itemSequenceNumber() != oldItem->itemSequenceNumber())) {
if (oldItem && newItem->documentSequenceNumber() == oldItem->documentSequenceNumber())
- sameDocumentLoads.set(frame, newItem);
+ sameDocumentLoads.set(frame, adoptPtr(new HistoryFrameLoad(frame, newItem)));
else
- differentDocumentLoads.set(frame, newItem);
+ differentDocumentLoads.set(frame, adoptPtr(new HistoryFrameLoad(frame, newItem)));
return;
}
« Source/core/page/HistoryController.h ('K') | « Source/core/page/HistoryController.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698