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

Side by Side Diff: sdk/lib/convert/utf.dart

Issue 689043002: Make JSON.fuse(UTF8) be more efficient by not creating intermediate string. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Better fusing of decoders. Created 6 years, 1 month 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
« sdk/lib/convert/json.dart ('K') | « sdk/lib/convert/json.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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 part of dart.convert; 5 part of dart.convert;
6 6
7 /** The Unicode Replacement character `U+FFFD` (�). */ 7 /** The Unicode Replacement character `U+FFFD` (�). */
8 const int UNICODE_REPLACEMENT_CHARACTER_RUNE = 0xFFFD; 8 const int UNICODE_REPLACEMENT_CHARACTER_RUNE = 0xFFFD;
9 9
10 /** The Unicode Byte Order Marker (BOM) character `U+FEFF`. */ 10 /** The Unicode Byte Order Marker (BOM) character `U+FEFF`. */
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 if (sink is StringConversionSink) { 335 if (sink is StringConversionSink) {
336 stringSink = sink; 336 stringSink = sink;
337 } else { 337 } else {
338 stringSink = new StringConversionSink.from(sink); 338 stringSink = new StringConversionSink.from(sink);
339 } 339 }
340 return stringSink.asUtf8Sink(_allowMalformed); 340 return stringSink.asUtf8Sink(_allowMalformed);
341 } 341 }
342 342
343 // Override the base-classes bind, to provide a better type. 343 // Override the base-classes bind, to provide a better type.
344 Stream<String> bind(Stream<List<int>> stream) => super.bind(stream); 344 Stream<String> bind(Stream<List<int>> stream) => super.bind(stream);
345
346 external Converter<List<int>,dynamic> fuse(Converter<String, dynamic> next);
345 } 347 }
346 348
347 // UTF-8 constants. 349 // UTF-8 constants.
348 const int _ONE_BYTE_LIMIT = 0x7f; // 7 bits 350 const int _ONE_BYTE_LIMIT = 0x7f; // 7 bits
349 const int _TWO_BYTE_LIMIT = 0x7ff; // 11 bits 351 const int _TWO_BYTE_LIMIT = 0x7ff; // 11 bits
350 const int _THREE_BYTE_LIMIT = 0xffff; // 16 bits 352 const int _THREE_BYTE_LIMIT = 0xffff; // 16 bits
351 const int _FOUR_BYTE_LIMIT = 0x10ffff; // 21 bits, truncated to Unicode max. 353 const int _FOUR_BYTE_LIMIT = 0x10ffff; // 21 bits, truncated to Unicode max.
352 354
353 // UTF-16 constants. 355 // UTF-16 constants.
354 const int _SURROGATE_MASK = 0xF800; 356 const int _SURROGATE_MASK = 0xF800;
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
536 } 538 }
537 break loop; 539 break loop;
538 } 540 }
539 if (expectedUnits > 0) { 541 if (expectedUnits > 0) {
540 _value = value; 542 _value = value;
541 _expectedUnits = expectedUnits; 543 _expectedUnits = expectedUnits;
542 _extraUnits = extraUnits; 544 _extraUnits = extraUnits;
543 } 545 }
544 } 546 }
545 } 547 }
OLDNEW
« sdk/lib/convert/json.dart ('K') | « sdk/lib/convert/json.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698