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

Unified Diff: runtime/observatory/lib/src/repositories/editor.dart

Issue 2989083002: Add memory-dashboard page to Observatory (Closed)
Patch Set: Addressed CL comments Created 3 years, 4 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/models/repositories/editor.dart ('k') | runtime/observatory/lib/utils.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/observatory/lib/src/repositories/editor.dart
diff --git a/runtime/observatory/lib/src/repositories/editor.dart b/runtime/observatory/lib/src/repositories/editor.dart
index 35867f1506f9b9961579e0d3294ddd8875f5b5d0..26395736c330a8432a716165142ca65238a9df82 100644
--- a/runtime/observatory/lib/src/repositories/editor.dart
+++ b/runtime/observatory/lib/src/repositories/editor.dart
@@ -5,16 +5,46 @@
part of repositories;
class EditorRepository extends M.EditorRepository {
- final String editor;
+ final S.VM _vm;
+ final String _editor;
- EditorRepository(this.editor) {
- assert(this.editor != null);
+ bool get canOpenClass => _getService() != null;
+
+ EditorRepository(S.VM vm, {String editor})
+ : _vm = vm,
+ _editor = editor {
+ assert(_vm != null);
+ }
+
+ S.Service _getService() {
+ if (_vm.services.isEmpty) {
+ return null;
+ }
+ if (_editor == null) {
+ return _vm.services.where((s) => s.service == 'openSourceLocation').first;
+ }
+ return _vm.services
+ .where((s) => s.service == 'openSourceLocation' && s.alias == _editor)
+ .single;
+ }
+
+ Future openClass(M.IsolateRef i, M.ClassRef c) async {
+ S.Class clazz = c as S.Class;
+ assert(clazz != null);
+ if (!clazz.loaded) {
+ await clazz.load();
+ }
+ if (clazz.location == null) {
+ return new Future.value();
+ }
+ return await openSourceLocation(i, clazz.location);
}
- Future<M.Sentinel> sendObject(M.IsolateRef i, M.ObjectRef object) {
+ Future openSourceLocation(M.IsolateRef i, M.SourceLocation l) async {
final isolate = i as S.Isolate;
assert(isolate != null);
- return isolate.invokeRpc(
- '_sendObjectToEditor', {'editor': editor, 'objectId': object.id});
+ assert(l != null);
+ return await isolate.invokeRpc(_getService().method,
+ {'scriptId': l.script.id, 'tokenPos': l.tokenPos});
}
}
« no previous file with comments | « runtime/observatory/lib/src/models/repositories/editor.dart ('k') | runtime/observatory/lib/utils.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698