mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
Tell browser to release remote object when the object is GCed.
This commit is contained in:
@@ -62,3 +62,6 @@ ipc.on 'ATOM_INTERNAL_MEMBER_GET', (event, process_id, routing_id, id, name) ->
|
||||
event.result = new PlainObject(objectsRegistry.get(id)[name])
|
||||
catch e
|
||||
event.result = type: 'error', value: e.message
|
||||
|
||||
ipc.on 'ATOM_INTERNAL_DESTROY', (process_id, routing_id, id) ->
|
||||
objectsRegistry.remove id
|
||||
|
||||
@@ -45,8 +45,14 @@ generateFromPainObject = (plain) ->
|
||||
ret = ipc.sendChannelSync 'ATOM_INTERNAL_MEMBER_GET', plain.id, member.name
|
||||
generateFromPainObject ret
|
||||
|
||||
# Track delegate object's life time, and tell the browser to clean up
|
||||
# when the object is GCed.
|
||||
v8_util.setDestructor ret, ->
|
||||
ipc.sendChannel 'ATOM_INTERNAL_DESTROY', plain.id
|
||||
|
||||
ret
|
||||
|
||||
# Get remote module.
|
||||
exports.require = (module) ->
|
||||
plain = ipc.sendChannelSync 'ATOM_INTERNAL_REQUIRE', module
|
||||
generateFromPainObject plain
|
||||
|
||||
Reference in New Issue
Block a user