Add a WebContents API for initializing the renderer without navigating
I added prepare_renderer flag in WebContents::CreateParams.
So now we can create WebContents with renderer process and RenderFrame
without navigation to about:blank or something like that.
It is need to avoid hack with navigation and to save resources.
BUG=521729
[email protected], [email protected]
Review-Url: https://codereview.chromium.org/1970253002
Cr-Commit-Position: refs/heads/master@{#395413}
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index 33f0093..13947aab1 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -1584,6 +1584,13 @@
GetRenderManager()->current_frame_host()->SetRenderFrameCreated(true);
}
+ // Create the renderer process in advance if requested.
+ if (params.initialize_renderer) {
+ if (!GetRenderManager()->current_frame_host()->IsRenderFrameLive()) {
+ GetRenderManager()->InitRenderView(GetRenderViewHost(), nullptr);
+ }
+ }
+
// Ensure that observers are notified of the creation of this WebContents's
// main RenderFrameHost. It must be done here for main frames, since the
// NotifySwappedFromRenderManager expects view_ to already be created and that