| OLD | NEW | 
|    1 /* |    1 /* | 
|    2  * This file is part of Adblock Plus <http://adblockplus.org/>, |    2  * This file is part of Adblock Plus <http://adblockplus.org/>, | 
|    3  * Copyright (C) 2006-2014 Eyeo GmbH |    3  * Copyright (C) 2006-2014 Eyeo GmbH | 
|    4  * |    4  * | 
|    5  * Adblock Plus is free software: you can redistribute it and/or modify |    5  * Adblock Plus is free software: you can redistribute it and/or modify | 
|    6  * it under the terms of the GNU General Public License version 3 as |    6  * it under the terms of the GNU General Public License version 3 as | 
|    7  * published by the Free Software Foundation. |    7  * published by the Free Software Foundation. | 
|    8  * |    8  * | 
|    9  * Adblock Plus is distributed in the hope that it will be useful, |    9  * Adblock Plus is distributed in the hope that it will be useful, | 
|   10  * but WITHOUT ANY WARRANTY; without even the implied warranty of |   10  * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
|   11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the |   11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
|   12  * GNU General Public License for more details. |   12  * GNU General Public License for more details. | 
|   13  * |   13  * | 
|   14  * You should have received a copy of the GNU General Public License |   14  * You should have received a copy of the GNU General Public License | 
|   15  * along with Adblock Plus.  If not, see <http://www.gnu.org/licenses/>. |   15  * along with Adblock Plus.  If not, see <http://www.gnu.org/licenses/>. | 
|   16  */ |   16  */ | 
|   17  |   17  | 
|   18 "use strict"; |   18 "use strict"; | 
|   19  |   19  | 
|   20 let {fixedPropertyDescriptor, getViewsForType, defineProperties, alloc, dealloc}
      = require("typedObjects/utils"); |   20 let {fixedPropertyDescriptor, getViewsForType, defineProperties, alloc, dealloc}
      = require("typedObjects/utils"); | 
|   21 let {Reference, TypedReference} = require("typedObjects/references"); |   21 let {Reference, TypedReference} = require("typedObjects/references"); | 
|   22 let {uint8, uint32} = require("typedObjects/primitiveTypes"); |   22 let {uint8, uint32} = require("typedObjects/primitiveTypes"); | 
|   23 let {createArrayType} = require("typedObjects/arrayTypes"); |   23 let {createArrayType} = require("typedObjects/arrayTypes"); | 
 |   24 let {createDictionaryType} = require("typedObjects/dictionaryTypes"); | 
|   24  |   25  | 
|   25 const STATE_UNINITIALIZED = exports.STATE_UNINITIALIZED = 0; |   26 const STATE_UNINITIALIZED = exports.STATE_UNINITIALIZED = 0; | 
|   26 const STATE_CREATED = exports.STATE_CREATED = 1; |   27 const STATE_CREATED = exports.STATE_CREATED = 1; | 
|   27 const STATE_RELEASING = exports.STATE_RELEASING = 2; |   28 const STATE_RELEASING = exports.STATE_RELEASING = 2; | 
|   28  |   29  | 
|   29 /** |   30 /** | 
|   30  * List of registered types (typeId is the index in that array). |   31  * List of registered types (typeId is the index in that array). | 
|   31  */ |   32  */ | 
|   32 let types = []; |   33 let types = []; | 
|   33  |   34  | 
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  271     byteLength: fixedPropertyDescriptor(byteLength), |  272     byteLength: fixedPropertyDescriptor(byteLength), | 
|  272  |  273  | 
|  273     referenceLength: fixedPropertyDescriptor(Reference.byteLength), |  274     referenceLength: fixedPropertyDescriptor(Reference.byteLength), | 
|  274     viewTypes: fixedPropertyDescriptor(Reference.viewTypes), |  275     viewTypes: fixedPropertyDescriptor(Reference.viewTypes), | 
|  275     initialValue: fixedPropertyDescriptor(null), |  276     initialValue: fixedPropertyDescriptor(null), | 
|  276  |  277  | 
|  277     typeId: fixedPropertyDescriptor(typeId), |  278     typeId: fixedPropertyDescriptor(typeId), | 
|  278     extend: fixedPropertyDescriptor(extend.bind(null, typeInfo)), |  279     extend: fixedPropertyDescriptor(extend.bind(null, typeInfo)), | 
|  279     isInstance: fixedPropertyDescriptor(isInstance.bind(null, typeId)), |  280     isInstance: fixedPropertyDescriptor(isInstance.bind(null, typeId)), | 
|  280     Array: fixedPropertyDescriptor(createArrayType.bind(null, result)), |  281     Array: fixedPropertyDescriptor(createArrayType.bind(null, result)), | 
 |  282     Dictionary: fixedPropertyDescriptor(createDictionaryType.bind(null, result))
     , | 
|  281  |  283  | 
|  282     createGetter: fixedPropertyDescriptor(createGetter), |  284     createGetter: fixedPropertyDescriptor(createGetter), | 
|  283     createSetter: fixedPropertyDescriptor(createSetter.bind(null, typeId)) |  285     createSetter: fixedPropertyDescriptor(createSetter.bind(null, typeId)) | 
|  284   }); |  286   }); | 
|  285   types.push(typeInfo); |  287   types.push(typeInfo); | 
|  286   return result; |  288   return result; | 
|  287 } |  289 } | 
|  288  |  290  | 
|  289 function isInstance(typeId, obj) |  291 function isInstance(typeId, obj) | 
|  290 { |  292 { | 
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  323     this._refCount--; |  325     this._refCount--; | 
|  324     if (this._refCount == 0 && this._state < STATE_RELEASING) |  326     if (this._refCount == 0 && this._state < STATE_RELEASING) | 
|  325     { |  327     { | 
|  326       this._state = STATE_RELEASING; |  328       this._state = STATE_RELEASING; | 
|  327       free.call(types[this.typeId | 0], this); |  329       free.call(types[this.typeId | 0], this); | 
|  328     } |  330     } | 
|  329   } |  331   } | 
|  330 }, null); |  332 }, null); | 
|  331  |  333  | 
|  332 exports.ObjectType = ObjectBase.extend; |  334 exports.ObjectType = ObjectBase.extend; | 
| OLD | NEW |