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

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

Issue 1152283005: Revert "Add the streamListen and streamCancel rpcs to the vm service." (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 7 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
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 46e84a7e518cf2d630aa7f5df19ed6815b5e029c..371adbf167a72b0baa7feecb47ebef55dd404d71 100644
--- a/runtime/observatory/lib/src/service/object.dart
+++ b/runtime/observatory/lib/src/service/object.dart
@@ -432,53 +432,10 @@ abstract class VM extends ServiceObjectOwner {
update(toObservable({'id':'vm', 'type':'@VM'}));
}
- Future streamListen(String streamId) {
- return invokeRpc('streamListen', {'streamId': streamId});
- }
-
- Future streamCancel(String streamId) {
- return invokeRpc('streamCancel', {'streamId': streamId});
- }
-
- static const kIsolateEventStreamId = 'Isolate';
- static const kDebugEventStreamId = 'Debug';
- static const kGCEventStreamId = 'GC';
-
- Map<String,StreamController> _streamControllers = {};
-
- void _streamListenHandleError(String streamId) {
- streamListen(streamId).catchError((e, st) {
- _getEventStreamController(streamId).addError(e, st);
- });
- }
-
- void _streamCancelHandleError(String streamId) {
- // TODO(turnidge): Consider removing the controller from the map here.
- streamCancel(streamId).catchError((e, st) {
- _getEventStreamController(streamId).addError(e, st);
- });
- }
-
- StreamController _getEventStreamController(String streamId) {
- var controller = _streamControllers.putIfAbsent(
- streamId, () {
- return new StreamController.broadcast(
- onListen: () => _streamListenHandleError(streamId),
- onCancel: () => _streamCancelHandleError(streamId));
- });
- return controller;
- }
-
- Stream getEventStream(String streamId) {
- return _getEventStreamController(streamId).stream;
- }
-
- Stream get isolateEvents => getEventStream(kIsolateEventStreamId);
- Stream get debugEvents => getEventStream(kDebugEventStreamId);
- Stream get gcEvents => getEventStream(kGCEventStreamId);
+ final StreamController<ServiceEvent> events =
+ new StreamController.broadcast();
- void postServiceEvent(String streamId, Map response, ByteData data) {
- assert(streamId != null);
+ void postServiceEvent(Map response, ByteData data) {
var map = toObservable(response);
assert(!map.containsKey('_data'));
if (data != null) {
@@ -491,21 +448,19 @@ abstract class VM extends ServiceObjectOwner {
}
var eventIsolate = map['isolate'];
- var event;
if (eventIsolate == null) {
- event = new ServiceObject._fromMap(vm, map);
+ var event = new ServiceObject._fromMap(vm, map);
+ events.add(event);
} else {
// getFromMap creates the Isolate if it hasn't been seen already.
var isolate = getFromMap(map['isolate']);
- event = new ServiceObject._fromMap(isolate, map);
+ var event = new ServiceObject._fromMap(isolate, map);
if (event.eventType == ServiceEvent.kIsolateExit) {
_removeIsolate(isolate.id);
}
- // Give the isolate a chance to process the event first before
- // dispatching it to others.
isolate._onEvent(event);
+ events.add(event);
}
- _getEventStreamController(streamId).add(event);
}
void _removeIsolate(String isolateId) {
@@ -1062,7 +1017,7 @@ class Isolate extends ServiceObjectOwner with Coverage {
Stream fetchHeapSnapshot() {
if (_snapshotFetch == null || _snapshotFetch.isClosed) {
_snapshotFetch = new StreamController();
- isolate.vm.streamListen('_Graph');
+ // isolate.vm.streamListen('_Graph');
isolate.invokeRpcNoUpgrade('requestHeapSnapshot', {});
}
return _snapshotFetch.stream;

Powered by Google App Engine
This is Rietveld 408576698