| 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 instance_ref_element; | |
| 6 | |
| 7 import 'package:polymer/polymer.dart'; | |
| 8 import 'package:observatory/service.dart'; | |
| 9 import 'service_ref.dart'; | |
| 10 | |
| 11 @CustomTag('instance-ref') | |
| 12 class InstanceRefElement extends ServiceRefElement { | |
| 13 InstanceRefElement.created() : super.created(); | |
| 14 | |
| 15 String get hoverText { | |
| 16 if (ref != null) { | |
| 17 if (ref.type == 'Sentinel') { | |
| 18 if (ref.id == 'objects/optimized-out') { | |
| 19 return 'This object is no longer needed and has been removed by the op
timizing compiler.'; | |
| 20 } else if (ref.id == 'objects/collected') { | |
| 21 return 'This object has been reclaimed by the garbage collector.'; | |
| 22 } else if (ref.id == 'objects/expired') { | |
| 23 return 'The handle to this object has expired. Consider refreshing th
e page.'; | |
| 24 } else if (ref.id == 'objects/not-initialized') { | |
| 25 return 'This object will be initialized once it is accessed by the pro
gram.'; | |
| 26 } else if (ref.id == 'objects/being-initialized') { | |
| 27 return 'This object is currently being initialized.'; | |
| 28 } | |
| 29 } | |
| 30 } | |
| 31 return super.hoverText; | |
| 32 } | |
| 33 | |
| 34 // TODO(turnidge): This is here to workaround vm/dart2js differences. | |
| 35 dynamic expander() { | |
| 36 return expandEvent; | |
| 37 } | |
| 38 | |
| 39 void expandEvent(bool expand, Function onDone) { | |
| 40 assert(ref is Instance); | |
| 41 if (expand) { | |
| 42 ref.reload().then((result) { | |
| 43 if (result.valueAsString != null) { | |
| 44 result.name = result.valueAsString; | |
| 45 result.vmName = result.valueAsString; | |
| 46 } | |
| 47 ref = result; | |
| 48 notifyPropertyChange(#ref, 0, 1); | |
| 49 }).whenComplete(onDone); | |
| 50 } else { | |
| 51 Instance refMap = ref; | |
| 52 refMap.fields = null; | |
| 53 refMap.elements = null; | |
| 54 onDone(); | |
| 55 } | |
| 56 } | |
| 57 } | |
| OLD | NEW |