| 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'; |
| 11 import 'cpu_profile/virtual_tree.dart'; | 11 import 'cpu_profile/virtual_tree.dart'; |
| 12 import 'package:observatory/heap_snapshot.dart'; |
| 12 import 'package:observatory/elements.dart'; | 13 import 'package:observatory/elements.dart'; |
| 13 import 'package:observatory/models.dart' as M; | 14 import 'package:observatory/models.dart' as M; |
| 14 import 'package:observatory/service.dart'; | 15 import 'package:observatory/service.dart'; |
| 15 import 'package:observatory/repositories.dart'; | 16 import 'package:observatory/repositories.dart'; |
| 16 import 'package:polymer/polymer.dart'; | 17 import 'package:polymer/polymer.dart'; |
| 17 | 18 |
| 18 @CustomTag('class-view') | 19 @CustomTag('class-view') |
| 19 class ClassViewElement extends ObservatoryElement { | 20 class ClassViewElement extends ObservatoryElement { |
| 20 @published Class cls; | 21 @published Class cls; |
| 21 @observable ServiceMap instances; | 22 @observable ServiceMap instances; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 35 } | 36 } |
| 36 | 37 |
| 37 Future<ServiceObject> reachable(var limit) { | 38 Future<ServiceObject> reachable(var limit) { |
| 38 return cls.isolate.getInstances(cls, limit).then((ServiceMap obj) { | 39 return cls.isolate.getInstances(cls, limit).then((ServiceMap obj) { |
| 39 instances = obj; | 40 instances = obj; |
| 40 }); | 41 }); |
| 41 } | 42 } |
| 42 | 43 |
| 43 Future<ServiceObject> retainedToplist(var limit) { | 44 Future<ServiceObject> retainedToplist(var limit) { |
| 44 return cls.isolate.fetchHeapSnapshot(true).last | 45 return cls.isolate.fetchHeapSnapshot(true).last |
| 46 .then((RawHeapSnapshot raw) async { |
| 47 final snapshot = new HeapSnapshot(); |
| 48 await snapshot.loadProgress(cls.isolate, raw); |
| 49 return snapshot; |
| 50 }) |
| 45 .then((HeapSnapshot snapshot) => | 51 .then((HeapSnapshot snapshot) => |
| 46 Future.wait(snapshot.getMostRetained(classId: cls.vmCid, | 52 Future.wait(snapshot.getMostRetained(cls.isolate, classId: cls.vmCid, |
| 47 limit: 10))) | 53 limit: 10))) |
| 48 .then((List<ServiceObject> most) { | 54 .then((List<ServiceObject> most) { |
| 49 mostRetained = new ObservableList.from(most); | 55 mostRetained = new ObservableList.from(most); |
| 50 }); | 56 }); |
| 51 } | 57 } |
| 52 | 58 |
| 53 // TODO(koda): Add no-arg "calculate-link" instead of reusing "eval-link". | 59 // TODO(koda): Add no-arg "calculate-link" instead of reusing "eval-link". |
| 54 Future<ServiceObject> reachableSize(var dummy) { | 60 Future<ServiceObject> reachableSize(var dummy) { |
| 55 return cls.isolate.getReachableSize(cls).then((Instance obj) { | 61 return cls.isolate.getReachableSize(cls).then((Instance obj) { |
| 56 reachableBytes = int.parse(obj.valueAsString); | 62 reachableBytes = int.parse(obj.valueAsString); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 Future toggleAllocationTrace() { | 123 Future toggleAllocationTrace() { |
| 118 if (cls == null) { | 124 if (cls == null) { |
| 119 return new Future(refresh); | 125 return new Future(refresh); |
| 120 } | 126 } |
| 121 if (cls.traceAllocations) { | 127 if (cls.traceAllocations) { |
| 122 refreshAllocationProfile(); | 128 refreshAllocationProfile(); |
| 123 } | 129 } |
| 124 return cls.setTraceAllocations(!cls.traceAllocations).whenComplete(refresh); | 130 return cls.setTraceAllocations(!cls.traceAllocations).whenComplete(refresh); |
| 125 } | 131 } |
| 126 } | 132 } |
| OLD | NEW |