Remove the useless remote.getObject API.

This commit is contained in:
Cheng Zhao 2013-07-29 16:35:25 +08:00
parent e1ac21aa7a
commit cd19666307
3 changed files with 2 additions and 20 deletions

View file

@ -6,7 +6,7 @@ class ObjectsStore
@stores = {} @stores = {}
constructor: -> constructor: ->
@nextId = 1 @nextId = 0
@objects = [] @objects = []
getNextId: -> getNextId: ->
@ -48,13 +48,7 @@ objectsWeakMap.add = (obj) ->
windowsWeakMap = new IDWeakMap windowsWeakMap = new IDWeakMap
process.on 'ATOM_BROWSER_INTERNAL_NEW', (obj) -> process.on 'ATOM_BROWSER_INTERNAL_NEW', (obj) ->
# It's possible that user created a object in browser side and then want to # Remember all windows.
# get it in renderer via remote.getObject. So we must add every native object
# created in browser to the weak map even it may not be referenced by the
# renderer.
objectsWeakMap.add obj
# Also remember all windows.
if obj.constructor is BrowserWindow if obj.constructor is BrowserWindow
id = windowsWeakMap.add obj id = windowsWeakMap.add obj
obj.on 'destroyed', -> obj.on 'destroyed', ->

View file

@ -116,12 +116,5 @@ ipc.on 'ATOM_BROWSER_MEMBER_GET', (event, processId, routingId, id, name) ->
catch e catch e
event.result = errorToMeta e event.result = errorToMeta e
ipc.on 'ATOM_BROWSER_REFERENCE', (event, processId, routingId, id) ->
try
obj = objectsRegistry.get id
event.result = valueToMeta processId, routingId, obj
catch e
event.result = errorToMeta e
ipc.on 'ATOM_BROWSER_DEREFERENCE', (processId, routingId, storeId) -> ipc.on 'ATOM_BROWSER_DEREFERENCE', (processId, routingId, storeId) ->
objectsRegistry.remove processId, routingId, storeId objectsRegistry.remove processId, routingId, storeId

View file

@ -96,11 +96,6 @@ exports.require = (module) ->
meta = ipc.sendChannelSync 'ATOM_BROWSER_REQUIRE', module meta = ipc.sendChannelSync 'ATOM_BROWSER_REQUIRE', module
moduleCache[module] = metaToValue meta moduleCache[module] = metaToValue meta
# Get object with specified id.
exports.getObject = (id) ->
meta = ipc.sendChannelSync 'ATOM_BROWSER_REFERENCE', id
metaToValue meta
# Get current window object. # Get current window object.
windowCache = null windowCache = null
exports.getCurrentWindow = -> exports.getCurrentWindow = ->