Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(34)

Side by Side Diff: runtime/lib/string_buffer_patch.dart

Issue 333583003: VM: Remove explicit field initialization with null from library classes. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/lib/collection_patch.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 /**
11 * When strings are written to the string buffer, we add them to a 11 * When strings are written to the string buffer, we add them to a
12 * list of string parts. 12 * list of string parts.
13 */ 13 */
14 List<String> _parts = null; 14 List<String> _parts;
15 15
16 /** 16 /**
17 * Total number of code units in the string parts. Does not include 17 * Total number of code units in the string parts. Does not include
18 * the code units added to the buffer. 18 * the code units added to the buffer.
19 */ 19 */
20 int _partsCodeUnits = 0; 20 int _partsCodeUnits = 0;
21 21
22 /** 22 /**
23 * To preserve memory, we sometimes compact the parts. This combines 23 * To preserve memory, we sometimes compact the parts. This combines
24 * several smaller parts into a single larger part to cut down on the 24 * several smaller parts into a single larger part to cut down on the
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 31
32 /** 32 /**
33 * The buffer is used to build up a string from code units. It is 33 * The buffer is used to build up a string from code units. It is
34 * used when writing short strings or individual char codes to the 34 * used when writing short strings or individual char codes to the
35 * buffer. The buffer is allocated on demand. 35 * buffer. The buffer is allocated on demand.
36 */ 36 */
37 Uint16List _buffer = null; 37 Uint16List _buffer;
38 int _bufferPosition = 0; 38 int _bufferPosition = 0;
39 39
40 /** 40 /**
41 * Collects the approximate maximal magnitude of the code units added 41 * Collects the approximate maximal magnitude of the code units added
42 * to the buffer. 42 * to the buffer.
43 * 43 *
44 * The value of each added code unit is or'ed with this variable, so the 44 * The value of each added code unit is or'ed with this variable, so the
45 * most significant bit set in any code unit is also set in this value. 45 * most significant bit set in any code unit is also set in this value.
46 * If below 256, the string in the buffer is a Latin-1 string. 46 * If below 256, the string in the buffer is a Latin-1 string.
47 */ 47 */
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 _partsCodeUnitsSinceCompaction = 0; 164 _partsCodeUnitsSinceCompaction = 0;
165 _partsCompactionIndex = _parts.length; 165 _partsCompactionIndex = _parts.length;
166 } 166 }
167 167
168 /** 168 /**
169 * Create a [String] from the UFT-16 code units in buffer. 169 * Create a [String] from the UFT-16 code units in buffer.
170 */ 170 */
171 static String _create(Uint16List buffer, int length, bool isLatin1) 171 static String _create(Uint16List buffer, int length, bool isLatin1)
172 native "StringBuffer_createStringFromUint16Array"; 172 native "StringBuffer_createStringFromUint16Array";
173 } 173 }
OLDNEW
« no previous file with comments | « runtime/lib/collection_patch.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698