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

Side by Side Diff: runtime/observatory/lib/src/repositories/editor.dart

Issue 3002843002: Introduce heap snapshot into Memory Dashboard (Closed)
Patch Set: Address 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
« no previous file with comments | « runtime/observatory/lib/src/models/repositories/editor.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 S.VM _vm; 8 final S.VM _vm;
9 final String _editor; 9 final String _editor;
10 10
11 bool get canOpenClass => _getService() != null; 11 bool get isAvailable => _getService() != null;
12 12
13 EditorRepository(S.VM vm, {String editor}) 13 EditorRepository(S.VM vm, {String editor})
14 : _vm = vm, 14 : _vm = vm,
15 _editor = editor { 15 _editor = editor {
16 assert(_vm != null); 16 assert(_vm != null);
17 } 17 }
18 18
19 S.Service _getService() { 19 S.Service _getService() {
20 Iterable<M.Service> services = 20 Iterable<M.Service> services =
21 _vm.services.where((s) => s.service == 'openSourceLocation'); 21 _vm.services.where((s) => s.service == 'openSourceLocation');
(...skipping 11 matching lines...) Expand all
33 assert(clazz != null); 33 assert(clazz != null);
34 if (!clazz.loaded) { 34 if (!clazz.loaded) {
35 await clazz.load(); 35 await clazz.load();
36 } 36 }
37 if (clazz.location == null) { 37 if (clazz.location == null) {
38 return new Future.value(); 38 return new Future.value();
39 } 39 }
40 return await openSourceLocation(i, clazz.location); 40 return await openSourceLocation(i, clazz.location);
41 } 41 }
42 42
43 Future openField(M.IsolateRef i, M.FieldRef f) async {
44 S.Field field = f as S.Field;
45 assert(field != null);
46 if (!field.loaded) {
47 await field.load();
48 }
49 if (field.location == null) {
50 return new Future.value();
51 }
52 return await openSourceLocation(i, field.location);
53 }
54
55 Future openFunction(M.IsolateRef i, M.FunctionRef f) async {
56 S.ServiceFunction field = f as S.ServiceFunction;
57 assert(field != null);
58 if (!field.loaded) {
59 await field.load();
60 }
61 if (field.location == null) {
62 return new Future.value();
63 }
64 return await openSourceLocation(i, field.location);
65 }
66
67 Future openObject(M.IsolateRef i, M.ObjectRef o) async {
68 assert(o != null);
69 if (o is M.ClassRef) {
70 return await openClass(i, o);
71 }
72 if (o is M.InstanceRef) {
73 return await openClass(i, o.clazz);
74 }
75 if (o is M.FieldRef) {
76 return await openField(i, o);
77 }
78 if (o is M.FunctionRef) {
79 return await openFunction(i, o);
80 }
81 if (o is M.InstanceRef) {
82 if (o.closureFunction != null) {
83 return await openFunction(i, o.closureFunction);
84 }
85 return await openClass(i, o.clazz);
86 }
87 return new Future.value();
88 }
89
43 Future openSourceLocation(M.IsolateRef i, M.SourceLocation l) async { 90 Future openSourceLocation(M.IsolateRef i, M.SourceLocation l) async {
44 final isolate = i as S.Isolate; 91 final isolate = i as S.Isolate;
45 assert(isolate != null); 92 assert(isolate != null);
46 assert(l != null); 93 assert(l != null);
47 return await isolate.invokeRpc(_getService().method, 94 return await isolate.invokeRpc(_getService().method,
48 {'scriptId': l.script.id, 'tokenPos': l.tokenPos}); 95 {'scriptId': l.script.id, 'tokenPos': l.tokenPos});
49 } 96 }
50 } 97 }
OLDNEW
« no previous file with comments | « runtime/observatory/lib/src/models/repositories/editor.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698