Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(353)

Side by Side Diff: runtime/bin/vmservice/observatory/lib/src/elements/inbound_reference.dart

Issue 511413002: Revert "Give instances their own model class; move DartErrors out of instance-ref into their own er… (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 inbound_reference_element; 5 library inbound_reference_element;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'package:polymer/polymer.dart'; 8 import 'package:polymer/polymer.dart';
9 import 'package:observatory/service.dart'; 9 import 'package:observatory/service.dart';
10 import 'service_ref.dart'; 10 import 'service_ref.dart';
11 11
12 @CustomTag('inbound-reference') 12 @CustomTag('inbound-reference')
13 class InboundReferenceElement extends ServiceRefElement { 13 class InboundReferenceElement extends ServiceRefElement {
14 @published ObservableMap ref;
15 InboundReferenceElement.created() : super.created(); 14 InboundReferenceElement.created() : super.created();
16 15
17 dynamic get slot => (ref as ServiceMap)['slot']; 16 dynamic get slot => (ref as ServiceMap)['slot'];
18 bool get slotIsArrayIndex => slot is num; 17 bool get slotIsArrayIndex => slot is num;
19 bool get slotIsField => slot is ServiceMap && slot['type'] == '@Field'; 18 bool get slotIsField => slot is ServiceMap && slot['type'] == '@Field';
20 19
21 ServiceObject get source => (ref as ServiceMap)['source']; 20 ServiceObject get source => (ref as ServiceMap)['source'];
22 21
23 // I.e., inbound references to 'source' for recursive pointer chasing. 22 // I.e., inbound references to 'source' for recursive pointer chasing.
24 @observable ObservableList inboundReferences; 23 @observable ObservableList inboundReferences;
25 Future<ServiceObject> fetchInboundReferences(arg) { 24 Future<ServiceObject> fetchInboundReferences(arg) {
26 return source.isolate.get(source.id + "/inbound_references?limit=$arg") 25 return source.isolate.get(source.id + "/inbound_references?limit=$arg")
27 .then((ServiceMap response) { 26 .then((ServiceMap response) {
28 inboundReferences = new ObservableList.from(response['references']); 27 inboundReferences = new ObservableList.from(response['references']);
29 }); 28 });
30 } 29 }
31 30
32 // TODO(turnidge): This is here to workaround vm/dart2js differences. 31 // TODO(turnidge): This is here to workaround vm/dart2js differences.
33 dynamic expander() { 32 dynamic expander() {
34 return expandEvent; 33 return expandEvent;
35 } 34 }
36 35
37 void expandEvent(bool expand, var done) { 36 void expandEvent(bool expand, var done) {
38 assert(ref is ServiceMap); 37 assert(ref is ServiceMap);
39 if (expand) { 38 if (expand) {
40 fetchInboundReferences(100).then((result) { 39 fetchInboundReferences(100).then((result) {
41 notifyPropertyChange(#ref, 0, 1); 40 notifyPropertyChange(#ref, 0, 1);
42 }).whenComplete(done); 41 }).whenComplete(done);
43 } else { 42 } else {
44 inboundReferences = null; 43 ServiceMap refMap = ref;
44 refMap['fields'] = null;
45 refMap['elements'] = null;
45 done(); 46 done();
46 } 47 }
47 } 48 }
48 } 49 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698