Chromium Code Reviews| Index: runtime/lib/isolate_patch.dart |
| diff --git a/runtime/lib/isolate_patch.dart b/runtime/lib/isolate_patch.dart |
| index 1313609002de2d77afab21a30c262f499610bcf0..699be83f19f95e99300419be7f9335e23f81cb33 100644 |
| --- a/runtime/lib/isolate_patch.dart |
| +++ b/runtime/lib/isolate_patch.dart |
| @@ -17,6 +17,8 @@ patch class Capability { |
| class _CapabilityImpl implements Capability { |
| factory _CapabilityImpl() native "CapabilityImpl_factory"; |
| + |
| + String toString() => "Capability#"; |
| } |
| patch class RawReceivePort { |
| @@ -245,6 +247,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. |
| @@ -368,4 +374,13 @@ patch class Isolate { |
| /* patch */ void removeErrorListener(SendPort port) { |
| throw new UnsupportedError("removeErrorListener"); |
| } |
| + |
| + static Isolate _getCurrentIsolate() { |
| + List portAndCapabilities = _getCurrent(); |
| + return new Isolate(portAndCapabilities[0], |
| + pauseCapability: portAndCapabilities[1], |
| + terminateCapability: portAndCapabilities[2]); |
| + } |
| + |
| + static List _getCurrent() native "Isolate_getCurrent"; |
|
floitsch
2014/12/02 12:13:56
s/_getCurrent()/_getPortAndCapabilitiesOfCurrentIs
|
| } |