OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 library class_view_element; | 5 library class_view_element; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'observatory_element.dart'; | 8 import 'observatory_element.dart'; |
9 import 'package:observatory/service.dart'; | 9 import 'package:observatory/service.dart'; |
10 import 'package:polymer/polymer.dart'; | 10 import 'package:polymer/polymer.dart'; |
11 | 11 |
12 @CustomTag('class-view') | 12 @CustomTag('class-view') |
13 class ClassViewElement extends ObservatoryElement { | 13 class ClassViewElement extends ObservatoryElement { |
14 @published Class cls; | 14 @published Class cls; |
15 @observable ServiceMap instances; | 15 @observable ServiceMap instances; |
16 @observable int retainedBytes; | 16 @observable int retainedBytes; |
17 @observable ObservableList mostRetained; | 17 @observable ObservableList mostRetained; |
18 ClassViewElement.created() : super.created(); | 18 ClassViewElement.created() : super.created(); |
19 | 19 |
20 Future<ServiceObject> eval(String expression) { | 20 Future<ServiceObject> evaluate(String expression) { |
21 return cls.isolate.eval(cls, expression); | 21 return cls.evaluate(expression); |
22 } | 22 } |
23 | 23 |
24 Future<ServiceObject> reachable(var limit) { | 24 Future<ServiceObject> reachable(var limit) { |
25 return cls.isolate.getInstances(cls, limit).then((ServiceMap obj) { | 25 return cls.isolate.getInstances(cls, limit).then((ServiceMap obj) { |
26 instances = obj; | 26 instances = obj; |
27 }); | 27 }); |
28 } | 28 } |
29 | 29 |
30 Future<ServiceObject> retainedToplist(var limit) { | 30 Future<ServiceObject> retainedToplist(var limit) { |
31 return cls.isolate.fetchHeapSnapshot() | 31 return cls.isolate.fetchHeapSnapshot() |
32 .then((HeapSnapshot snapshot) => | 32 .then((HeapSnapshot snapshot) => |
33 Future.wait(snapshot.getMostRetained(classId: cls.vmCid, | 33 Future.wait(snapshot.getMostRetained(classId: cls.vmCid, |
34 limit: 10))) | 34 limit: 10))) |
35 .then((List<ServiceObject> most) { | 35 .then((List<ServiceObject> most) { |
36 mostRetained = new ObservableList.from(most); | 36 mostRetained = new ObservableList.from(most); |
37 }); | 37 }); |
38 } | 38 } |
39 | 39 |
40 // TODO(koda): Add no-arg "calculate-link" instead of reusing "eval-link". | 40 // TODO(koda): Add no-arg "calculate-link" instead of reusing "eval-link". |
41 Future<ServiceObject> retainedSize(var dummy) { | 41 Future<ServiceObject> retainedSize(var dummy) { |
42 return cls.isolate.getRetainedSize(cls).then((Instance obj) { | 42 return cls.isolate.getRetainedSize(cls).then((Instance obj) { |
43 retainedBytes = int.parse(obj.valueAsString); | 43 retainedBytes = int.parse(obj.valueAsString); |
44 }); | 44 }); |
45 } | 45 } |
46 | 46 |
47 Future refresh() { | 47 Future refresh() { |
48 instances = null; | 48 instances = null; |
49 retainedBytes = null; | 49 retainedBytes = null; |
50 mostRetained = null; | 50 mostRetained = null; |
51 return cls.reload(); | 51 return cls.reload(); |
52 } | 52 } |
53 | 53 |
54 Future refreshCoverage() { | 54 Future refreshCoverage() { |
55 return cls.refreshCoverage(); | 55 return cls.refreshCoverage(); |
56 } | 56 } |
57 } | 57 } |
OLD | NEW |