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

Unified Diff: Source/core/loader/HistoryController.h

Issue 28983004: Split the frame tree logic out of HistoryItem (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 2 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/loader/HistoryController.h
diff --git a/Source/core/loader/HistoryController.h b/Source/core/loader/HistoryController.h
index f70840843cbf81dc51aede0abe16dd27c1c0c1d7..bc448aa677b1b6204beaca8bdfd9ff70387baa00 100644
--- a/Source/core/loader/HistoryController.h
+++ b/Source/core/loader/HistoryController.h
@@ -32,6 +32,7 @@
#include "core/history/HistoryItem.h"
#include "core/loader/FrameLoaderTypes.h"
+#include "wtf/HashMap.h"
#include "wtf/Noncopyable.h"
#include "wtf/RefPtr.h"
#include "wtf/text/WTFString.h"
@@ -39,68 +40,112 @@
namespace WebCore {
class Frame;
+class HistoryEntry;
+class Page;
class SerializedScriptValue;
+
+class HistoryEntryItem {
+public:
+ static PassOwnPtr<HistoryEntryItem> create(HistoryEntry*, HistoryItem*);
+ ~HistoryEntryItem() { }
+
+ HistoryEntryItem* addChild(PassRefPtr<HistoryItem>);
+ PassOwnPtr<HistoryEntryItem> cloneAndReplace(HistoryEntry*, HistoryItem* newItem, HistoryItem* oldItem, bool clipAtTarget, Frame*);
+ HistoryItem* value() { return m_value.get(); }
+ void updateValue(PassRefPtr<HistoryItem> item) { m_value = item; }
+ const Vector<OwnPtr<HistoryEntryItem> >& children() const { return m_children; }
+
+private:
+ HistoryEntryItem(HistoryEntry*, HistoryItem*);
+
+ Vector<OwnPtr<HistoryEntryItem> > m_children;
+ RefPtr<HistoryItem> m_value;
+ HistoryEntry* m_entry;
+};
+
+class HistoryEntry {
+public:
+ static PassOwnPtr<HistoryEntry> create(HistoryItem* root);
+ PassOwnPtr<HistoryEntry> cloneAndReplace(HistoryItem* newItem, HistoryItem* oldItem, bool clipAtTarget, Page*);
+
+ HistoryEntryItem* entryForFrame(Frame*);
+ HistoryItem* itemForFrame(Frame*);
+ HistoryItem* root() const { return m_root->value(); }
+ HistoryEntryItem* rootEntry() const { return m_root.get(); }
+
+private:
+ friend class HistoryEntryItem;
+
+ HistoryEntry() { }
+ explicit HistoryEntry(HistoryItem* root);
+
+ OwnPtr<HistoryEntryItem> m_root;
+ HashMap<uint64_t, HistoryEntryItem*> m_framesToItems;
abarth-chromium 2013/10/29 20:36:58 uint64_t -> I wonder if we should have a typedef f
+ HashMap<String, HistoryEntryItem*> m_uniqueNamesToItems;
+};
+
class HistoryController {
WTF_MAKE_NONCOPYABLE(HistoryController);
public:
- explicit HistoryController(Frame*);
+ explicit HistoryController(Page*);
~HistoryController();
void clearScrollPositionAndViewState();
- void restoreScrollPositionAndViewState();
+ void restoreScrollPositionAndViewState(Frame*);
+
+ void updateBackForwardListForFragmentScroll(Frame*);
- void updateBackForwardListForFragmentScroll();
+ void saveDocumentAndScrollState(Frame*);
+ void restoreDocumentState(Frame*);
- void saveDocumentAndScrollState();
- void restoreDocumentState();
+ void updateForCommit(Frame*);
+ void updateForSameDocumentNavigation(Frame*);
- void updateForCommit();
- void updateForSameDocumentNavigation();
+ PassRefPtr<HistoryItem> currentItemForExport(Frame*);
+ PassRefPtr<HistoryItem> previousItemForExport(Frame*);
+ PassRefPtr<HistoryItem> provisionalItemForExport(Frame*);
- HistoryItem* currentItem() const { return m_currentItem.get(); }
- void setCurrentItem(HistoryItem*);
- bool currentItemShouldBeReplaced() const;
+ HistoryItem* currentItem(Frame*) const;
+ bool currentItemShouldBeReplaced(Frame*) const;
- HistoryItem* previousItem() const { return m_previousItem.get(); }
+ HistoryItem* previousItem(Frame*) const;
+ void clearProvisionalEntry();
- HistoryItem* provisionalItem() const { return m_provisionalItem.get(); }
- void setProvisionalItem(HistoryItem*);
+ bool shouldPerformSameDocumentHistoryNavigation(Frame*, HistoryItem*) const;
- void pushState(PassRefPtr<SerializedScriptValue>, const String& url);
- void replaceState(PassRefPtr<SerializedScriptValue>, const String& url);
+ void pushState(Frame*, PassRefPtr<SerializedScriptValue>, const String& url);
+ void replaceState(Frame*, PassRefPtr<SerializedScriptValue>, const String& url);
void setDefersLoading(bool);
private:
friend class Page;
- bool shouldStopLoadingForHistoryItem(HistoryItem*) const;
void goToItem(HistoryItem*);
+ void goToEntry(PassOwnPtr<HistoryEntry>);
+ void recursiveGoToEntry(Frame*, HistoryEntryItem* newEntry, HistoryEntryItem* oldEntry);
- void initializeItem(HistoryItem*);
- PassRefPtr<HistoryItem> createItem();
- PassRefPtr<HistoryItem> createItemTree(Frame* targetFrame, bool clipAtTarget);
+ void initializeItem(HistoryItem*, Frame*);
+ PassRefPtr<HistoryItem> createItem(Frame*);
+ HistoryItem* createItemTree(Frame* targetFrame, bool clipAtTarget);
- void updateForStandardLoad();
- void updateForInitialLoadInChildFrame();
+ void updateForStandardLoad(Frame*);
+ void updateForInitialLoadInChildFrame(Frame*);
- void recursiveSetProvisionalItem(HistoryItem*, HistoryItem*);
- void recursiveGoToItem(HistoryItem*, HistoryItem*);
- void recursiveUpdateForCommit();
- void recursiveUpdateForSameDocumentNavigation();
- bool itemsAreClones(HistoryItem*, HistoryItem*) const;
- bool currentFramesMatchItem(HistoryItem*) const;
+ void createNewBackForwardItem(Frame*, bool doClip);
+ void updateWithoutCreatingNewBackForwardItem(Frame*);
- void createNewBackForwardItem(bool doClip);
- void updateWithoutCreatingNewBackForwardItem();
+ PassRefPtr<HistoryItem> itemForExport(HistoryEntryItem*);
- void clearProvisionalItemsInAllFrames();
+ Page* m_page;
- Frame* m_frame;
+ OwnPtr<HistoryEntry> m_currentEntry;
+ OwnPtr<HistoryEntry> m_previousEntry;
+ OwnPtr<HistoryEntry> m_provisionalEntry;
- RefPtr<HistoryItem> m_currentItem;
- RefPtr<HistoryItem> m_previousItem;
- RefPtr<HistoryItem> m_provisionalItem;
+ typedef HashMap<Frame*, HistoryItem*> HistoryFrameLoadSet;
+ HistoryFrameLoadSet m_sameDocumentLoadsInProgress;
+ HistoryFrameLoadSet m_differentDocumentLoadsInProgress;
bool m_defersLoading;
RefPtr<HistoryItem> m_deferredItem;

Powered by Google App Engine
This is Rietveld 408576698