OLD | NEW |
| (Empty) |
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 | |
3 // BSD-style license that can be found in the LICENSE file. | |
4 | |
5 library class_view_element; | |
6 | |
7 import 'dart:async'; | |
8 import 'observatory_element.dart'; | |
9 import 'package:observatory/service.dart'; | |
10 import 'package:polymer/polymer.dart'; | |
11 | |
12 @CustomTag('class-view') | |
13 class ClassViewElement extends ObservatoryElement { | |
14 @published Class cls; | |
15 @observable ServiceMap instances; | |
16 @observable int retainedBytes; | |
17 ClassViewElement.created() : super.created(); | |
18 | |
19 Future<ServiceObject> eval(String text) { | |
20 return cls.get("eval?expr=${Uri.encodeComponent(text)}"); | |
21 } | |
22 | |
23 Future<ServiceObject> reachable(var limit) { | |
24 return cls.get("instances?limit=$limit") | |
25 .then((ServiceMap obj) { | |
26 instances = obj; | |
27 }); | |
28 } | |
29 | |
30 // TODO(koda): Add no-arg "calculate-link" instead of reusing "eval-link". | |
31 Future<ServiceObject> retainedSize(var dummy) { | |
32 return cls.get("retained").then((Instance obj) { | |
33 retainedBytes = int.parse(obj.valueAsString); | |
34 }); | |
35 } | |
36 | |
37 void refresh(var done) { | |
38 instances = null; | |
39 retainedBytes = null; | |
40 cls.reload().whenComplete(done); | |
41 } | |
42 | |
43 void refreshCoverage(var done) { | |
44 cls.refreshCoverage().whenComplete(done); | |
45 } | |
46 } | |
OLD | NEW |