Index: sdk/lib/developer/service.dart |
diff --git a/sdk/lib/developer/service.dart b/sdk/lib/developer/service.dart |
index 9ccf0dccc268ca48fda44572f341057987be6ff3..bbe954def25262a61c14bbf741ac8d7b2a2dfae3 100644 |
--- a/sdk/lib/developer/service.dart |
+++ b/sdk/lib/developer/service.dart |
@@ -73,13 +73,26 @@ class Service { |
receivePort.close(); |
return new ServiceProtocolInfo(uri); |
} |
+ |
+ /// Returns a [String] token representing the ID of [isolate]. |
+ /// |
+ /// Returns null if the running Dart environment does not support the service |
+ /// protocol. |
+ static String getIsolateID(Isolate isolate) { |
+ if (isolate is! Isolate) { |
+ throw new ArgumentError.value(isolate, |
+ 'isolate', |
+ 'Must be an Isolate'); |
+ } |
+ return _getIsolateIDFromSendPort(isolate.controlPort); |
+ } |
} |
-/// [sp] will receive a Uri or null. |
-external void _getServerInfo(SendPort sp); |
+/// [sendPort] will receive a Uri or null. |
+external void _getServerInfo(SendPort sendPort); |
-/// [sp] will receive a Uri or null. |
-external void _webServerControl(SendPort sp, bool enable); |
+/// [sendPort] will receive a Uri or null. |
+external void _webServerControl(SendPort sendPort, bool enable); |
/// Returns the major version of the service protocol. |
external int _getServiceMajorVersion(); |
@@ -87,3 +100,5 @@ external int _getServiceMajorVersion(); |
/// Returns the minor version of the service protocol. |
external int _getServiceMinorVersion(); |
+/// Returns the service id for the isolate that owns [sendPort]. |
+external String _getIsolateIDFromSendPort(SendPort sendPort); |