Use // for multi-line comments
This commit is contained in:
parent
f4af744519
commit
990dc30e8d
15 changed files with 65 additions and 138 deletions
|
@ -13,25 +13,17 @@ ObjectsRegistry = (function(superClass) {
|
|||
this.setMaxListeners(Number.MAX_VALUE);
|
||||
this.nextId = 0;
|
||||
|
||||
/*
|
||||
Stores all objects by ref-counting.
|
||||
(id) => {object, count}
|
||||
*/
|
||||
// Stores all objects by ref-counting.
|
||||
// (id) => {object, count}
|
||||
this.storage = {};
|
||||
|
||||
/*
|
||||
Stores the IDs of objects referenced by WebContents.
|
||||
(webContentsId) => {(id) => (count)}
|
||||
*/
|
||||
// Stores the IDs of objects referenced by WebContents.
|
||||
// (webContentsId) => {(id) => (count)}
|
||||
this.owners = {};
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Register a new object, the object would be kept referenced until you release
|
||||
it explicitly.
|
||||
*/
|
||||
|
||||
// Register a new object, the object would be kept referenced until you release
|
||||
// it explicitly.
|
||||
ObjectsRegistry.prototype.add = function(webContentsId, obj) {
|
||||
var base, base1, id;
|
||||
id = this.saveToStorage(obj);
|
||||
|
@ -51,7 +43,6 @@ ObjectsRegistry = (function(superClass) {
|
|||
|
||||
|
||||
// Get an object according to its ID.
|
||||
|
||||
ObjectsRegistry.prototype.get = function(id) {
|
||||
var ref;
|
||||
return (ref = this.storage[id]) != null ? ref.object : void 0;
|
||||
|
@ -59,7 +50,6 @@ ObjectsRegistry = (function(superClass) {
|
|||
|
||||
|
||||
// Dereference an object according to its ID.
|
||||
|
||||
ObjectsRegistry.prototype.remove = function(webContentsId, id) {
|
||||
var pointer;
|
||||
this.dereference(id, 1);
|
||||
|
@ -77,7 +67,6 @@ ObjectsRegistry = (function(superClass) {
|
|||
|
||||
|
||||
// Clear all references to objects refrenced by the WebContents.
|
||||
|
||||
ObjectsRegistry.prototype.clear = function(webContentsId) {
|
||||
var count, id, ref;
|
||||
this.emit("clear-" + webContentsId);
|
||||
|
@ -94,7 +83,6 @@ ObjectsRegistry = (function(superClass) {
|
|||
|
||||
|
||||
// Private: Saves the object into storage and assigns an ID for it.
|
||||
|
||||
ObjectsRegistry.prototype.saveToStorage = function(object) {
|
||||
var id;
|
||||
id = v8Util.getHiddenValue(object, 'atomId');
|
||||
|
@ -112,7 +100,6 @@ ObjectsRegistry = (function(superClass) {
|
|||
|
||||
|
||||
// Private: Dereference the object from store.
|
||||
|
||||
ObjectsRegistry.prototype.dereference = function(id, count) {
|
||||
var pointer;
|
||||
pointer = this.storage[id];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue