Navigation: Implement NavigationClient commit callback.
In the model of the NavigationClient navigation interface, the renderer
does not send a message notifying the browser that it committed. Instead,
it runs the mojo callback that was passed to it at commit.
In practice, this means that both SimulateCommitProcessed and
DidCommitProvisionalLoad are part of the callback, instead of just the
former.
Because changing the callback means changing signatures, significant
work has to be done to both be able to pass around the new callback and
maintain a sane architecture that avoids code duplication.
This patch only implements the callback change for SUCCESSFUL commits.
CommitFailedNavigation will be handled in a second patch.
The architecture should be the exact same, this is simply to keep test
failures to a manageable level while debugging/landing.
Note: This patch is fully behind the PerNavigationMojoInterface flag.
Please see
https://chromium-review.googlesource.com/c/chromium/src/+/1344107/
for the trybot runs with the PerNavigationMojoInterface flag on.
Please see
https://docs.google.com/document/d/1mXjxYJptb_bZ_EqGMF-c4LTSnhjt6Gn_WVvSrsinpq8/edit
for the design doc.
Bug: 784904
Change-Id: I9efdd25bfd289a2e76c5bf43e32e2dc0c589ad25
Reviewed-on: https://chromium-review.googlesource.com/c/1344091
Commit-Queue: Arthur Hemery <[email protected]>
Reviewed-by: Nasko Oskov <[email protected]>
Cr-Commit-Position: refs/heads/master@{#627978}
diff --git a/content/renderer/render_frame_impl.h b/content/renderer/render_frame_impl.h
index 20bc4c9..381d964 100644
--- a/content/renderer/render_frame_impl.h
+++ b/content/renderer/render_frame_impl.h
@@ -562,21 +562,44 @@
const CommonNavigationParams& common_params,
const CommitNavigationParams& commit_params,
network::mojom::URLLoaderClientEndpointsPtr url_loader_client_endpoints,
- std::unique_ptr<blink::URLLoaderFactoryBundleInfo> subresource_loaders,
+ std::unique_ptr<blink::URLLoaderFactoryBundleInfo>
+ subresource_loader_factories,
base::Optional<std::vector<mojom::TransferrableURLLoaderPtr>>
subresource_overrides,
blink::mojom::ControllerServiceWorkerInfoPtr
controller_service_worker_info,
network::mojom::URLLoaderFactoryPtr prefetch_loader_factory,
const base::UnguessableToken& devtools_navigation_token,
- CommitNavigationCallback callback) override;
+ mojom::FrameNavigationControl::CommitNavigationCallback commit_callback)
+ override;
+
+ // This is the version to be used with PerNavigationMojoInterface enabled.
+ // It essentially works the same way, except the navigation callback is
+ // the one from NavigationClient mojo interface.
+ void CommitPerNavigationMojoInterfaceNavigation(
+ const network::ResourceResponseHead& head,
+ const CommonNavigationParams& common_params,
+ const CommitNavigationParams& commit_params,
+ network::mojom::URLLoaderClientEndpointsPtr url_loader_client_endpoints,
+ std::unique_ptr<blink::URLLoaderFactoryBundleInfo>
+ subresource_loader_factories,
+ base::Optional<std::vector<mojom::TransferrableURLLoaderPtr>>
+ subresource_overrides,
+ blink::mojom::ControllerServiceWorkerInfoPtr
+ controller_service_worker_info,
+ network::mojom::URLLoaderFactoryPtr prefetch_loader_factory,
+ const base::UnguessableToken& devtools_navigation_token,
+ mojom::NavigationClient::CommitNavigationCallback
+ per_navigation_mojo_interface_callback);
+
void CommitFailedNavigation(
const CommonNavigationParams& common_params,
const CommitNavigationParams& commit_params,
bool has_stale_copy_in_cache,
int error_code,
const base::Optional<std::string>& error_page_content,
- std::unique_ptr<blink::URLLoaderFactoryBundleInfo> subresource_loaders,
+ std::unique_ptr<blink::URLLoaderFactoryBundleInfo>
+ subresource_loader_factories,
CommitFailedNavigationCallback callback) override;
void CommitSameDocumentNavigation(
const CommonNavigationParams& common_params,
@@ -584,8 +607,8 @@
CommitSameDocumentNavigationCallback callback) override;
void HandleRendererDebugURL(const GURL& url) override;
void UpdateSubresourceLoaderFactories(
- std::unique_ptr<blink::URLLoaderFactoryBundleInfo> subresource_loaders)
- override;
+ std::unique_ptr<blink::URLLoaderFactoryBundleInfo>
+ subresource_loader_factories) override;
void BindDevToolsAgent(
blink::mojom::DevToolsAgentHostAssociatedPtrInfo host,
blink::mojom::DevToolsAgentAssociatedRequest request) override;
@@ -1327,6 +1350,25 @@
blink::mojom::ControllerServiceWorkerInfoPtr
controller_service_worker_info);
+ // This function avoid duplication between CommitNavigation and
+ // CommitPerNavigationMojoInterfaceNavigation.
+ void CommitNavigationInternal(
+ const network::ResourceResponseHead& head,
+ const CommonNavigationParams& common_params,
+ const CommitNavigationParams& commit_params,
+ network::mojom::URLLoaderClientEndpointsPtr url_loader_client_endpoints,
+ std::unique_ptr<blink::URLLoaderFactoryBundleInfo>
+ subresource_loader_factories,
+ base::Optional<std::vector<mojom::TransferrableURLLoaderPtr>>
+ subresource_overrides,
+ blink::mojom::ControllerServiceWorkerInfoPtr
+ controller_service_worker_info,
+ network::mojom::URLLoaderFactoryPtr prefetch_loader_factory,
+ const base::UnguessableToken& devtools_navigation_token,
+ mojom::FrameNavigationControl::CommitNavigationCallback callback,
+ mojom::NavigationClient::CommitNavigationCallback
+ per_navigation_mojo_interface_callback);
+
// Stores the WebLocalFrame we are associated with. This is null from the
// constructor until BindToFrame() is called, and it is null after
// FrameDetached() is called until destruction (which is asynchronous in the