]> khamidou — GitHub mirrors - electron.git/commitdiff
Don't pump message loop when sending sync msg
authorCheng Zhao <zcbenz@gmail.com>
Wed, 16 Dec 2015 14:38:04 +0000 (22:38 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Wed, 16 Dec 2015 14:38:04 +0000 (22:38 +0800)
In old days sending sync message to browser process requires pumping
message loop in the renderer process, but now in Chrome 47 it is not
true anymore. And even when we do it, the Send method may fail
sometimes, so this change seems to be required for the Chrome 47
upgrade.

atom/renderer/api/atom_api_renderer_ipc.cc
atom/renderer/api/lib/ipc-renderer.coffee

index 061293e80d037ed08c9321bcb57e19370b86790f..a82562f93614194343442d52921cc757fb400824 100644 (file)
@@ -54,8 +54,6 @@ base::string16 SendSync(mate::Arguments* args,
 
   IPC::SyncMessage* message = new AtomViewHostMsg_Message_Sync(
       render_view->GetRoutingID(), channel, arguments, &json);
-  // Enable the UI thread in browser to receive messages.
-  message->EnableMessagePumping();
   bool success = render_view->Send(message);
 
   if (!success)
index 92be75aa20ba8fe81551ef9044c2450dc3f2c82a..0dd629e54f7509d23b5973c9fe14f9af49af30e8 100644 (file)
@@ -6,12 +6,6 @@ v8Util  = process.atomBinding 'v8_util'
 # Created by init.coffee.
 ipcRenderer = v8Util.getHiddenValue global, 'ipc'
 
-# Delay the callback to next tick in case the browser is still in the middle
-# of sending a message while the callback sends a sync message to browser,
-# which can fail sometimes.
-ipcRenderer.emit = (args...) ->
-  setTimeout (-> EventEmitter::emit.call ipcRenderer, args...), 0
-
 ipcRenderer.send = (args...) ->
   binding.send 'ipc-message', [args...]