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

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

Issue 15989006: Revert until Windows crash is debugged. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 6 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 | « sdk/lib/io/http_parser.dart ('k') | sdk/lib/mdv_observe_impl/mdv_observe_impl.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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 /** 8 /**
9 * A Mime Multipart class representing each part parsed by 9 * A Mime Multipart class representing each part parsed by
10 * [MimeMultipartTransformer]. The data is streamed in as it become available. 10 * [MimeMultipartTransformer]. The data is streamed in as it become available.
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 void _resumeStream() { 94 void _resumeStream() {
95 _subscription.resume(); 95 _subscription.resume();
96 } 96 }
97 97
98 void _pauseStream() { 98 void _pauseStream() {
99 _subscription.pause(); 99 _subscription.pause();
100 } 100 }
101 101
102 Stream<MimeMultipart> bind(Stream<List<int>> stream) { 102 Stream<MimeMultipart> bind(Stream<List<int>> stream) {
103 _controller = new StreamController( 103 _controller = new StreamController(
104 onPause: _pauseStream, 104 onPause: () {
105 onResume:_resumeStream, 105 _pauseStream();
106 onCancel: () { 106 },
107 _subscription.cancel(); 107 onResume: () {
108 _resumeStream();
108 }, 109 },
109 onListen: () { 110 onListen: () {
110 _subscription = stream.listen( 111 _subscription = stream.listen(
111 (data) { 112 (data) {
112 assert(_buffer == null); 113 assert(_buffer == null);
113 _pauseStream(); 114 _pauseStream();
114 _buffer = data; 115 _buffer = data;
115 _index = 0; 116 _index = 0;
116 _parse(); 117 _parse();
117 }, 118 },
118 onDone: () { 119 onDone: () {
119 if (_state != _DONE) { 120 if (_state != _DONE) {
120 _controller.addError( 121 _controller.addError(
121 new MimeMultipartException("Bad multipart ending")); 122 new MimeMultipartException("Bad multipart ending"));
122 } 123 }
123 _controller.close(); 124 _controller.close();
124 }, 125 },
125 onError: (error) { 126 onError: (error) {
126 _controller.addError(error); 127 _controller.addError(error);
127 }); 128 });
129 },
130 onCancel: () {
131 _subscription.cancel();
128 }); 132 });
129 return _controller.stream; 133 return _controller.stream;
130 } 134 }
131 135
132 void _parse() { 136 void _parse() {
133 // Number of boundary bytes to artificially place before the supplied data. 137 // Number of boundary bytes to artificially place before the supplied data.
134 int boundaryPrefix = 0; 138 int boundaryPrefix = 0;
135 // Position where content starts. Will be null if no known content 139 // Position where content starts. Will be null if no known content
136 // start exists. Will be negative of the content starts in the 140 // start exists. Will be negative of the content starts in the
137 // boundary prefix. Will be zero or position if the content starts 141 // boundary prefix. Will be zero or position if the content starts
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 } 398 }
395 } 399 }
396 } 400 }
397 401
398 402
399 class MimeMultipartException implements Exception { 403 class MimeMultipartException implements Exception {
400 const MimeMultipartException([String this.message = ""]); 404 const MimeMultipartException([String this.message = ""]);
401 String toString() => "MimeMultipartException: $message"; 405 String toString() => "MimeMultipartException: $message";
402 final String message; 406 final String message;
403 } 407 }
OLDNEW
« no previous file with comments | « sdk/lib/io/http_parser.dart ('k') | sdk/lib/mdv_observe_impl/mdv_observe_impl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698