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

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

Issue 2119733003: Wrapping leaf nodes in non polymer elements (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Converted vm-connect Created 4 years, 5 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
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
9 import 'package:logging/logging.dart';
10 import 'package:observatory/service.dart'; 7 import 'package:observatory/service.dart';
11 import 'package:polymer/polymer.dart'; 8 import 'package:polymer/polymer.dart';
12 9
13 import 'class_ref.dart';
14 import 'library_ref.dart';
15 import 'observatory_element.dart'; 10 import 'observatory_element.dart';
16 11
17 @CustomTag('service-ref') 12 @CustomTag('service-ref')
18 class ServiceRefElement extends ObservatoryElement { 13 class ServiceRefElement extends ObservatoryElement {
19 @published ServiceObject ref; 14 @published ServiceObject ref;
20 @published bool internal = false; 15 @published bool internal = false;
21 @published String expandKey; 16 @published String expandKey;
22 ServiceRefElement.created() : super.created(); 17 ServiceRefElement.created() : super.created();
23 18
24 void refChanged(oldValue) { 19 void refChanged(oldValue) {
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 notifyPropertyChange(#ref, 0, 1); 68 notifyPropertyChange(#ref, 0, 1);
74 expanded = true; 69 expanded = true;
75 }).whenComplete(onDone); 70 }).whenComplete(onDone);
76 } else { 71 } else {
77 expanded = false; 72 expanded = false;
78 onDone(); 73 onDone();
79 } 74 }
80 } 75 }
81 } 76 }
82 77
83
84 @CustomTag('any-service-ref')
85 class AnyServiceRefElement extends ObservatoryElement {
86 @published ServiceObject ref;
87 @published String expandKey;
88 @published bool asValue = false;
89 AnyServiceRefElement.created() : super.created();
90
91 Element _constructElementForRef() {
92 var type = ref.type;
93 switch (type) {
94 case 'Class':
95 ClassRefElement element = new Element.tag('class-ref');
96 element.ref = ref;
97 element.asValue = asValue;
98 return element;
99 case 'Code':
100 ServiceRefElement element = new Element.tag('code-ref');
101 element.ref = ref;
102 return element;
103 case 'Context':
104 ServiceRefElement element = new Element.tag('context-ref');
105 element.ref = ref;
106 return element;
107 case 'Error':
108 ServiceRefElement element = new Element.tag('error-ref');
109 element.ref = ref;
110 return element;
111 case 'Field':
112 ServiceRefElement element = new Element.tag('field-ref');
113 element.ref = ref;
114 return element;
115 case 'Function':
116 ServiceRefElement element = new Element.tag('function-ref');
117 element.ref = ref;
118 return element;
119 case 'Library':
120 LibraryRefElement element = new Element.tag('library-ref');
121 element.ref = ref;
122 element.asValue = asValue;
123 return element;
124 case 'Object':
125 ServiceRefElement element = new Element.tag('object-ref');
126 element.ref = ref;
127 return element;
128 case 'Script':
129 ServiceRefElement element = new Element.tag('script-ref');
130 element.ref = ref;
131 return element;
132 case 'Instance':
133 case 'Sentinel':
134 ServiceRefElement element = new Element.tag('instance-ref');
135 element.ref = ref;
136 if (expandKey != null) {
137 element.expandKey = expandKey;
138 }
139 return element;
140 default:
141 SpanElement element = new Element.tag('span');
142 element.text = "<<Unknown service ref: $ref>>";
143 return element;
144 }
145 }
146
147 refChanged(oldValue) {
148 // Remove the current view.
149 children.clear();
150 if (ref == null) {
151 Logger.root.info('Viewing null object.');
152 return;
153 }
154 var type = ref.type;
155 var element = _constructElementForRef();
156 if (element == null) {
157 Logger.root.info('Unable to find a ref element for \'${type}\'');
158 return;
159 }
160 children.add(element);
161 }
162 }
163
164 @CustomTag('object-ref') 78 @CustomTag('object-ref')
165 class ObjectRefElement extends ServiceRefElement { 79 class ObjectRefElement extends ServiceRefElement {
166 ObjectRefElement.created() : super.created(); 80 ObjectRefElement.created() : super.created();
167 } 81 }
OLDNEW
« no previous file with comments | « runtime/observatory/lib/src/elements/script_view.html ('k') | runtime/observatory/lib/src/elements/service_ref.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698