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

Side by Side Diff: sdk/lib/io/data_transformer.dart

Issue 14113017: Fixes. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 8 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/io/secure_socket.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) 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.io; 5 part of dart.io;
6 6
7 /** 7 /**
8 * Private helper-class to handle native filters. 8 * Private helper-class to handle native filters.
9 */ 9 */
10 abstract class _Filter { 10 abstract class _Filter {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 if (_closed) return; 44 if (_closed) return;
45 try { 45 try {
46 _empty = false; 46 _empty = false;
47 _filter.process(data); 47 _filter.process(data);
48 var out; 48 var out;
49 while ((out = _filter.processed(flush: false)) != null) { 49 while ((out = _filter.processed(flush: false)) != null) {
50 sink.add(out); 50 sink.add(out);
51 } 51 }
52 } catch (e, s) { 52 } catch (e, s) {
53 _closed = true; 53 _closed = true;
54 sink.addError(e, s); 54 // TODO(floitsch): we are losing the stack trace.
55 sink.addError(e);
55 sink.close(); 56 sink.close();
56 } 57 }
57 } 58 }
58 59
59 void handleDone(EventSink<List<int>> sink) { 60 void handleDone(EventSink<List<int>> sink) {
60 if (_closed) return; 61 if (_closed) return;
61 if (_empty) _filter.process(const []); 62 if (_empty) _filter.process(const []);
62 try { 63 try {
63 var out; 64 var out;
64 while ((out = _filter.processed()) != null) { 65 while ((out = _filter.processed()) != null) {
65 sink.add(out); 66 sink.add(out);
66 } 67 }
67 } catch (e, s) { 68 } catch (e, s) {
68 sink.addError(e, s); 69 // TODO(floitsch): we are losing the stack trace.
70 sink.addError(e);
69 _closed = true; 71 _closed = true;
70 } 72 }
71 if (!_closed) _filter.end(); 73 if (!_closed) _filter.end();
72 _closed = true; 74 _closed = true;
73 sink.close(); 75 sink.close();
74 } 76 }
75 } 77 }
76 78
77 79
78 /** 80 /**
79 * ZLibDeflater class used to deflate a stream of bytes, using zlib. 81 * ZLibDeflater class used to deflate a stream of bytes, using zlib.
80 */ 82 */
81 class ZLibDeflater extends _FilterTransformer { 83 class ZLibDeflater extends _FilterTransformer {
82 ZLibDeflater({bool gzip: true, int level: 6}) 84 ZLibDeflater({bool gzip: true, int level: 6})
83 : super(_Filter.newZLibDeflateFilter(gzip, level)); 85 : super(_Filter.newZLibDeflateFilter(gzip, level));
84 } 86 }
85 87
86 88
87 /** 89 /**
88 * ZLibInflater class used to inflate a stream of bytes, using zlib. 90 * ZLibInflater class used to inflate a stream of bytes, using zlib.
89 */ 91 */
90 class ZLibInflater extends _FilterTransformer { 92 class ZLibInflater extends _FilterTransformer {
91 ZLibInflater() : super(_Filter.newZLibInflateFilter()); 93 ZLibInflater() : super(_Filter.newZLibInflateFilter());
92 } 94 }
93 95
OLDNEW
« no previous file with comments | « no previous file | sdk/lib/io/secure_socket.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698