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

Unified Diff: sdk/lib/convert/string_conversion.dart

Issue 23361015: Make utf8 decoder non-buffered. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tests/lib/convert/chunked_conversion_utf89_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/convert/string_conversion.dart
diff --git a/sdk/lib/convert/string_conversion.dart b/sdk/lib/convert/string_conversion.dart
index ee0d135e53a17756f1d4b75fed141aa6bcaf7d6c..4a90cfaf37d92f16da2c37690385aa4e1546b266 100644
--- a/sdk/lib/convert/string_conversion.dart
+++ b/sdk/lib/convert/string_conversion.dart
@@ -299,7 +299,6 @@ class _Utf8StringSinkAdapter extends ByteConversionSink {
*/
// TODO(floitsch): make this class public?
class _Utf8ConversionSink extends ByteConversionSink {
- static const _MIN_STRING_SIZE = 16;
final _Utf8Decoder _decoder;
final StringConversionSink _chunkedSink;
@@ -327,10 +326,9 @@ class _Utf8ConversionSink extends ByteConversionSink {
addSlice(chunk, 0, chunk.length, false);
}
- void addSlice(List<int> chunk, int startIndex, int endIndex,
- bool isLast) {
+ void addSlice(List<int> chunk, int startIndex, int endIndex, bool isLast) {
_decoder.convert(chunk, startIndex, endIndex);
- if (_buffer.length > _MIN_STRING_SIZE) {
+ if (_buffer.isNotEmpty) {
String accumulated = _buffer.toString();
_chunkedSink.addSlice(accumulated, 0, accumulated.length, isLast);
_buffer.clear();
« no previous file with comments | « no previous file | tests/lib/convert/chunked_conversion_utf89_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698