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 'sample_buffer_control.dart'; | 9 import 'sample_buffer_control.dart'; |
10 import 'stack_trace_tree_config.dart'; | 10 import 'stack_trace_tree_config.dart'; |
(...skipping 23 matching lines...) Expand all Loading... |
34 Future<ServiceObject> evaluate(String expression) { | 34 Future<ServiceObject> evaluate(String expression) { |
35 return cls.evaluate(expression); | 35 return cls.evaluate(expression); |
36 } | 36 } |
37 | 37 |
38 Future<ServiceObject> reachable(var limit) { | 38 Future<ServiceObject> reachable(var limit) { |
39 return cls.isolate.getInstances(cls, limit).then((ServiceMap obj) { | 39 return cls.isolate.getInstances(cls, limit).then((ServiceMap obj) { |
40 instances = obj; | 40 instances = obj; |
41 }); | 41 }); |
42 } | 42 } |
43 | 43 |
44 Future<ServiceObject> retainedToplist(var limit) { | 44 Future retainedToplist(var limit) async { |
45 return cls.isolate.fetchHeapSnapshot(true).last | 45 final raw = await cls.isolate.fetchHeapSnapshot(true).last; |
46 .then((RawHeapSnapshot raw) async { | 46 final snapshot = new HeapSnapshot(); |
47 final snapshot = new HeapSnapshot(); | 47 await snapshot.loadProgress(cls.isolate, raw).last; |
48 await snapshot.loadProgress(cls.isolate, raw); | 48 final most = await Future.wait(snapshot.getMostRetained(cls.isolate, |
49 return snapshot; | 49 classId: cls.vmCid
, |
50 }) | 50 limit: 10)); |
51 .then((HeapSnapshot snapshot) => | 51 mostRetained = new ObservableList.from(most); |
52 Future.wait(snapshot.getMostRetained(cls.isolate, classId: cls.vmCid, | |
53 limit: 10))) | |
54 .then((List<ServiceObject> most) { | |
55 mostRetained = new ObservableList.from(most); | |
56 }); | |
57 } | 52 } |
58 | 53 |
59 // TODO(koda): Add no-arg "calculate-link" instead of reusing "eval-link". | 54 // TODO(koda): Add no-arg "calculate-link" instead of reusing "eval-link". |
60 Future<ServiceObject> reachableSize(var dummy) { | 55 Future<ServiceObject> reachableSize(var dummy) { |
61 return cls.isolate.getReachableSize(cls).then((Instance obj) { | 56 return cls.isolate.getReachableSize(cls).then((Instance obj) { |
62 reachableBytes = int.parse(obj.valueAsString); | 57 reachableBytes = int.parse(obj.valueAsString); |
63 }); | 58 }); |
64 } | 59 } |
65 | 60 |
66 Future<ServiceObject> retainedSize(var dummy) { | 61 Future<ServiceObject> retainedSize(var dummy) { |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 Future toggleAllocationTrace() { | 118 Future toggleAllocationTrace() { |
124 if (cls == null) { | 119 if (cls == null) { |
125 return new Future(refresh); | 120 return new Future(refresh); |
126 } | 121 } |
127 if (cls.traceAllocations) { | 122 if (cls.traceAllocations) { |
128 refreshAllocationProfile(); | 123 refreshAllocationProfile(); |
129 } | 124 } |
130 return cls.setTraceAllocations(!cls.traceAllocations).whenComplete(refresh); | 125 return cls.setTraceAllocations(!cls.traceAllocations).whenComplete(refresh); |
131 } | 126 } |
132 } | 127 } |
OLD | NEW |