Ensure calling webview.send will not block the renderer
When the browser process is busy, calling webview.send (a method that appears on its face to be non-blocking) will actually block, because most webview methods are remoted to a guest view instance in the browser. Instead, define a few methods which will instead send its call over an async IPC message.
This commit is contained in:
parent
bf5e9e4f4d
commit
789380dfad
2 changed files with 25 additions and 7 deletions
|
@ -221,3 +221,11 @@ ipcMain.on 'ATOM_BROWSER_GUEST_WEB_CONTENTS', (event, guestInstanceId) ->
|
|||
|
||||
ipcMain.on 'ATOM_BROWSER_LIST_MODULES', (event) ->
|
||||
event.returnValue = (name for name of electron)
|
||||
|
||||
ipcMain.on 'ATOM_BROWSER_ASYNC_CALL_TO_GUEST_VIEW', (event, guestInstanceId, method, args...) ->
|
||||
try
|
||||
guestViewManager = require './guest-view-manager'
|
||||
guest = guestViewManager.getGuest(guestInstanceId)
|
||||
guest[method].apply(guest, args)
|
||||
catch e
|
||||
event.returnValue = exceptionToMeta e
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue