| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 patch class StringBuffer { | 5 patch class StringBuffer { |
| 6 static const int _BUFFER_SIZE = 64; | 6 static const int _BUFFER_SIZE = 64; |
| 7 static const int _PARTS_TO_COMPACT = 128; | 7 static const int _PARTS_TO_COMPACT = 128; |
| 8 static const int _PARTS_TO_COMPACT_SIZE_LIMIT = _PARTS_TO_COMPACT * 8; | 8 static const int _PARTS_TO_COMPACT_SIZE_LIMIT = _PARTS_TO_COMPACT * 8; |
| 9 | 9 |
| 10 /** | 10 /** |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 * cost that comes from the per-object memory overhead. We keep track | 25 * cost that comes from the per-object memory overhead. We keep track |
| 26 * of the last index where we ended our compaction and the number of | 26 * of the last index where we ended our compaction and the number of |
| 27 * code units added since the last compaction. | 27 * code units added since the last compaction. |
| 28 */ | 28 */ |
| 29 int _partsCompactionIndex = 0; | 29 int _partsCompactionIndex = 0; |
| 30 int _partsCodeUnitsSinceCompaction = 0; | 30 int _partsCodeUnitsSinceCompaction = 0; |
| 31 _ObjectArray _partsCompactionArray = null; | 31 _ObjectArray _partsCompactionArray = null; |
| 32 | 32 |
| 33 /** | 33 /** |
| 34 * The buffer is used to build up a string from code units. It is | 34 * The buffer is used to build up a string from code units. It is |
| 35 * used when writing short strings or individul char codes to the | 35 * used when writing short strings or individual char codes to the |
| 36 * buffer. The buffer is allocated on demand. | 36 * buffer. The buffer is allocated on demand. |
| 37 */ | 37 */ |
| 38 Uint16List _buffer = null; | 38 Uint16List _buffer = null; |
| 39 int _bufferPosition = 0; | 39 int _bufferPosition = 0; |
| 40 | 40 |
| 41 /** | 41 /** |
| 42 * Collects the approximate maximal magnitude of the code units added | 42 * Collects the approximate maximal magnitude of the code units added |
| 43 * to the buffer. | 43 * to the buffer. |
| 44 * | 44 * |
| 45 * The value of each added code unit is or'ed with this variable, so the | 45 * The value of each added code unit is or'ed with this variable, so the |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 _partsCodeUnitsSinceCompaction = 0; | 176 _partsCodeUnitsSinceCompaction = 0; |
| 177 _partsCompactionIndex = _parts.length; | 177 _partsCompactionIndex = _parts.length; |
| 178 } | 178 } |
| 179 | 179 |
| 180 /** | 180 /** |
| 181 * Create a [String] from the UFT-16 code units in buffer. | 181 * Create a [String] from the UFT-16 code units in buffer. |
| 182 */ | 182 */ |
| 183 static String _create(Uint16List buffer, int length, bool isLatin1) | 183 static String _create(Uint16List buffer, int length, bool isLatin1) |
| 184 native "StringBuffer_createStringFromUint16Array"; | 184 native "StringBuffer_createStringFromUint16Array"; |
| 185 } | 185 } |
| OLD | NEW |