Commit e7cabc69 authored by Chris Harrelson's avatar Chris Harrelson Committed by Commit Bot

Clean up code after previous refactor

1. It is no longer possible to cause recursion in
RestoreScrollPositionAndViewState, so delete code that protects against
that.
2. Remove now-unused parameter.

Refactor CL: https://chromium-review.googlesource.com/c/chromium/src/+/1981806

Change-Id: I93d99d1a301f97303186459949963c1da11144d6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1982788Reviewed-by: default avatarStefan Zager <szager@chromium.org>
Reviewed-by: default avatarDavid Bokan <bokan@chromium.org>
Commit-Queue: Chris Harrelson <chrishtr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#728265}
parent 9cbc6347
...@@ -176,7 +176,6 @@ ResourceRequest FrameLoader::ResourceRequestForReload( ...@@ -176,7 +176,6 @@ ResourceRequest FrameLoader::ResourceRequestForReload(
FrameLoader::FrameLoader(LocalFrame* frame) FrameLoader::FrameLoader(LocalFrame* frame)
: frame_(frame), : frame_(frame),
progress_tracker_(MakeGarbageCollected<ProgressTracker>(frame)), progress_tracker_(MakeGarbageCollected<ProgressTracker>(frame)),
in_restore_scroll_(false),
forced_sandbox_flags_(WebSandboxFlags::kNone), forced_sandbox_flags_(WebSandboxFlags::kNone),
dispatching_did_clear_window_object_in_main_world_(false), dispatching_did_clear_window_object_in_main_world_(false),
detached_(false), detached_(false),
...@@ -450,8 +449,7 @@ void FrameLoader::DidFinishSameDocumentNavigation( ...@@ -450,8 +449,7 @@ void FrameLoader::DidFinishSameDocumentNavigation(
: SerializedScriptValue::NullValue()); : SerializedScriptValue::NullValue());
if (view_state) { if (view_state) {
RestoreScrollPositionAndViewState(frame_load_type, RestoreScrollPositionAndViewState(frame_load_type, *view_state,
true /* is_same_document */, *view_state,
history_item->ScrollRestorationType()); history_item->ScrollRestorationType());
} }
...@@ -1175,20 +1173,17 @@ void FrameLoader::CommitDocumentLoader( ...@@ -1175,20 +1173,17 @@ void FrameLoader::CommitDocumentLoader(
void FrameLoader::RestoreScrollPositionAndViewState() { void FrameLoader::RestoreScrollPositionAndViewState() {
if (!frame_->GetPage() || !GetDocumentLoader() || if (!frame_->GetPage() || !GetDocumentLoader() ||
!GetDocumentLoader()->GetHistoryItem() || !GetDocumentLoader()->GetHistoryItem() ||
!GetDocumentLoader()->GetHistoryItem()->GetViewState() || !GetDocumentLoader()->GetHistoryItem()->GetViewState()) {
in_restore_scroll_) {
return; return;
} }
base::AutoReset<bool> in_restore_scroll(&in_restore_scroll_, true);
RestoreScrollPositionAndViewState( RestoreScrollPositionAndViewState(
GetDocumentLoader()->LoadType(), false /* is_same_document */, GetDocumentLoader()->LoadType(),
*GetDocumentLoader()->GetHistoryItem()->GetViewState(), *GetDocumentLoader()->GetHistoryItem()->GetViewState(),
GetDocumentLoader()->GetHistoryItem()->ScrollRestorationType()); GetDocumentLoader()->GetHistoryItem()->ScrollRestorationType());
} }
void FrameLoader::RestoreScrollPositionAndViewState( void FrameLoader::RestoreScrollPositionAndViewState(
WebFrameLoadType load_type, WebFrameLoadType load_type,
bool is_same_document,
const HistoryItem::ViewState& view_state, const HistoryItem::ViewState& view_state,
HistoryScrollRestorationType scroll_restoration_type) { HistoryScrollRestorationType scroll_restoration_type) {
LocalFrameView* view = frame_->View(); LocalFrameView* view = frame_->View();
......
...@@ -261,7 +261,6 @@ class CORE_EXPORT FrameLoader final { ...@@ -261,7 +261,6 @@ class CORE_EXPORT FrameLoader final {
void ClearClientNavigation(); void ClearClientNavigation();
void RestoreScrollPositionAndViewState(WebFrameLoadType, void RestoreScrollPositionAndViewState(WebFrameLoadType,
bool is_same_document,
const HistoryItem::ViewState&, const HistoryItem::ViewState&,
HistoryScrollRestorationType); HistoryScrollRestorationType);
...@@ -314,8 +313,6 @@ class CORE_EXPORT FrameLoader final { ...@@ -314,8 +313,6 @@ class CORE_EXPORT FrameLoader final {
}; };
std::unique_ptr<ClientNavigationState> client_navigation_; std::unique_ptr<ClientNavigationState> client_navigation_;
bool in_restore_scroll_;
WebSandboxFlags forced_sandbox_flags_; WebSandboxFlags forced_sandbox_flags_;
// A snapshot value of frame_owner's sandbox flags states at the beginning of // A snapshot value of frame_owner's sandbox flags states at the beginning of
// navigation. For main frame which does not have a frame owner, the value is // navigation. For main frame which does not have a frame owner, the value is
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment