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

Side by Side Diff: pkg/http/lib/src/streamed_request.dart

Issue 12154006: Remove Sink and move CollectionSink to async. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Remove usage of Sink from pub. Created 7 years, 10 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 | « pkg/http/lib/src/multipart_request.dart ('k') | sdk/lib/_internal/compiler/compiler.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 library streamed_request; 5 library streamed_request;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:io'; 8 import 'dart:io';
9 import 'dart:uri'; 9 import 'dart:uri';
10 10
11 import 'byte_stream.dart'; 11 import 'byte_stream.dart';
12 import 'base_request.dart'; 12 import 'base_request.dart';
13 13
14 /// An HTTP request where the request body is sent asynchronously after the 14 /// An HTTP request where the request body is sent asynchronously after the
15 /// connection has been established and the headers have been sent. 15 /// connection has been established and the headers have been sent.
16 /// 16 ///
17 /// When the request is sent via [BaseClient.send], only the headers and 17 /// When the request is sent via [BaseClient.send], only the headers and
18 /// whatever data has already been written to [StreamedRequest.stream] will be 18 /// whatever data has already been written to [StreamedRequest.stream] will be
19 /// sent immediately. More data will be sent as soon as it's written to 19 /// sent immediately. More data will be sent as soon as it's written to
20 /// [StreamedRequest.sink], and when the sink is closed the request will end. 20 /// [StreamedRequest.sink], and when the sink is closed the request will end.
21 class StreamedRequest extends BaseRequest { 21 class StreamedRequest extends BaseRequest {
22 /// The sink to which to write data that will be sent as the request body. 22 /// The sink to which to write data that will be sent as the request body.
23 /// This may be safely written to before the request is sent; the data will be 23 /// This may be safely written to before the request is sent; the data will be
24 /// buffered. 24 /// buffered.
25 /// 25 ///
26 /// Closing this signals the end of the request. 26 /// Closing this signals the end of the request.
27 Sink<List<int>> get sink => _controller.sink; 27 StreamSink<List<int>> get sink => _controller.sink;
28 28
29 /// The controller for [sink], from which [BaseRequest] will read data for 29 /// The controller for [sink], from which [BaseRequest] will read data for
30 /// [finalize]. 30 /// [finalize].
31 final StreamController<List<int>> _controller; 31 final StreamController<List<int>> _controller;
32 32
33 /// Creates a new streaming request. 33 /// Creates a new streaming request.
34 StreamedRequest(String method, Uri url) 34 StreamedRequest(String method, Uri url)
35 : super(method, url), 35 : super(method, url),
36 _controller = new StreamController<List<int>>(); 36 _controller = new StreamController<List<int>>();
37 37
38 /// Freezes all mutable fields other than [stream] and returns a 38 /// Freezes all mutable fields other than [stream] and returns a
39 /// single-subscription [ByteStream] that emits the data being written to 39 /// single-subscription [ByteStream] that emits the data being written to
40 /// [sink]. 40 /// [sink].
41 ByteStream finalize() { 41 ByteStream finalize() {
42 super.finalize(); 42 super.finalize();
43 return new ByteStream(_controller.stream); 43 return new ByteStream(_controller.stream);
44 } 44 }
45 } 45 }
OLDNEW
« no previous file with comments | « pkg/http/lib/src/multipart_request.dart ('k') | sdk/lib/_internal/compiler/compiler.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698