]> khamidou — GitHub mirrors - electron.git/commitdiff
Fork renderer process for webview
authorCheng Zhao <zcbenz@gmail.com>
Mon, 31 Aug 2015 13:38:18 +0000 (21:38 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Mon, 31 Aug 2015 13:38:18 +0000 (21:38 +0800)
Previously it was disabled because Chrome doesn't support swapping
renderer process before, it seeems to work fine now, so we enable it to
see how it goes.

atom/renderer/atom_renderer_client.cc
atom/renderer/lib/init.coffee

index 86c9eb1cdeb6acd24ed50c87057f7678ad17f800..21ced4aedb864083fb1b9428b5a4d8588d4cecad 100644 (file)
@@ -52,10 +52,6 @@ bool IsSwitchEnabled(base::CommandLine* command_line,
   return true;
 }
 
-bool IsGuestFrame(blink::WebFrame* frame) {
-  return frame->uniqueName().utf8() == "ATOM_SHELL_GUEST_WEB_VIEW";
-}
-
 // global.Uint8Array;
 v8::Local<v8::Function> GetUint8ArrayConstructor(
     v8::Isolate* isolate, v8::Local<v8::Context> context) {
@@ -189,14 +185,11 @@ bool AtomRendererClient::OverrideCreatePlugin(
 void AtomRendererClient::DidCreateScriptContext(
     blink::WebFrame* frame,
     v8::Handle<v8::Context> context) {
-  // Only attach node bindings in main frame or guest frame.
-  if (!IsGuestFrame(frame)) {
-    if (main_frame_)
-      return;
+  if (main_frame_)
+    return;
 
-    // The first web frame is the main frame.
-    main_frame_ = frame;
-  }
+  // The first web frame is the main frame.
+  main_frame_ = frame;
 
   // Give the node loop a run to make sure everything is ready.
   node_bindings_->RunMessageLoop();
@@ -221,10 +214,6 @@ bool AtomRendererClient::ShouldFork(blink::WebFrame* frame,
                                     bool is_initial_navigation,
                                     bool is_server_redirect,
                                     bool* send_referrer) {
-  // Never fork renderer process for guests.
-  if (IsGuestFrame(frame))
-    return false;
-
   // Handle all the navigations and reloads in browser.
   // FIXME We only support GET here because http method will be ignored when
   // the OpenURLFromTab is triggered, which means form posting would not work,
index 32d3ee76d1b90e7d631c74e575e2b5e1cd5b7c79..9825f75be92826d58c021b95e9d2556ff3c17757 100644 (file)
@@ -29,8 +29,6 @@ for arg in process.argv
   if arg.indexOf('--guest-instance-id=') == 0
     # This is a guest web view.
     process.guestInstanceId = parseInt arg.substr(arg.indexOf('=') + 1)
-    # Set the frame name to make AtomRendererClient recognize this guest.
-    require('web-frame').setName 'ATOM_SHELL_GUEST_WEB_VIEW'
   else if arg.indexOf('--node-integration=') == 0
     nodeIntegration = arg.substr arg.indexOf('=') + 1
   else if arg.indexOf('--preload=') == 0