OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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:isolate"; | 5 import "dart:isolate"; |
6 import "dart:async"; | 6 import "dart:async"; |
7 import "package:expect/expect.dart"; | 7 import "package:expect/expect.dart"; |
8 import "package:async_helper/async_helper.dart"; | 8 import "package:async_helper/async_helper.dart"; |
9 | 9 |
10 void toplevel(port, message) { port.send("toplevel:$message"); } | 10 void toplevel(port, message) { port.send("toplevel:$message"); } |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 asyncEnd(); | 164 asyncEnd(); |
165 }); | 165 }); |
166 | 166 |
167 // Try sending through other isolate. | 167 // Try sending through other isolate. |
168 asyncStart(); | 168 asyncStart(); |
169 echoPort((v) { Expect.equals(0, v); }) | 169 echoPort((v) { Expect.equals(0, v); }) |
170 .then((p) { | 170 .then((p) { |
171 try { | 171 try { |
172 p.send(func); | 172 p.send(func); |
173 } finally { | 173 } finally { |
174 p.send(0); // Closes echo port. | 174 p.send(0); // Closes echo port. |
175 } | 175 } |
176 }) | 176 }) |
177 .then((p) => throw "unreachable 2", | 177 .then((p) => throw "unreachable 2", |
178 onError: (e, s) {asyncEnd();}); | 178 onError: (e, s) {asyncEnd();}); |
179 } | 179 } |
180 | 180 |
181 void nop(_) {} | 181 void nop(_) {} |
182 | 182 |
183 void callFunc(message) { | 183 void callFunc(message) { |
184 message[0](message[1], message[2]); | 184 message[0](message[1], message[2]); |
185 } | 185 } |
OLD | NEW |