Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(55)

Unified Diff: sdk/lib/developer/service.dart

Issue 2542003002: Add getIsolateID to Service class in dart:developer (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: sdk/lib/developer/service.dart
diff --git a/sdk/lib/developer/service.dart b/sdk/lib/developer/service.dart
index 9ccf0dccc268ca48fda44572f341057987be6ff3..c1837e80ecb3668769098bdbbc098f447612ccad 100644
--- a/sdk/lib/developer/service.dart
+++ b/sdk/lib/developer/service.dart
@@ -73,6 +73,18 @@ class Service {
receivePort.close();
return new ServiceProtocolInfo(uri);
}
+
+ /// Returns the opaque service id for [isolate] as a [String]. This id can
Lasse Reichstein Nielsen 2016/12/01 20:29:05 id -> ID (both of them) Not sure what "opaque" me
Cutch 2016/12/01 20:41:30 Done.
+ /// be used to address an isolate over the service protocol. If the running
+ /// Dart environment does not support the service protocol, this returns null.
Lasse Reichstein Nielsen 2016/12/01 20:29:05 Last sentence: "Returns null if the running Dart e
Cutch 2016/12/01 20:41:30 Done.
+ static String getServiceIdForIsolate(Isolate isolate) {
turnidge 2016/12/01 19:22:44 getIsolateId?
Cutch 2016/12/01 20:41:30 Done.
+ 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.
@@ -87,3 +99,5 @@ external int _getServiceMajorVersion();
/// Returns the minor version of the service protocol.
external int _getServiceMinorVersion();
+/// Returns the service id for the isolate that owns [sp].
+external String _getIsolateIdFromSendPort(SendPort sp);
Lasse Reichstein Nielsen 2016/12/01 20:29:05 id -> ID. sp -> sendPort. (Style guide says: Avoid
Cutch 2016/12/01 20:41:30 Done.

Powered by Google App Engine
This is Rietveld 408576698