refactor: implement ipcRenderer.sendTo in native code for better performance (#14285)
This commit is contained in:
parent
e6e3ccfc50
commit
c23e7fa101
7 changed files with 54 additions and 25 deletions
|
@ -5,7 +5,7 @@ const {EventEmitter} = require('events')
|
|||
const fs = require('fs')
|
||||
const v8Util = process.atomBinding('v8_util')
|
||||
|
||||
const {ipcMain, isPromise, webContents} = electron
|
||||
const {ipcMain, isPromise} = electron
|
||||
|
||||
const objectsRegistry = require('./objects-registry')
|
||||
const bufferUtils = require('../common/buffer-utils')
|
||||
|
@ -417,20 +417,6 @@ ipcMain.on('ELECTRON_BROWSER_ASYNC_CALL_TO_GUEST_VIEW', function (event, context
|
|||
}
|
||||
})
|
||||
|
||||
ipcMain.on('ELECTRON_BROWSER_SEND_TO', function (event, sendToAll, webContentsId, channel, ...args) {
|
||||
let contents = webContents.fromId(webContentsId)
|
||||
if (!contents) {
|
||||
console.error(`Sending message to WebContents with unknown ID ${webContentsId}`)
|
||||
return
|
||||
}
|
||||
|
||||
if (sendToAll) {
|
||||
contents.sendToAll(channel, ...args)
|
||||
} else {
|
||||
contents.send(channel, ...args)
|
||||
}
|
||||
})
|
||||
|
||||
// Implements window.close()
|
||||
ipcMain.on('ELECTRON_BROWSER_WINDOW_CLOSE', function (event) {
|
||||
const window = event.sender.getOwnerBrowserWindow()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue