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

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

Issue 649113005: Make JSON parsing work as a chunked conversion sink. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. Fix bug. Created 6 years, 2 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 | « sdk/lib/_internal/compiler/js_lib/convert_patch.dart ('k') | sdk/lib/internal/internal.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/convert/json.dart
diff --git a/sdk/lib/convert/json.dart b/sdk/lib/convert/json.dart
index 910b8cc4bb16af3df58490b71604a07dcea0ad81..4b7817fc390f7e3ee9bd3b7a3c983c7b26f9887f 100644
--- a/sdk/lib/convert/json.dart
+++ b/sdk/lib/convert/json.dart
@@ -326,39 +326,12 @@ class JsonDecoder extends Converter<String, Object> {
*
* The output [sink] receives exactly one decoded element through `add`.
*/
- StringConversionSink startChunkedConversion(Sink<Object> sink) {
- return new _JsonDecoderSink(_reviver, sink);
- }
+ external StringConversionSink startChunkedConversion(Sink<Object> sink);
// Override the base-classes bind, to provide a better type.
Stream<Object> bind(Stream<String> stream) => super.bind(stream);
}
-/**
- * Implements the chunked conversion from a JSON string to its corresponding
- * object.
- *
- * The sink only creates one object, but its input can be chunked.
- */
-// TODO(floitsch): don't accumulate everything before starting to decode.
-class _JsonDecoderSink extends _StringSinkConversionSink {
- final _Reviver _reviver;
- final Sink<Object> _sink;
-
- _JsonDecoderSink(this._reviver, this._sink)
- : super(new StringBuffer());
-
- void close() {
- super.close();
- StringBuffer buffer = _stringSink;
- String accumulated = buffer.toString();
- buffer.clear();
- Object decoded = _parseJson(accumulated, _reviver);
- _sink.add(decoded);
- _sink.close();
- }
-}
-
// Internal optimized JSON parsing implementation.
external _parseJson(String source, reviver(key, value));
« no previous file with comments | « sdk/lib/_internal/compiler/js_lib/convert_patch.dart ('k') | sdk/lib/internal/internal.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698