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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file 3 // BSD-style license that can be found in the LICENSE file
4 4
5 part of repositories; 5 part of repositories;
6 6
7 class EditorRepository extends M.EditorRepository { 7 class EditorRepository extends M.EditorRepository {
8 final String editor; 8 final S.VM _vm;
9 final String _editor;
9 10
10 EditorRepository(this.editor) { 11 bool get canOpenClass => _getService() != null;
11 assert(this.editor != null); 12
13 EditorRepository(S.VM vm, {String editor})
14 : _vm = vm,
15 _editor = editor {
16 assert(_vm != null);
12 } 17 }
13 18
14 Future<M.Sentinel> sendObject(M.IsolateRef i, M.ObjectRef object) { 19 S.Service _getService() {
20 if (_vm.services.isEmpty) {
21 return null;
22 }
23 if (_editor == null) {
24 return _vm.services.where((s) => s.service == 'openSourceLocation').first;
25 }
26 return _vm.services
27 .where((s) => s.service == 'openSourceLocation' && s.alias == _editor)
28 .single;
29 }
30
31 Future openClass(M.IsolateRef i, M.ClassRef c) async {
32 S.Class clazz = c as S.Class;
33 assert(clazz != null);
34 if (!clazz.loaded) {
35 await clazz.load();
36 }
37 if (clazz.location == null) {
38 return new Future.value();
39 }
40 return await openSourceLocation(i, clazz.location);
41 }
42
43 Future openSourceLocation(M.IsolateRef i, M.SourceLocation l) async {
15 final isolate = i as S.Isolate; 44 final isolate = i as S.Isolate;
16 assert(isolate != null); 45 assert(isolate != null);
17 return isolate.invokeRpc( 46 assert(l != null);
18 '_sendObjectToEditor', {'editor': editor, 'objectId': object.id}); 47 return await isolate.invokeRpc(_getService().method,
48 {'scriptId': l.script.id, 'tokenPos': l.tokenPos});
19 } 49 }
20 } 50 }
OLDNEW
« 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