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

Side by Side Diff: runtime/bin/vmservice/client/lib/src/observatory_elements/instance_ref.dart

Issue 164183003: Add expandable instances and lists to the vm service. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: gen js Created 6 years, 10 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 instance_ref_element; 5 library instance_ref_element;
6 6
7 import 'package:logging/logging.dart';
7 import 'package:polymer/polymer.dart'; 8 import 'package:polymer/polymer.dart';
8 import 'service_ref.dart'; 9 import 'service_ref.dart';
9 10
10 @CustomTag('instance-ref') 11 @CustomTag('instance-ref')
11 class InstanceRefElement extends ServiceRefElement { 12 class InstanceRefElement extends ServiceRefElement {
12 InstanceRefElement.created() : super.created(); 13 InstanceRefElement.created() : super.created();
13 14
15 @published bool expanded = false;
16
14 String get name { 17 String get name {
15 if (ref == null) { 18 if (ref == null) {
16 return super.name; 19 return super.name;
17 } 20 }
18 return ref['preview']; 21 return ref['preview'];
19 } 22 }
20 } 23
24 void toggleExpand(var a, var b, var c) {
25 if (expanded) {
26 ref['fields'] = null;
27 ref['elements'] = null;
28 expanded = false;
29 } else {
30 app.requestManager.requestMap(url).then((map) {
31 print(map);
32 ref['fields'] = map['fields'];
33 ref['elements'] = map['elements'];
34 ref['length'] = map['length'];
35 expanded = true;
36 }).catchError((e, trace) {
37 Logger.root.severe('Error while expanding instance-ref: $e\n$trace');
38 });
39 }
40 }
41 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698