Remove the useless remote.getObject API.
authorCheng Zhao <zcbenz@gmail.com>
Mon, 29 Jul 2013 08:35:25 +0000 (16:35 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Mon, 29 Jul 2013 08:35:25 +0000 (16:35 +0800)
browser/atom/objects-registry.coffee
browser/atom/rpc-server.coffee
renderer/api/lib/remote.coffee

index 5f4ce62..c600931 100644 (file)
@@ -6,7 +6,7 @@ class ObjectsStore
   @stores = {}
 
   constructor: ->
-    @nextId = 1
+    @nextId = 0
     @objects = []
 
   getNextId: ->
@@ -48,13 +48,7 @@ objectsWeakMap.add = (obj) ->
 windowsWeakMap = new IDWeakMap
 
 process.on 'ATOM_BROWSER_INTERNAL_NEW', (obj) ->
-  # It's possible that user created a object in browser side and then want to
-  # 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.
+  # Remember all windows.
   if obj.constructor is BrowserWindow
     id = windowsWeakMap.add obj
     obj.on 'destroyed', ->
index 2e0c9eb..879a80d 100644 (file)
@@ -116,12 +116,5 @@ ipc.on 'ATOM_BROWSER_MEMBER_GET', (event, processId, routingId, id, name) ->
   catch 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) ->
   objectsRegistry.remove processId, routingId, storeId
index b79c8d0..ae08d94 100644 (file)
@@ -96,11 +96,6 @@ exports.require = (module) ->
   meta = ipc.sendChannelSync 'ATOM_BROWSER_REQUIRE', module
   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.
 windowCache = null
 exports.getCurrentWindow = ->