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

Side by Side Diff: sdk/lib/isolate/isolate_stream.dart

Issue 16125005: Make new StreamController be async by default. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address review comments 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/websocket_impl.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.isolate; 5 part of dart.isolate;
6 6
7 /** 7 /**
8 * The initial [IsolateStream] available by default for this isolate. This 8 * The initial [IsolateStream] available by default for this isolate. This
9 * [IsolateStream] is created automatically and it is commonly used to establish 9 * [IsolateStream] is created automatically and it is commonly used to establish
10 * the first communication between isolates (see [streamSpawnFunction] and 10 * the first communication between isolates (see [streamSpawnFunction] and
(...skipping 20 matching lines...) Expand all
31 31
32 /** 32 /**
33 * [IsolateStream]s, together with [IsolateSink]s, are the only means of 33 * [IsolateStream]s, together with [IsolateSink]s, are the only means of
34 * communication between isolates. Each IsolateStream has a corresponding 34 * communication between isolates. Each IsolateStream has a corresponding
35 * [IsolateSink]. Any message written into that sink will be delivered to 35 * [IsolateSink]. Any message written into that sink will be delivered to
36 * the stream and then dispatched to the stream's subscribers. 36 * the stream and then dispatched to the stream's subscribers.
37 */ 37 */
38 class IsolateStream extends Stream<dynamic> { 38 class IsolateStream extends Stream<dynamic> {
39 bool _isClosed = false; 39 bool _isClosed = false;
40 final ReceivePort _port; 40 final ReceivePort _port;
41 StreamController _controller = new StreamController(); 41 StreamController _controller = new StreamController(sync: true);
42 42
43 IsolateStream._fromOriginalReceivePort(this._port) { 43 IsolateStream._fromOriginalReceivePort(this._port) {
44 _port.receive((message, replyTo) { 44 _port.receive((message, replyTo) {
45 assert(replyTo == null); 45 assert(replyTo == null);
46 _add(message); 46 _add(message);
47 }); 47 });
48 } 48 }
49 49
50 IsolateStream._fromOriginalReceivePortOneShot(this._port) { 50 IsolateStream._fromOriginalReceivePortOneShot(this._port) {
51 _port.receive((message, replyTo) { 51 _port.receive((message, replyTo) {
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 * default stream. 141 * default stream.
142 * 142 *
143 * The optional [unhandledExceptionCallback] argument is invoked whenever an 143 * The optional [unhandledExceptionCallback] argument is invoked whenever an
144 * exception inside the isolate is unhandled. It can be seen as a big 144 * exception inside the isolate is unhandled. It can be seen as a big
145 * `try/catch` around everything that is executed inside the isolate. The 145 * `try/catch` around everything that is executed inside the isolate. The
146 * callback should return `true` when it was able to handled the exception. 146 * callback should return `true` when it was able to handled the exception.
147 */ 147 */
148 external IsolateSink streamSpawnFunction( 148 external IsolateSink streamSpawnFunction(
149 void topLevelFunction(), 149 void topLevelFunction(),
150 [bool unhandledExceptionCallback(IsolateUnhandledException e)]); 150 [bool unhandledExceptionCallback(IsolateUnhandledException e)]);
OLDNEW
« no previous file with comments | « sdk/lib/io/websocket_impl.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