FrameLoader: explicit CreatePlaceholderDocumentLoader
This patch replaces kNavigationPolicyHandledByClient with
an explicit call CreatePlaceholderDocumentLoader.
This technique removes inversion of control between WebLocalFrame
and it's client, and gives the client all the power for driving
navigations. For example:
- RenderFrameImpl::PendingNavigationInfo is gone, since
RenderFrameImpl controls the process and doesn't have to store
information between WebLocalFrameClient callbacks.
- We don't issue DidStartProvisionalLoad for placeholders anymore
for the similar reason.
A couple of small changes required:
- WebNavigationParams::source_location is now optional.
This is needed for preserving source location when creating
a placeholder (and for synchronous commits in the future).
- Plumbed WebFrameLoadType instead of replaces_current_item to
not lose information.
Next step will do the same for kNavigationPolicyCurrentTab
and let the client drive navigation all the time. After that
we'll get rid of multiple WebLocalFrameClient callbacks.
Bug: 855189
Cq-Include-Trybots: luci.chromium.try:linux_layout_tests_layout_ng
Change-Id: I5f1d1b5269f99227e3998fba2333c0f3661f7e9e
Reviewed-on: https://chromium-review.googlesource.com/c/1263052
Commit-Queue: Dmitry Gozman <[email protected]>
Reviewed-by: Nasko Oskov <[email protected]>
Reviewed-by: Daniel Cheng <[email protected]>
Cr-Commit-Position: refs/heads/master@{#605796}
diff --git a/content/renderer/render_frame_impl.h b/content/renderer/render_frame_impl.h
index d9c6f574..1df8017 100644
--- a/content/renderer/render_frame_impl.h
+++ b/content/renderer/render_frame_impl.h
@@ -646,14 +646,12 @@
mojo::ScopedMessagePipeHandle blob_url_token) override;
void LoadErrorPage(int reason) override;
blink::WebNavigationPolicy DecidePolicyForNavigation(
- const NavigationPolicyInfo& info) override;
+ NavigationPolicyInfo& info) override;
void WillSendSubmitEvent(const blink::WebFormElement& form) override;
void DidCreateDocumentLoader(
blink::WebDocumentLoader* document_loader) override;
- void DidStartProvisionalLoad(
- blink::WebDocumentLoader* document_loader,
- blink::WebURLRequest& request,
- mojo::ScopedMessagePipeHandle navigation_initiator_handle) override;
+ void DidStartProvisionalLoad(blink::WebDocumentLoader* document_loader,
+ blink::WebURLRequest& request) override;
void DidFailProvisionalLoad(const blink::WebURLError& error,
blink::WebHistoryCommitType commit_type) override;
void DidCommitProvisionalLoad(
@@ -1178,9 +1176,7 @@
const RequestNavigationParams& request_params);
// Sends a FrameHostMsg_BeginNavigation to the browser
- void BeginNavigation(
- const NavigationPolicyInfo& info,
- mojo::ScopedMessagePipeHandle navigation_initiator_handle);
+ void BeginNavigation(NavigationPolicyInfo& info);
// Loads a data url.
void LoadDataURL(
@@ -1569,33 +1565,6 @@
// See BindingsPolicy for details.
int enabled_bindings_ = 0;
- // Contains information about a pending navigation to be sent to the browser.
- // We save information about the navigation in decidePolicyForNavigation().
- // The navigation is sent to the browser in didStartProvisionalLoad().
- // Please see the BeginNavigation() for information.
- struct PendingNavigationInfo {
- blink::WebNavigationType navigation_type;
- blink::WebNavigationPolicy policy;
- bool replaces_current_history_item;
- bool history_navigation_in_new_child_frame;
- bool client_redirect;
- blink::WebTriggeringEventInfo triggering_event_info;
- blink::WebFormElement form;
- blink::WebSourceLocation source_location;
- blink::WebString devtools_initiator_info;
- blink::mojom::BlobURLTokenPtr blob_url_token;
- base::TimeTicks input_start;
- blink::WebString href_translate;
-
- explicit PendingNavigationInfo(const NavigationPolicyInfo& info);
- ~PendingNavigationInfo();
- };
-
- // Contains information about a pending navigation to be sent to the browser.
- // This state is allocated in decidePolicyForNavigation() and is used and
- // released in didStartProvisionalLoad().
- std::unique_ptr<PendingNavigationInfo> pending_navigation_info_;
-
service_manager::BindSourceInfo browser_info_;
mojom::FrameHostAssociatedPtr frame_host_ptr_;