Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: lib/typedObjects/objectTypes.js

Issue 29323484: Issue 507 - Implement lightweight array.slice() method (Closed)
Patch Set: Small improvements Created Aug. 19, 2015, 12:14 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « lib/typedObjects/arrayTypes.js ('k') | test/tests/typedObjects.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 { 74 {
75 if (this.destructor) 75 if (this.destructor)
76 { 76 {
77 this.destructor.call(obj); 77 this.destructor.call(obj);
78 if (obj._refCount | 0) 78 if (obj._refCount | 0)
79 throw new Error("Reference count is no longer zero after calling the des tructor"); 79 throw new Error("Reference count is no longer zero after calling the des tructor");
80 } 80 }
81 } 81 }
82 finally 82 finally
83 { 83 {
84 for (let [prop, value] of this.initialValues) 84 if (obj._copy)
85 obj[prop] = value; 85 {
86 Object.getPrototypeOf(obj).release();
87 }
88 else
89 {
90 for (let [prop, value] of this.initialValues)
91 obj[prop] = value;
86 92
87 dealloc(this.firstFree, obj.bufferIndex, obj.byteOffset); 93 dealloc(this.firstFree, obj.bufferIndex, obj.byteOffset);
94 }
88 } 95 }
89 } 96 }
90 97
91 function createGetter(offset) 98 function createGetter(offset)
92 { 99 {
93 offset = offset | 0; 100 offset = offset | 0;
94 101
95 let views = Array.prototype.slice.call(arguments, 1); 102 let views = Array.prototype.slice.call(arguments, 1);
96 let reference = new Reference(types, views); 103 let reference = new Reference(types, views);
97 return function(bufferIndex, byteOffset) 104 return function(bufferIndex, byteOffset)
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 this._refCount--; 330 this._refCount--;
324 if (this._refCount == 0 && this._state < STATE_RELEASING) 331 if (this._refCount == 0 && this._state < STATE_RELEASING)
325 { 332 {
326 this._state = STATE_RELEASING; 333 this._state = STATE_RELEASING;
327 free.call(types[this.typeId | 0], this); 334 free.call(types[this.typeId | 0], this);
328 } 335 }
329 } 336 }
330 }, null); 337 }, null);
331 338
332 exports.ObjectType = ObjectBase.extend; 339 exports.ObjectType = ObjectBase.extend;
OLDNEW
« no previous file with comments | « lib/typedObjects/arrayTypes.js ('k') | test/tests/typedObjects.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld