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

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

Issue 839543002: Revert "Build Observatory with runtime" (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 11 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
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 library service_object_view_element;
6
7 import 'dart:html';
8 import 'package:logging/logging.dart';
9 import 'package:observatory/service.dart';
10 import 'package:observatory/tracer.dart';
11 import 'package:observatory/elements.dart';
12 import 'package:polymer/polymer.dart';
13 import 'observatory_element.dart';
14
15 @CustomTag('service-view')
16 class ServiceObjectViewElement extends ObservatoryElement {
17 @published ServiceObject object;
18 @published ObservableMap args;
19
20 ServiceObjectViewElement.created() : super.created();
21
22 ObservatoryElement _constructElementForObject() {
23 var type = object.type;
24 switch (type) {
25 case 'AllocationProfile':
26 HeapProfileElement element = new Element.tag('heap-profile');
27 element.profile = object;
28 return element;
29 case 'BreakpointList':
30 BreakpointListElement element = new Element.tag('breakpoint-list');
31 element.msg = object;
32 return element;
33 case 'Class':
34 ClassViewElement element = new Element.tag('class-view');
35 element.cls = object;
36 return element;
37 case 'Code':
38 CodeViewElement element = new Element.tag('code-view');
39 element.code = object;
40 return element;
41 case 'Context':
42 ContextViewElement element = new Element.tag('context-view');
43 element.context = object;
44 return element;
45 case 'Error':
46 ErrorViewElement element = new Element.tag('error-view');
47 element.error = object;
48 return element;
49 case 'Field':
50 FieldViewElement element = new Element.tag('field-view');
51 element.field = object;
52 return element;
53 case 'FlagList':
54 FlagListElement element = new Element.tag('flag-list');
55 element.flagList = object;
56 return element;
57 case 'Function':
58 FunctionViewElement element = new Element.tag('function-view');
59 element.function = object;
60 return element;
61 case 'HeapMap':
62 HeapMapElement element = new Element.tag('heap-map');
63 element.fragmentation = object;
64 return element;
65 case 'IO':
66 IOViewElement element = new Element.tag('io-view');
67 element.io = object;
68 return element;
69 case 'HttpServerList':
70 IOHttpServerListViewElement element =
71 new Element.tag('io-http-server-list-view');
72 element.list = object;
73 return element;
74 case 'HttpServer':
75 IOHttpServerViewElement element =
76 new Element.tag('io-http-server-view');
77 element.httpServer = object;
78 return element;
79 case 'HttpServerConnection':
80 IOHttpServerConnectionViewElement element =
81 new Element.tag('io-http-server-connection-view');
82 element.connection = object;
83 return element;
84 case 'Object':
85 ObjectViewElement element = new Element.tag('object-view');
86 element.object = object;
87 return element;
88 case 'SocketList':
89 IOSocketListViewElement element =
90 new Element.tag('io-socket-list-view');
91 element.list = object;
92 return element;
93 case 'Socket':
94 IOSocketViewElement element = new Element.tag('io-socket-view');
95 element.socket = object;
96 return element;
97 case 'WebSocketList':
98 IOWebSocketListViewElement element =
99 new Element.tag('io-web-socket-list-view');
100 element.list = object;
101 return element;
102 case 'WebSocket':
103 IOWebSocketViewElement element = new Element.tag('io-web-socket-view');
104 element.webSocket = object;
105 return element;
106 case 'Isolate':
107 IsolateViewElement element = new Element.tag('isolate-view');
108 element.isolate = object;
109 return element;
110 case 'Library':
111 LibraryViewElement element = new Element.tag('library-view');
112 element.library = object;
113 return element;
114 case 'ProcessList':
115 IOProcessListViewElement element =
116 new Element.tag('io-process-list-view');
117 element.list = object;
118 return element;
119 case 'Process':
120 IOProcessViewElement element = new Element.tag('io-process-view');
121 element.process = object;
122 return element;
123 case 'Profile':
124 IsolateProfileElement element = new Element.tag('isolate-profile');
125 element.profile = object;
126 return element;
127 case 'RandomAccessFileList':
128 IORandomAccessFileListViewElement element =
129 new Element.tag('io-random-access-file-list-view');
130 element.list = object;
131 return element;
132 case 'RandomAccessFile':
133 IORandomAccessFileViewElement element =
134 new Element.tag('io-random-access-file-view');
135 element.file = object;
136 return element;
137 case 'ServiceError':
138 ServiceErrorViewElement element =
139 new Element.tag('service-error-view');
140 element.error = object;
141 return element;
142 case 'ServiceException':
143 ServiceExceptionViewElement element =
144 new Element.tag('service-exception-view');
145 element.exception = object;
146 return element;
147 case 'Script':
148 ScriptViewElement element = new Element.tag('script-view');
149 element.script = object;
150 return element;
151 case 'VM':
152 VMViewElement element = new Element.tag('vm-view');
153 element.vm = object;
154 return element;
155 default:
156 if (object.isInstance ||
157 object.isSentinel) { // TODO(rmacnak): Separate this out.
158 InstanceViewElement element = new Element.tag('instance-view');
159 element.instance = object;
160 return element;
161 } else {
162 JsonViewElement element = new Element.tag('json-view');
163 element.map = object;
164 return element;
165 }
166 }
167 }
168
169 objectChanged(oldValue) {
170 // Remove the current view.
171 children.clear();
172 if (object == null) {
173 Logger.root.info('Viewing null object.');
174 return;
175 }
176 var type = object.vmType;
177 var element = _constructElementForObject();
178 if (element == null) {
179 Logger.root.info('Unable to find a view element for \'${type}\'');
180 return;
181 }
182 children.add(element);
183 Logger.root.info('Viewing object of \'${type}\'');
184 }
185 }
186
187 @CustomTag('trace-view')
188 class TraceViewElement extends ObservatoryElement {
189 @published Tracer tracer;
190 TraceViewElement.created() : super.created();
191 }
192
193 @CustomTag('map-viewer')
194 class MapViewerElement extends ObservatoryElement {
195 @published Map map;
196 @published bool expand = false;
197 MapViewerElement.created() : super.created();
198
199 bool isMap(var m) {
200 return m is Map;
201 }
202
203 bool isList(var m) {
204 return m is List;
205 }
206
207 dynamic expander() {
208 return expandEvent;
209 }
210
211 void expandEvent(bool exp, var done) {
212 expand = exp;
213 done();
214 }
215 }
216
217 @CustomTag('list-viewer')
218 class ListViewerElement extends ObservatoryElement {
219 @published List list;
220 @published bool expand = false;
221 ListViewerElement.created() : super.created();
222
223 bool isMap(var m) {
224 return m is Map;
225 }
226
227 bool isList(var m) {
228 return m is List;
229 }
230
231 dynamic expander() {
232 return expandEvent;
233 }
234
235 void expandEvent(bool exp, var done) {
236 expand = exp;
237 done();
238 }
239 }
OLDNEW
« no previous file with comments | « runtime/observatory/lib/src/elements/service_ref.html ('k') | runtime/observatory/lib/src/elements/service_view.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698