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

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

Issue 2872503004: vm-service: Add optional 'scope' parameter to 'evaluate' and 'evaluateInFrame'. (Closed)
Patch Set: review Created 3 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
« no previous file with comments | « no previous file | runtime/observatory/tests/service/evaluate_in_frame_with_scope_test.dart » ('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 f232986c91c2370518ba89ccfbb7b77279dffa08..dcd0afb8e3d9f5a620554a241ca7967a5c93d65e 100644
--- a/runtime/observatory/lib/src/service/object.dart
+++ b/runtime/observatory/lib/src/service/object.dart
@@ -1852,19 +1852,35 @@ class Isolate extends ServiceObjectOwner implements M.Isolate {
});
}
- Future<ServiceObject> eval(ServiceObject target, String expression) {
+ Future<ServiceObject> eval(ServiceObject target, String expression,
+ {Map<String, ServiceObject> scope}) {
Map params = {
'targetId': target.id,
'expression': expression,
};
+ if (scope != null) {
+ Map<String, String> scopeWithIds = new Map();
+ scope.forEach((String name, ServiceObject object) {
+ scopeWithIds[name] = object.id;
+ });
+ params["scope"] = scopeWithIds;
+ }
return invokeRpc('evaluate', params);
}
- Future<ServiceObject> evalFrame(int frameIndex, String expression) {
+ Future<ServiceObject> evalFrame(int frameIndex, String expression,
+ {Map<String, ServiceObject> scope}) {
Map params = {
'frameIndex': frameIndex,
'expression': expression,
};
+ if (scope != null) {
+ Map<String, String> scopeWithIds = new Map();
+ scope.forEach((String name, ServiceObject object) {
+ scopeWithIds[name] = object.id;
+ });
+ params["scope"] = scopeWithIds;
+ }
return invokeRpc('evaluateInFrame', params);
}
@@ -2378,8 +2394,8 @@ class Library extends HeapObject implements M.Library {
functions.sort(ServiceObject.LexicalSortName);
}
- Future<ServiceObject> evaluate(String expression) {
- return isolate.eval(this, expression);
+ Future<ServiceObject> evaluate(String expression, {Map scope}) {
+ return isolate.eval(this, expression, scope: scope);
}
Script get rootScript {
@@ -2548,8 +2564,8 @@ class Class extends HeapObject implements M.Class {
subclasses.sort(ServiceObject.LexicalSortName);
}
- Future<ServiceObject> evaluate(String expression) {
- return isolate.eval(this, expression);
+ Future<ServiceObject> evaluate(String expression, {Map scope}) {
+ return isolate.eval(this, expression, scope: scope);
}
Future<ServiceObject> setTraceAllocations(bool enable) {
@@ -2902,8 +2918,8 @@ class Instance extends HeapObject implements M.Instance {
return 'a ${clazz.name}';
}
- Future<ServiceObject> evaluate(String expression) {
- return isolate.eval(this, expression);
+ Future<ServiceObject> evaluate(String expression, {Map scope}) {
+ return isolate.eval(this, expression, scope: scope);
}
String toString() => 'Instance($shortName)';
« no previous file with comments | « no previous file | runtime/observatory/tests/service/evaluate_in_frame_with_scope_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698