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 library unittest.isolate_wrapper; | 5 library unittest.isolate_wrapper; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:isolate'; | 8 import 'dart:isolate'; |
9 | 9 |
| 10 import 'io.dart'; |
| 11 |
10 // TODO(nweiz): Get rid of this when issue 6610 is fixed. | 12 // TODO(nweiz): Get rid of this when issue 6610 is fixed. |
11 /// This is a wrapper around an [Isolate] that supports a callback that will | 13 /// This is a wrapper around an [Isolate] that supports a callback that will |
12 /// fire when [Isolate.exit] is called. | 14 /// fire when [Isolate.exit] is called. |
13 /// | 15 /// |
14 /// This is necessary to delete the source directory of the isolate only once | 16 /// This is necessary to delete the source directory of the isolate only once |
15 /// the Isolate completes. Note that the callback won't necessarily fire before | 17 /// the Isolate completes. Note that the callback won't necessarily fire before |
16 /// the Isolate is killed, but it comes close enough for our purposes. | 18 /// the Isolate is killed, but it comes close enough for our purposes. |
17 class IsolateWrapper implements Isolate { | 19 class IsolateWrapper implements Isolate { |
18 final Isolate _inner; | 20 final Isolate _inner; |
19 | 21 |
(...skipping 13 matching lines...) Expand all Loading... |
33 void ping(SendPort responsePort, [int pingType=Isolate.IMMEDIATE]) => | 35 void ping(SendPort responsePort, [int pingType=Isolate.IMMEDIATE]) => |
34 _inner.ping(responsePort, pingType); | 36 _inner.ping(responsePort, pingType); |
35 void removeErrorListener(SendPort port) => _inner.removeErrorListener(port); | 37 void removeErrorListener(SendPort port) => _inner.removeErrorListener(port); |
36 void removeOnExitListener(SendPort port) => _inner.removeOnExitListener(port); | 38 void removeOnExitListener(SendPort port) => _inner.removeOnExitListener(port); |
37 void resume(Capability resumeCapability) => _inner.resume(resumeCapability); | 39 void resume(Capability resumeCapability) => _inner.resume(resumeCapability); |
38 void setErrorsFatal(bool errorsAreFatal) => | 40 void setErrorsFatal(bool errorsAreFatal) => |
39 _inner.setErrorsFatal(errorsAreFatal); | 41 _inner.setErrorsFatal(errorsAreFatal); |
40 String toString() => _inner.toString(); | 42 String toString() => _inner.toString(); |
41 | 43 |
42 void kill([int priority=Isolate.BEFORE_NEXT_EVENT]) { | 44 void kill([int priority=Isolate.BEFORE_NEXT_EVENT]) { |
43 _inner.kill(priority); | 45 if (supportsIsolateKill) _inner.kill(priority); |
44 _onExit(); | 46 _onExit(); |
45 } | 47 } |
46 } | 48 } |
OLD | NEW |