From c6634b1ea5554f72d577a0bb89e24ddeabf38622 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Wed, 16 Dec 2015 22:38:04 +0800 Subject: [PATCH] Don't pump message loop when sending sync msg 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 | 2 -- atom/renderer/api/lib/ipc-renderer.coffee | 6 ------ 2 files changed, 8 deletions(-) diff --git a/atom/renderer/api/atom_api_renderer_ipc.cc b/atom/renderer/api/atom_api_renderer_ipc.cc index 061293e8..a82562f9 100644 --- a/atom/renderer/api/atom_api_renderer_ipc.cc +++ b/atom/renderer/api/atom_api_renderer_ipc.cc @@ -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) diff --git a/atom/renderer/api/lib/ipc-renderer.coffee b/atom/renderer/api/lib/ipc-renderer.coffee index 92be75aa..0dd629e5 100644 --- a/atom/renderer/api/lib/ipc-renderer.coffee +++ b/atom/renderer/api/lib/ipc-renderer.coffee @@ -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...] -- 2.43.0