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

Unified Diff: runtime/observatory/lib/src/service/object.dart

Issue 2980733003: Introduced support for external services registration in the ServiceProtocol (Closed)
Patch Set: Address comments Created 3 years, 5 months 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
« no previous file with comments | « runtime/observatory/lib/src/repositories/isolate.dart ('k') | runtime/observatory/observatory_sources.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/observatory/lib/src/service/object.dart
diff --git a/runtime/observatory/lib/src/service/object.dart b/runtime/observatory/lib/src/service/object.dart
index 46985a378ba61ac2ce3037cedc2dda4919d19a90..db31bb76cfafbd94dd3eb6087fde609362e2e0a5 100644
--- a/runtime/observatory/lib/src/service/object.dart
+++ b/runtime/observatory/lib/src/service/object.dart
@@ -665,6 +665,8 @@ abstract class VM extends ServiceObjectOwner implements M.VM {
// The list of live isolates, ordered by isolate start time.
final List<Isolate> isolates = <Isolate>[];
+ final List<Service> services = <Service>[];
+
String version = 'unknown';
String hostCPU;
String targetCPU;
@@ -855,6 +857,17 @@ abstract class VM extends ServiceObjectOwner implements M.VM {
}
}
+ void _updateService(ServiceEvent event) {
+ switch (event.kind) {
+ case ServiceEvent.kServiceRegistered:
+ services.add(new Service(event.alias, event.method, event.service));
+ break;
+ case ServiceEvent.kServiceUnregistered:
+ services.removeWhere((s) => s.method == event.method);
+ break;
+ }
+ }
+
Future<Map> _fetchDirect({int count: kDefaultFieldLimit}) async {
if (!loaded) {
// The vm service relies on these events to keep the VM and
@@ -864,6 +877,7 @@ abstract class VM extends ServiceObjectOwner implements M.VM {
await listenEventStream(kIsolateStream, _dispatchEventToIsolate);
await listenEventStream(kDebugStream, _dispatchEventToIsolate);
await listenEventStream(_kGraphStream, _dispatchEventToIsolate);
+ await listenEventStream(kServiceStream, _updateService);
} on FakeVMRpcException catch (_) {
// ignore FakeVMRpcExceptions here.
} on NetworkRpcException catch (_) {
@@ -911,6 +925,7 @@ abstract class VM extends ServiceObjectOwner implements M.VM {
static const kStdoutStream = 'Stdout';
static const kStderrStream = 'Stderr';
static const _kGraphStream = '_Graph';
+ static const kServiceStream = '_Service';
/// Returns a single-subscription Stream object for a VM event stream.
Future<Stream> getEventStream(String streamId) async {
@@ -2125,7 +2140,8 @@ class ServiceEvent extends ServiceObject {
static const kConnectionClosed = 'ConnectionClosed';
static const kLogging = '_Logging';
static const kExtension = 'Extension';
- static const kEditor = '_Editor';
+ static const kServiceRegistered = 'ServiceRegistered';
+ static const kServiceUnregistered = 'ServiceUnregistered';
ServiceEvent._empty(ServiceObjectOwner owner) : super._empty(owner);
@@ -2157,6 +2173,9 @@ class ServiceEvent extends ServiceObject {
String spawnError;
String editor;
ServiceObject object;
+ String method;
+ String service;
+ String alias;
int chunkIndex, chunkCount, nodeCount;
@@ -2253,6 +2272,15 @@ class ServiceEvent extends ServiceObject {
if (map['object'] != null) {
object = map['object'];
}
+ if (map['service'] != null) {
+ service = map['service'];
+ }
+ if (map['method'] != null) {
+ method = map['method'];
+ }
+ if (map['alias'] != null) {
+ alias = map['alias'];
+ }
}
String toString() {
@@ -4664,3 +4692,15 @@ void _upgradeList(List list, ServiceObjectOwner owner) {
}
}
}
+
+class Service implements M.Service {
+ final String alias;
+ final String method;
+ final String service;
+
+ Service(this.alias, this.method, this.service) {
+ assert(this.alias != null);
+ assert(this.method != null);
+ assert(this.service != null);
+ }
+}
« no previous file with comments | « runtime/observatory/lib/src/repositories/isolate.dart ('k') | runtime/observatory/observatory_sources.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698