@stores[key] = new ObjectsStore unless @stores[key]?
@stores[key]
+ @releaseForRenderView: (processId, routingId) ->
+ key = "#{processId}_#{routingId}"
+ delete @stores[key]
+
# Objects in weak map will be not referenced (so we won't leak memory), and
# every object created in browser will have a unique id in weak map.
objectsWeakMap = new IDWeakMap
exports.remove = (processId, routingId, storeId) ->
ObjectsStore.forRenderView(processId, routingId).remove storeId
+
+exports.clear = (processId, routingId) ->
+ ObjectsStore.releaseForRenderView processId, routingId
catch e
event.result = type: 'error', value: e.message
+ipc.on 'ATOM_BROWSER_RELEASE_RENDER_VIEW', (event, processId, routingId) ->
+ objectsRegistry.clear processId, routingId
+
ipc.on 'ATOM_BROWSER_CURRENT_WINDOW', (event, processId, routingId) ->
try
windows = objectsRegistry.getAllWindows()
ret
+# Release all resources of current render view when it's going to be unloaded.
+window.addEventListener 'unload', (event) ->
+ ipc.sendChannelSync 'ATOM_BROWSER_RELEASE_RENDER_VIEW'
+
# Get remote module.
exports.require = (module) ->
meta = ipc.sendChannelSync 'ATOM_BROWSER_REQUIRE', module