OLD | NEW |
1 /* | 1 /* |
2 * This file is part of Adblock Plus <https://adblockplus.org/>, | 2 * This file is part of Adblock Plus <https://adblockplus.org/>, |
3 * Copyright (C) 2006-2015 Eyeo GmbH | 3 * Copyright (C) 2006-2015 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 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 get typeInfo() | 71 get typeInfo() |
72 { | 72 { |
73 let typeId = this.typeId | 0; | 73 let typeId = this.typeId | 0; |
74 if (this.typeId >= 0) | 74 if (this.typeId >= 0) |
75 return this.types[this.typeId]; | 75 return this.types[this.typeId]; |
76 else | 76 else |
77 return null; | 77 return null; |
78 }, | 78 }, |
79 bufferIndex: -1, | 79 bufferIndex: -1, |
80 byteOffset: 0 | 80 byteOffset: 0 |
81 } | 81 }; |
82 Reference.byteLength = calculateSize(Reference_properties); | 82 Reference.byteLength = calculateSize(Reference_properties); |
83 Reference.viewTypes = Object.freeze(getViewTypes(Reference_properties)); | 83 Reference.viewTypes = Object.freeze(getViewTypes(Reference_properties)); |
84 exports.Reference = Reference; | 84 exports.Reference = Reference; |
85 | 85 |
86 /** | 86 /** |
87 * Helper class to read/write references to a fixed type, this is useful for | 87 * Helper class to read/write references to a fixed type, this is useful for |
88 * references to free buffer elements. bufferIndex and byteOffset properites | 88 * references to free buffer elements. bufferIndex and byteOffset properites |
89 * of the reference need to be set in order to use it. | 89 * of the reference need to be set in order to use it. |
90 * | 90 * |
91 * @param typeInfo metadata of the type that this reference should be used for | 91 * @param typeInfo metadata of the type that this reference should be used for |
92 * @param views list of views corresponding to TypedReference.viewTypes | 92 * @param views list of views corresponding to TypedReference.viewTypes |
93 */ | 93 */ |
94 function TypedReference(typeInfo, views) | 94 function TypedReference(typeInfo, views) |
95 { | 95 { |
96 let result = Object.create(Reference.prototype, { | 96 let result = Object.create(Reference.prototype, { |
97 typeInfo: fixedPropertyDescriptor(typeInfo), | 97 typeInfo: fixedPropertyDescriptor(typeInfo), |
98 }); | 98 }); |
99 defineProperties(result, TypedReference_properties, TypedReference.viewTypes,
views, 0); | 99 defineProperties(result, TypedReference_properties, TypedReference.viewTypes,
views, 0); |
100 return result; | 100 return result; |
101 } | 101 } |
102 TypedReference.byteLength = calculateSize(TypedReference_properties); | 102 TypedReference.byteLength = calculateSize(TypedReference_properties); |
103 TypedReference.viewTypes = Object.freeze(getViewTypes(TypedReference_properties)
); | 103 TypedReference.viewTypes = Object.freeze(getViewTypes(TypedReference_properties)
); |
104 exports.TypedReference = TypedReference; | 104 exports.TypedReference = TypedReference; |
OLD | NEW |