OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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:async'; | 5 import 'dart:async'; |
6 import 'dart:collection'; | 6 import 'dart:collection'; |
7 import 'dart:convert'; | 7 import 'dart:convert'; |
8 | 8 |
9 import 'package:async/async.dart'; | 9 import 'package:async/async.dart'; |
10 import 'package:collection/collection.dart'; | 10 import 'package:collection/collection.dart'; |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 sink.add(BASE64.decode(json["bytes"])); | 179 sink.add(BASE64.decode(json["bytes"])); |
180 }); | 180 }); |
181 | 181 |
182 _onExtensionEvent = _transform(_scope.streams.extension, (json, sink) { | 182 _onExtensionEvent = _transform(_scope.streams.extension, (json, sink) { |
183 sink.add(new VMExtensionEvent._(json)); | 183 sink.add(new VMExtensionEvent._(json)); |
184 }); | 184 }); |
185 } | 185 } |
186 | 186 |
187 /// Like [transform], but only calls [handleData] for events related to this | 187 /// Like [transform], but only calls [handleData] for events related to this |
188 /// isolate. | 188 /// isolate. |
189 Stream/*<T>*/ _transform/*<T>*/(Stream<Map> stream, | 189 Stream<T> _transform<T>(Stream<Map> stream, |
190 void handleData(Map json, StreamSink/*<T>*/ sink)) { | 190 void handleData(Map json, StreamSink<T> sink)) { |
191 return transform(stream, (json, sink) { | 191 return transform(stream, (json, sink) { |
192 if (json["isolate"]["id"] != _scope.isolateId) return; | 192 if (json["isolate"]["id"] != _scope.isolateId) return; |
193 handleData(json, sink); | 193 handleData(json, sink); |
194 }); | 194 }); |
195 } | 195 } |
196 | 196 |
197 /// Loads the full representation of this isolate once it becomes runnable. | 197 /// Loads the full representation of this isolate once it becomes runnable. |
198 /// | 198 /// |
199 /// This will work whether this isolate is already runnable or has yet to | 199 /// This will work whether this isolate is already runnable or has yet to |
200 /// become runnable. | 200 /// become runnable. |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
506 /// The kind, which identifies the type of event and its source. | 506 /// The kind, which identifies the type of event and its source. |
507 final String kind; | 507 final String kind; |
508 | 508 |
509 /// The event's payload. | 509 /// The event's payload. |
510 final Map data; | 510 final Map data; |
511 | 511 |
512 VMExtensionEvent._(Map json) | 512 VMExtensionEvent._(Map json) |
513 : kind = json['extensionKind'], | 513 : kind = json['extensionKind'], |
514 data = json['extensionData']; | 514 data = json['extensionData']; |
515 } | 515 } |
OLD | NEW |