refactor: implement ipcRenderer.sendTo in native code for better performance (#14285)

This commit is contained in:
Milan Burda 2018-08-24 23:14:39 +02:00 committed by Samuel Attard
parent e6e3ccfc50
commit c23e7fa101
7 changed files with 54 additions and 25 deletions

View file

@ -1019,6 +1019,7 @@ bool WebContents::OnMessageReceived(const IPC::Message& message,
IPC_MESSAGE_HANDLER(AtomFrameHostMsg_Message, OnRendererMessage)
IPC_MESSAGE_FORWARD_DELAY_REPLY(AtomFrameHostMsg_Message_Sync, &helper,
FrameDispatchHelper::OnRendererMessageSync)
IPC_MESSAGE_HANDLER(AtomFrameHostMsg_Message_To, OnRendererMessageTo)
IPC_MESSAGE_FORWARD_DELAY_REPLY(
AtomFrameHostMsg_SetTemporaryZoomLevel, &helper,
FrameDispatchHelper::OnSetTemporaryZoomLevel)
@ -2077,6 +2078,19 @@ void WebContents::OnRendererMessageSync(content::RenderFrameHost* frame_host,
EmitWithSender(channel, frame_host, message, args);
}
void WebContents::OnRendererMessageTo(content::RenderFrameHost* frame_host,
bool send_to_all,
int32_t web_contents_id,
const base::string16& channel,
const base::ListValue& args) {
auto* web_contents = mate::TrackableObject<WebContents>::FromWeakMapID(
isolate(), web_contents_id);
if (web_contents) {
web_contents->SendIPCMessage(send_to_all, channel, args);
}
}
// static
mate::Handle<WebContents> WebContents::CreateFrom(
v8::Isolate* isolate,