OLD | NEW |
---|---|
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 part of dart.developer; | 5 part of dart.developer; |
6 | 6 |
7 /// Service protocol is the protocol that a client like the observatory | 7 /// Service protocol is the protocol that a client like the observatory |
8 /// could use to access the services provided by the Dart VM for | 8 /// could use to access the services provided by the Dart VM for |
9 /// debugging and inspecting Dart programs. This class encapsulates the | 9 /// debugging and inspecting Dart programs. This class encapsulates the |
10 /// version number and Uri for accessing this service. | 10 /// version number and Uri for accessing this service. |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
66 final Completer<Uri> uriCompleter = new Completer<Uri>(); | 66 final Completer<Uri> uriCompleter = new Completer<Uri>(); |
67 receivePort.handler = (Uri uri) => uriCompleter.complete(uri); | 67 receivePort.handler = (Uri uri) => uriCompleter.complete(uri); |
68 // Request the information from the service isolate. | 68 // Request the information from the service isolate. |
69 _webServerControl(receivePort.sendPort, enable); | 69 _webServerControl(receivePort.sendPort, enable); |
70 // Await the response from the service isolate. | 70 // Await the response from the service isolate. |
71 Uri uri = await uriCompleter.future; | 71 Uri uri = await uriCompleter.future; |
72 // Close the port. | 72 // Close the port. |
73 receivePort.close(); | 73 receivePort.close(); |
74 return new ServiceProtocolInfo(uri); | 74 return new ServiceProtocolInfo(uri); |
75 } | 75 } |
76 | |
77 /// 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.
| |
78 /// be used to address an isolate over the service protocol. If the running | |
79 /// 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.
| |
80 static String getServiceIdForIsolate(Isolate isolate) { | |
turnidge
2016/12/01 19:22:44
getIsolateId?
Cutch
2016/12/01 20:41:30
Done.
| |
81 if (isolate is! Isolate) { | |
82 throw new ArgumentError.value(isolate, | |
83 'isolate', | |
84 'Must be an Isolate'); | |
85 } | |
86 return _getIsolateIdFromSendPort(isolate.controlPort); | |
87 } | |
76 } | 88 } |
77 | 89 |
78 /// [sp] will receive a Uri or null. | 90 /// [sp] will receive a Uri or null. |
79 external void _getServerInfo(SendPort sp); | 91 external void _getServerInfo(SendPort sp); |
80 | 92 |
81 /// [sp] will receive a Uri or null. | 93 /// [sp] will receive a Uri or null. |
82 external void _webServerControl(SendPort sp, bool enable); | 94 external void _webServerControl(SendPort sp, bool enable); |
83 | 95 |
84 /// Returns the major version of the service protocol. | 96 /// Returns the major version of the service protocol. |
85 external int _getServiceMajorVersion(); | 97 external int _getServiceMajorVersion(); |
86 | 98 |
87 /// Returns the minor version of the service protocol. | 99 /// Returns the minor version of the service protocol. |
88 external int _getServiceMinorVersion(); | 100 external int _getServiceMinorVersion(); |
89 | 101 |
102 /// Returns the service id for the isolate that owns [sp]. | |
103 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.
| |
OLD | NEW |