Chromium Code Reviews| 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('inbound-reference') | |
| 12 class InboundReferenceElement extends ServiceRefElement { | |
| 13 InboundReferenceElement.created() : super.created(); | |
| 14 | |
| 15 dynamic get slot => ref['slot']; | |
| 16 bool get slotIsNum => slot is num; | |
|
koda
2014/08/21 18:21:20
Consider something more descriptive, like "array i
Cutch
2014/08/21 20:08:55
slotIsListIndex
| |
| 17 bool get slotIsField => slot is ServiceMap && slot['type'] == '@Field'; | |
| 18 | |
| 19 ServiceObject get source => ref['source']; | |
| 20 | |
| 21 // I.e., inbound references to 'source' for recursive pointer chasing. | |
| 22 @observable ObservableList inboundReferences; | |
| 23 Future<ServiceObject> fetchInboundReferences(arg) { | |
| 24 return source.isolate.get(source.id + "/inbound_references?limit=$arg") | |
| 25 .then((ServiceMap response) { | |
| 26 inboundReferences = new ObservableList.from(response['references']); | |
| 27 }); | |
| 28 } | |
| 29 | |
| 30 // TODO(turnidge): This is here to workaround vm/dart2js differences. | |
| 31 dynamic expander() { | |
| 32 return expandEvent; | |
| 33 } | |
| 34 | |
| 35 void expandEvent(bool expand, var done) { | |
| 36 assert(ref is ServiceMap); | |
| 37 if (expand) { | |
| 38 fetchInboundReferences(100).then((result) { | |
| 39 notifyPropertyChange(#ref, 0, 1); | |
| 40 }).whenComplete(done); | |
| 41 } else { | |
| 42 ServiceMap refMap = ref; | |
| 43 refMap['fields'] = null; | |
| 44 refMap['elements'] = null; | |
| 45 done(); | |
| 46 } | |
| 47 } | |
| 48 } | |
| OLD | NEW |