Tell browser to release remote object when the object is GCed.

This commit is contained in:
Cheng Zhao 2013-04-25 19:26:31 +08:00
parent cc37431a1f
commit 3f6f2f4bea
2 changed files with 9 additions and 0 deletions

View file

@ -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