Use a blink::RendererPreferences C++ struct for IPC messages
As a precursor to crrev.com/c/2412309, this CL adds a new C++ struct,
along with the relevant mojom traits for typemapping, that will now
be used for IPC between the browser and renderer processes instead
of directly using the blink.mojom.RendererPreferences mojo struct.
This is needed in order to migrate PageMsg_SetRendererPrefs to
Blink (see CL 2412309) since, even thought that message will now
be received and handled inside Blink itself, it's still necessary
to pass it back to //content/renderer as it's still needed in
several places such as RenderView and //content/renderer/loader,
and having the mojom struct only would cause trouble because we
can't simply pass a Blink variant of that struct into //content.
Having this C++ struct and its corresponding typemapping solves this
problem since Blink will no longer receive the Blink variant of the
mojo struct but just a blink::RendererPreferences, which can now be
passed to //content/renderer for as long as it's still needed.
Bug: 1102442
Change-Id: Id79fc6117c6b6a091644f41619aa6467550705cd
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2445499
Reviewed-by: Dave Tapuska <[email protected]>
Reviewed-by: Kentaro Hara <[email protected]>
Reviewed-by: Kinuko Yasuda <[email protected]>
Commit-Queue: Mario Sanchez Prada <[email protected]>
Cr-Commit-Position: refs/heads/master@{#819436}
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index 23d44183..604e15f1 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -2623,7 +2623,7 @@
void WebContentsImpl::SyncRendererPrefs() {
OPTIONAL_TRACE_EVENT0("content", "WebContentsImpl::SyncRendererPrefs");
- blink::mojom::RendererPreferences renderer_preferences = GetRendererPrefs();
+ blink::RendererPreferences renderer_preferences = GetRendererPrefs();
RenderViewHostImpl::GetPlatformSpecificPrefs(&renderer_preferences);
SendPageMessage(
new PageMsg_SetRendererPrefs(MSG_ROUTING_NONE, renderer_preferences));
@@ -4651,7 +4651,7 @@
return GetRenderViewHost()->contents_mime_type();
}
-blink::mojom::RendererPreferences* WebContentsImpl::GetMutableRendererPrefs() {
+blink::RendererPreferences* WebContentsImpl::GetMutableRendererPrefs() {
return &renderer_preferences_;
}
@@ -6749,7 +6749,7 @@
return render_view_host_delegate_view_;
}
-blink::mojom::RendererPreferences WebContentsImpl::GetRendererPrefs() const {
+const blink::RendererPreferences& WebContentsImpl::GetRendererPrefs() const {
return renderer_preferences_;
}