Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert arguments to V8 directly in EventEmitter::Emit #1009

Merged
merged 8 commits into from
Jan 16, 2015
Prev Previous commit
Next Next commit
Unpack the arguments in ipc message
  • Loading branch information
zcbenz committed Jan 15, 2015
commit 1a1cf57097c37ef91c9663185008cbf4b7b4b09c
6 changes: 4 additions & 2 deletions atom/browser/api/lib/web-contents.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,12 @@ module.exports.wrap = (webContents) ->
process.emit 'ATOM_BROWSER_RELEASE_RENDER_VIEW', "#{processId}-#{routingId}"

# Dispatch IPC messages to the ipc module.
webContents.on 'ipc-message', (event, channel, args...) ->
webContents.on 'ipc-message', (event, packed) ->
[channel, args...] = packed
Object.defineProperty event, 'sender', value: webContents
ipc.emit channel, event, args...
webContents.on 'ipc-message-sync', (event, channel, args...) ->
webContents.on 'ipc-message-sync', (event, packed) ->
[channel, args...] = packed
Object.defineProperty event, 'returnValue', set: (value) -> event.sendReply JSON.stringify(value)
Object.defineProperty event, 'sender', value: webContents
ipc.emit channel, event, args...
Expand Down