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

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

Issue 791323003: - Allow implementations to hook into the Utf8Decoder.convert method. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 5 years, 11 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 | « no previous file | sdk/lib/_internal/compiler/js_lib/convert_patch.dart » ('j') | 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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 import "dart:_internal" show POWERS_OF_TEN; 5 import "dart:_internal" show POWERS_OF_TEN;
6 6
7 // JSON conversion. 7 // JSON conversion.
8 8
9 patch _parseJson(String json, reviver(var key, var value)) { 9 patch _parseJson(String json, reviver(var key, var value)) {
10 _BuildJsonListener listener; 10 _BuildJsonListener listener;
(...skipping 12 matching lines...) Expand all
23 23
24 patch class Utf8Decoder { 24 patch class Utf8Decoder {
25 /* patch */ 25 /* patch */
26 Converter<List<int>, dynamic> fuse(Converter<String, dynamic> next) { 26 Converter<List<int>, dynamic> fuse(Converter<String, dynamic> next) {
27 if (next is JsonDecoder) { 27 if (next is JsonDecoder) {
28 return new _JsonUtf8Decoder(next._reviver, this._allowMalformed); 28 return new _JsonUtf8Decoder(next._reviver, this._allowMalformed);
29 } 29 }
30 // TODO(lrn): Recognize a fused decoder where the next step is JsonDecoder. 30 // TODO(lrn): Recognize a fused decoder where the next step is JsonDecoder.
31 return super.fuse(next); 31 return super.fuse(next);
32 } 32 }
33
34 // Allow intercepting of UTF8 decoding when builtin lists are passed.
35 /* patch */
36 static String _convertIntercepted(
37 bool allowMalformed, List<int> codeUnits, int start, int end) {
38 return null; // This call was not intercepted.
39 }
33 } 40 }
34 41
35 class _JsonUtf8Decoder extends Converter<List<int>, Object> { 42 class _JsonUtf8Decoder extends Converter<List<int>, Object> {
36 final _Reviver _reviver; 43 final _Reviver _reviver;
37 final bool _allowMalformed; 44 final bool _allowMalformed;
38 45
39 _JsonUtf8Decoder(this._reviver, this._allowMalformed); 46 _JsonUtf8Decoder(this._reviver, this._allowMalformed);
40 47
41 dynamic convert(List<int> input) { 48 dynamic convert(List<int> input) {
42 var parser = _JsonUtf8DecoderSink._createParser(_reviver, _allowMalformed); 49 var parser = _JsonUtf8DecoderSink._createParser(_reviver, _allowMalformed);
(...skipping 1711 matching lines...) Expand 10 before | Expand all | Expand 10 after
1754 _parser.parse(start); 1761 _parser.parse(start);
1755 } 1762 }
1756 1763
1757 void close() { 1764 void close() {
1758 _parser.close(); 1765 _parser.close();
1759 var decoded = _parser.result; 1766 var decoded = _parser.result;
1760 _sink.add(decoded); 1767 _sink.add(decoded);
1761 _sink.close(); 1768 _sink.close();
1762 } 1769 }
1763 } 1770 }
OLDNEW
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/js_lib/convert_patch.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698