| 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 object_common_element; | 5 library object_common_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('object-common') | 12 @CustomTag('object-common') |
| 13 class ObjectCommonElement extends ObservatoryElement { | 13 class ObjectCommonElement extends ObservatoryElement { |
| 14 @published ServiceObject object; | 14 @published ServiceObject object; |
| 15 @published ServiceMap path; | 15 @published ServiceMap path; |
| 16 @published ServiceMap inboundReferences; | 16 @published ServiceMap inboundReferences; |
| 17 @observable int retainedBytes = null; | 17 @observable int retainedBytes = null; |
| 18 @observable int reachableBytes = null; |
| 18 | 19 |
| 19 ObjectCommonElement.created() : super.created(); | 20 ObjectCommonElement.created() : super.created(); |
| 20 | 21 |
| 21 // TODO(koda): Add no-arg "calculate-link" instead of reusing "eval-link". | 22 // TODO(koda): Add no-arg "calculate-link" instead of reusing "eval-link". |
| 23 Future<ServiceObject> reachableSize(var dummy) { |
| 24 return object.isolate.getReachableSize(object).then((Instance obj) { |
| 25 // TODO(turnidge): Handle collected/expired objects gracefully. |
| 26 reachableBytes = int.parse(obj.valueAsString); |
| 27 }); |
| 28 } |
| 29 |
| 22 Future<ServiceObject> retainedSize(var dummy) { | 30 Future<ServiceObject> retainedSize(var dummy) { |
| 23 return object.isolate.getRetainedSize(object).then((Instance obj) { | 31 return object.isolate.getRetainedSize(object).then((Instance obj) { |
| 24 // TODO(turnidge): Handle collected/expired objects gracefully. | 32 // TODO(turnidge): Handle collected/expired objects gracefully. |
| 25 retainedBytes = int.parse(obj.valueAsString); | 33 retainedBytes = int.parse(obj.valueAsString); |
| 26 }); | 34 }); |
| 27 } | 35 } |
| 28 | 36 |
| 29 Future<ServiceObject> retainingPath(var limit) { | 37 Future<ServiceObject> retainingPath(var limit) { |
| 30 return object.isolate.getRetainingPath(object, limit).then((ServiceObject ob
j) { | 38 return object.isolate.getRetainingPath(object, limit).then((ServiceObject ob
j) { |
| 31 path = obj; | 39 path = obj; |
| 32 }); | 40 }); |
| 33 } | 41 } |
| 34 | 42 |
| 35 Future<ServiceObject> fetchInboundReferences(var limit) { | 43 Future<ServiceObject> fetchInboundReferences(var limit) { |
| 36 return object.isolate.getInboundReferences(object, limit) | 44 return object.isolate.getInboundReferences(object, limit) |
| 37 .then((ServiceObject obj) { | 45 .then((ServiceObject obj) { |
| 38 inboundReferences = obj; | 46 inboundReferences = obj; |
| 39 }); | 47 }); |
| 40 } | 48 } |
| 41 | 49 |
| 42 Future refresh() { | 50 Future refresh() { |
| 43 return object.reload(); | 51 return object.reload(); |
| 44 } | 52 } |
| 45 } | 53 } |
| OLD | NEW |