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

Unified Diff: third_party/WebKit/Source/core/frame/History.cpp

Issue 2710983003: Move HistoryItem handling to DocumentLoader (Closed)
Patch Set: Experiment to fix DCHECKing tests Created 3 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: third_party/WebKit/Source/core/frame/History.cpp
diff --git a/third_party/WebKit/Source/core/frame/History.cpp b/third_party/WebKit/Source/core/frame/History.cpp
index 59c101e2985c9d715bd50d0f524646fbb866d8d8..5da6b0413fb843055e4253c38ce3448b830a8ac3 100644
--- a/third_party/WebKit/Source/core/frame/History.cpp
+++ b/third_party/WebKit/Source/core/frame/History.cpp
@@ -77,8 +77,10 @@ SerializedScriptValue* History::stateInternal() const {
if (!frame())
return 0;
- if (HistoryItem* historyItem = frame()->loader().currentItem())
+ if (HistoryItem* historyItem =
+ frame()->loader().documentLoader()->historyItem()) {
yhirano 2017/03/29 09:38:13 Can |frame()->loader().documentLoader()| be null?
Nate Chapin 2017/03/29 18:23:06 I *think* it can't. FrameLoader::documentLoader()
return historyItem->stateObject();
+ }
return 0;
}
@@ -93,7 +95,8 @@ void History::setScrollRestoration(const String& value) {
if (scrollRestoration == scrollRestorationInternal())
return;
- if (HistoryItem* historyItem = frame()->loader().currentItem()) {
+ if (HistoryItem* historyItem =
+ frame()->loader().documentLoader()->historyItem()) {
historyItem->setScrollRestorationType(scrollRestoration);
frame()->loader().client()->didUpdateCurrentHistoryItem();
}
@@ -105,12 +108,10 @@ String History::scrollRestoration() {
}
HistoryScrollRestorationType History::scrollRestorationInternal() const {
- if (frame()) {
- if (HistoryItem* historyItem = frame()->loader().currentItem())
- return historyItem->scrollRestorationType();
- }
-
- return ScrollRestorationAuto;
+ HistoryItem* historyItem =
+ frame() ? frame()->loader().documentLoader()->historyItem() : nullptr;
+ return historyItem ? historyItem->scrollRestorationType()
+ : ScrollRestorationAuto;
}
bool History::stateChanged() const {

Powered by Google App Engine
This is Rietveld 408576698