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

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

Issue 483103003: Incoming references service request and UI. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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 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 service_ref_element; 5 library service_ref_element;
6 6
7 import 'dart:html';
8 import 'package:logging/logging.dart';
7 import 'package:polymer/polymer.dart'; 9 import 'package:polymer/polymer.dart';
8 import 'observatory_element.dart'; 10 import 'observatory_element.dart';
9 import 'package:observatory/service.dart'; 11 import 'package:observatory/service.dart';
10 12
11 @CustomTag('service-ref') 13 @CustomTag('service-ref')
12 class ServiceRefElement extends ObservatoryElement { 14 class ServiceRefElement extends ObservatoryElement {
13 @published ServiceObject ref; 15 @published ServiceObject ref;
14 @published bool internal = false; 16 @published bool internal = false;
15 ServiceRefElement.created() : super.created(); 17 ServiceRefElement.created() : super.created();
16 18
(...skipping 30 matching lines...) Expand all
47 return 'NULL REF'; 49 return 'NULL REF';
48 } 50 }
49 return ref.name; 51 return ref.name;
50 } 52 }
51 53
52 // Workaround isEmpty not being useable due to missing @MirrorsUsed. 54 // Workaround isEmpty not being useable due to missing @MirrorsUsed.
53 bool get nameIsEmpty { 55 bool get nameIsEmpty {
54 return name.isEmpty; 56 return name.isEmpty;
55 } 57 }
56 } 58 }
59
60
61 @CustomTag('service-ref-downcast')
Cutch 2014/08/21 20:08:55 Rename service-ref to be service-ref-common or ser
62 class ServiceRefDowncastElement extends ObservatoryElement {
63 @published ServiceObject ref;
64 ServiceRefDowncastElement.created() : super.created();
65
66 ObservatoryElement _constructElementForRef() {
67 var type = ref.serviceType;
68 switch (type) {
69 case 'Class':
70 ClassRefElement element = new Element.tag('class-ref');
71 element.ref = ref;
72 return element;
73 case 'Code':
74 CodeRefElement element = new Element.tag('code-ref');
75 element.ref = ref;
76 return element;
77 case 'Field':
78 FieldRefElement element = new Element.tag('field-ref');
79 element.ref = ref;
80 return element;
81 case 'Function':
82 FunctionRefElement element = new Element.tag('function-ref');
83 element.ref = ref;
84 return element;
85 case 'Library':
86 LibraryRefElement element = new Element.tag('library-ref');
87 element.ref = ref;
88 return element;
89 case 'Type':
90 case 'Array':
91 case 'Bool':
92 case 'Closure':
93 case 'Double':
94 case 'GrowableObjectArray':
95 case 'Instance':
96 case 'Smi':
97 case 'Mint':
98 case 'Bigint':
99 case 'String':
100 InstanceRefElement element = new Element.tag('instance-ref');
101 element.ref = ref;
102 return element;
103 default:
104 Element element = new Element.tag('span');
105 element.text = "<<Unknown service ref: $ref>>";
106 return element;
107 }
108 }
109
110 refChanged(oldValue) {
111 // Remove the current view.
112 children.clear();
113 if (ref == null) {
114 Logger.root.info('Viewing null object.');
115 return;
116 }
117 var type = ref.serviceType;
118 var element = _constructElementForRef();
119 if (element == null) {
120 Logger.root.info('Unable to find a ref element for \'${type}\'');
121 return;
122 }
123 children.add(element);
124 Logger.root.info('Viewing object of \'${type}\'');
125 }
126 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698