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

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

Issue 483103003: Incoming references service request and UI. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: build Created 6 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: runtime/bin/vmservice/observatory/lib/src/elements/inbound_reference.dart
diff --git a/runtime/bin/vmservice/observatory/lib/src/elements/inbound_reference.dart b/runtime/bin/vmservice/observatory/lib/src/elements/inbound_reference.dart
new file mode 100644
index 0000000000000000000000000000000000000000..cb738b5662d45e774c2355fe0db8e72279daa884
--- /dev/null
+++ b/runtime/bin/vmservice/observatory/lib/src/elements/inbound_reference.dart
@@ -0,0 +1,49 @@
+// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+library inbound_reference_element;
+
+import 'dart:async';
+import 'package:polymer/polymer.dart';
+import 'package:observatory/service.dart';
+import 'service_ref.dart';
+
+@CustomTag('inbound-reference')
+class InboundReferenceElement extends ServiceRefElement {
+ InboundReferenceElement.created() : super.created();
+
+ dynamic get slot => ref['slot'];
+ bool get slotIsArrayIndex => slot is num;
+ bool get slotIsField => slot is ServiceMap && slot['type'] == '@Field';
+
+ ServiceObject get source => ref['source'];
+
+ // I.e., inbound references to 'source' for recursive pointer chasing.
+ @observable ObservableList inboundReferences;
+ Future<ServiceObject> fetchInboundReferences(arg) {
+ return source.isolate.get(source.id + "/inbound_references?limit=$arg")
+ .then((ServiceMap response) {
+ inboundReferences = new ObservableList.from(response['references']);
+ });
+ }
+
+ // TODO(turnidge): This is here to workaround vm/dart2js differences.
+ dynamic expander() {
+ return expandEvent;
+ }
+
+ void expandEvent(bool expand, var done) {
+ assert(ref is ServiceMap);
+ if (expand) {
+ fetchInboundReferences(100).then((result) {
+ notifyPropertyChange(#ref, 0, 1);
+ }).whenComplete(done);
+ } else {
+ ServiceMap refMap = ref;
+ refMap['fields'] = null;
+ refMap['elements'] = null;
+ done();
+ }
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698