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

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

Issue 1166433008: 2nd attempt at adding streamListen/streamCancel to the service protocol. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: fix context objects Created 5 years, 6 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 1e6be4e56fd61c4149d29a017697da6659ba78d8..75c09182de503bbd483c0b534dea51e712d0472b 100644
--- a/runtime/observatory/lib/src/service/object.dart
+++ b/runtime/observatory/lib/src/service/object.dart
@@ -20,9 +20,11 @@ class ServerRpcException extends RpcException {
static const kMethodNotFound = -32601;
static const kInvalidParams = -32602;
static const kInternalError = -32603;
- static const kFeatureDisabled = 100;
- static const kVMMustBePaused = 101;
- static const kCannotAddBreakpoint = 102;
+ static const kFeatureDisabled = 100;
+ static const kVMMustBePaused = 101;
+ static const kCannotAddBreakpoint = 102;
+ static const kStreamAlreadySubscribed = 103;
+ static const kStreamNotSubscribed = 104;
int code;
Map data;
@@ -560,14 +562,31 @@ abstract class VM extends ServiceObjectOwner {
});
}
- Future<ObservableMap> _fetchDirect() {
- return invokeRpcNoUpgrade('getVM', {});
+ Future<ObservableMap> _fetchDirect() async {
+ if (!loaded) {
+ // TODO(turnidge): Instead of always listening to all streams,
+ // implement a stream abstraction in the service library so
+ // that we only subscribe to the streams we want.
+ await _streamListen('Isolate');
+ await _streamListen('Debug');
+ await _streamListen('GC');
+ await _streamListen('_Echo');
+ await _streamListen('_Graph');
+ }
+ return await invokeRpcNoUpgrade('getVM', {});
}
Future<ServiceObject> getFlagList() {
return invokeRpc('getFlagList', {});
}
+ Future<ServiceObject> _streamListen(String streamId) {
+ Map params = {
+ 'streamId': streamId,
+ };
+ return invokeRpc('streamListen', params);
+ }
+
/// Force the VM to disconnect.
void disconnect();
/// Completes when the VM first connects.
« no previous file with comments | « runtime/observatory/lib/src/elements/service_ref.dart ('k') | runtime/observatory/tests/service/contexts_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698