| 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/cpu_profile.dart'; |
| 10 import 'package:observatory/elements.dart'; |
| 9 import 'package:observatory/service.dart'; | 11 import 'package:observatory/service.dart'; |
| 10 import 'package:polymer/polymer.dart'; | 12 import 'package:polymer/polymer.dart'; |
| 11 | 13 |
| 12 @CustomTag('class-view') | 14 @CustomTag('class-view') |
| 13 class ClassViewElement extends ObservatoryElement { | 15 class ClassViewElement extends ObservatoryElement { |
| 14 @published Class cls; | 16 @published Class cls; |
| 15 @observable ServiceMap instances; | 17 @observable ServiceMap instances; |
| 16 @observable int retainedBytes; | 18 @observable int retainedBytes; |
| 17 @observable ObservableList mostRetained; | 19 @observable ObservableList mostRetained; |
| 18 ClassViewElement.created() : super.created(); | 20 ClassViewElement.created() : super.created(); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 mostRetained = null; | 56 mostRetained = null; |
| 55 var loads = []; | 57 var loads = []; |
| 56 loads.add(cls.reload()); | 58 loads.add(cls.reload()); |
| 57 cls.fields.forEach((field) => loads.add(field.reload())); | 59 cls.fields.forEach((field) => loads.add(field.reload())); |
| 58 return Future.wait(loads); | 60 return Future.wait(loads); |
| 59 } | 61 } |
| 60 | 62 |
| 61 Future refreshCoverage() { | 63 Future refreshCoverage() { |
| 62 return cls.refreshCoverage(); | 64 return cls.refreshCoverage(); |
| 63 } | 65 } |
| 66 |
| 67 final CpuProfile profile = new CpuProfile(); |
| 68 |
| 69 Future refreshAllocationProfile() async { |
| 70 var profileResponse = await cls.getAllocationSamples('UserVM'); |
| 71 profile.load(profileResponse.isolate, profileResponse); |
| 72 CpuProfileTreeElement cpuProfileTreeElement = |
| 73 shadowRoot.querySelector('#cpuProfileTree'); |
| 74 cpuProfileTreeElement.profile = profile; |
| 75 cpuProfileTreeElement.direction = ProfileTreeDirection.Exclusive; |
| 76 cpuProfileTreeElement.mode = ProfileTreeMode.Function; |
| 77 cpuProfileTreeElement.render(); |
| 78 } |
| 79 |
| 80 Future toggleAllocationTrace() { |
| 81 if (cls == null) { |
| 82 return new Future(refresh); |
| 83 } |
| 84 return cls.setTraceAllocations(!cls.traceAllocations).whenComplete(refresh); |
| 85 } |
| 64 } | 86 } |
| OLD | NEW |