| Index: runtime/lib/isolate_patch.dart
|
| diff --git a/runtime/lib/isolate_patch.dart b/runtime/lib/isolate_patch.dart
|
| index 2fd5e4f267a3f9170741f301accacf3bc4c8842e..0946a7732e186632767fcbe2dea0aaeb9c957f62 100644
|
| --- a/runtime/lib/isolate_patch.dart
|
| +++ b/runtime/lib/isolate_patch.dart
|
| @@ -256,6 +256,10 @@ void _startIsolate(SendPort parentPort,
|
| }
|
|
|
| patch class Isolate {
|
| + static final _currentIsolate = _getCurrentIsolate();
|
| +
|
| + /* patch */ static Isolate get current => _currentIsolate;
|
| +
|
| /* patch */ static Future<Isolate> spawn(
|
| void entryPoint(message), var message, { bool paused: false }) {
|
| // `paused` isn't handled yet.
|
| @@ -379,4 +383,14 @@ patch class Isolate {
|
| /* patch */ void removeErrorListener(SendPort port) {
|
| throw new UnsupportedError("removeErrorListener");
|
| }
|
| +
|
| + static Isolate _getCurrentIsolate() {
|
| + List portAndCapabilities = _getPortAndCapabilitiesOfCurrentIsolate();
|
| + return new Isolate(portAndCapabilities[0],
|
| + pauseCapability: portAndCapabilities[1],
|
| + terminateCapability: portAndCapabilities[2]);
|
| + }
|
| +
|
| + static List _getPortAndCapabilitiesOfCurrentIsolate()
|
| + native "Isolate_getPortAndCapabilitiesOfCurrentIsolate";
|
| }
|
|
|