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

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

Issue 2345023003: Use dartfmt on Observatory code (Closed)
Patch Set: merge Created 4 years, 3 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) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 import 'dart:html'; 5 import 'dart:html';
6 import 'dart:async'; 6 import 'dart:async';
7 import 'package:observatory/models.dart' as M; 7 import 'package:observatory/models.dart' as M;
8 import 'package:observatory/src/elements/helpers/rendering_scheduler.dart'; 8 import 'package:observatory/src/elements/helpers/rendering_scheduler.dart';
9 import 'package:observatory/src/elements/helpers/tag.dart'; 9 import 'package:observatory/src/elements/helpers/tag.dart';
10 import 'package:observatory/src/elements/helpers/uris.dart'; 10 import 'package:observatory/src/elements/helpers/uris.dart';
11 11
12 class EventDeleteEvent{ 12 class EventDeleteEvent {
13 final M.Event event; 13 final M.Event event;
14 EventDeleteEvent(this.event); 14 EventDeleteEvent(this.event);
15 } 15 }
16 16
17 class NavNotifyEventElement extends HtmlElement implements Renderable { 17 class NavNotifyEventElement extends HtmlElement implements Renderable {
18 static const tag = const Tag<NavNotifyEventElement>('nav-event'); 18 static const tag = const Tag<NavNotifyEventElement>('nav-event');
19 19
20 RenderingScheduler _r; 20 RenderingScheduler _r;
21 21
22 Stream<RenderedEvent<NavNotifyEventElement>> get onRendered => _r.onRendered; 22 Stream<RenderedEvent<NavNotifyEventElement>> get onRendered => _r.onRendered;
23 23
24 final StreamController<EventDeleteEvent> _onDelete = 24 final StreamController<EventDeleteEvent> _onDelete =
25 new StreamController<EventDeleteEvent>.broadcast(); 25 new StreamController<EventDeleteEvent>.broadcast();
26 Stream<EventDeleteEvent> get onDelete => _onDelete.stream; 26 Stream<EventDeleteEvent> get onDelete => _onDelete.stream;
27 27
28 M.Event _event; 28 M.Event _event;
29 29
30 M.Event get event => _event; 30 M.Event get event => _event;
31 31
32 factory NavNotifyEventElement(M.Event event, {RenderingQueue queue}) { 32 factory NavNotifyEventElement(M.Event event, {RenderingQueue queue}) {
33 assert(event != null); 33 assert(event != null);
34 NavNotifyEventElement e = document.createElement(tag.name); 34 NavNotifyEventElement e = document.createElement(tag.name);
35 e._r = new RenderingScheduler(e, queue: queue); 35 e._r = new RenderingScheduler(e, queue: queue);
36 e._event = event; 36 e._event = event;
37 return e; 37 return e;
38 } 38 }
39 39
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 content = _manageInspectEvent(event as M.InspectEvent); 73 content = _manageInspectEvent(event as M.InspectEvent);
74 } else if (event is M.IsolateReloadEvent) { 74 } else if (event is M.IsolateReloadEvent) {
75 content = _manageIsolateReloadEvent(event as M.IsolateReloadEvent); 75 content = _manageIsolateReloadEvent(event as M.IsolateReloadEvent);
76 } else { 76 } else {
77 return; 77 return;
78 } 78 }
79 children = [ 79 children = [
80 new DivElement() 80 new DivElement()
81 ..children = [] 81 ..children = []
82 ..children.addAll(content) 82 ..children.addAll(content)
83 ..children.add(new ButtonElement()..innerHtml = '&times;' 83 ..children.add(new ButtonElement()
84 ..onClick.map(_toEvent).listen(_delete)) 84 ..innerHtml = '&times;'
85 ..onClick.map(_toEvent).listen(_delete))
85 ]; 86 ];
86 } 87 }
87 88
88 static List<Element> _managePauseStartEvent(M.PauseStartEvent event) { 89 static List<Element> _managePauseStartEvent(M.PauseStartEvent event) {
89 return [ 90 return [
90 new SpanElement()..text = 'Isolate ', 91 new SpanElement()..text = 'Isolate ',
91 new AnchorElement( 92 new AnchorElement(href: Uris.inspect(event.isolate))
92 href: Uris.inspect(event.isolate))
93 ..text = event.isolate.name, 93 ..text = event.isolate.name,
94 new SpanElement()..text = ' is paused at isolate start', 94 new SpanElement()..text = ' is paused at isolate start',
95 new BRElement(), new BRElement(), new SpanElement()..text = '[', 95 new BRElement(),
96 new AnchorElement( 96 new BRElement(),
97 href: Uris.debugger(event.isolate)) 97 new SpanElement()..text = '[',
98 ..text = 'debug', 98 new AnchorElement(href: Uris.debugger(event.isolate))..text = 'debug',
99 new SpanElement()..text = ']' 99 new SpanElement()..text = ']'
100 ]; 100 ];
101 } 101 }
102 102
103 static List<Element> _managePauseExitEvent(M.PauseExitEvent event) { 103 static List<Element> _managePauseExitEvent(M.PauseExitEvent event) {
104 return [ 104 return [
105 new SpanElement()..text = 'Isolate ', 105 new SpanElement()..text = 'Isolate ',
106 new AnchorElement( 106 new AnchorElement(href: Uris.inspect(event.isolate))
107 href: Uris.inspect(event.isolate))
108 ..text = event.isolate.name, 107 ..text = event.isolate.name,
109 new SpanElement()..text = ' is paused at isolate exit', 108 new SpanElement()..text = ' is paused at isolate exit',
110 new BRElement(), new BRElement(), new SpanElement()..text = '[', 109 new BRElement(),
111 new AnchorElement( 110 new BRElement(),
112 href: Uris.debugger(event.isolate)) 111 new SpanElement()..text = '[',
113 ..text = 'debug', 112 new AnchorElement(href: Uris.debugger(event.isolate))..text = 'debug',
114 new SpanElement()..text = ']' 113 new SpanElement()..text = ']'
115 ]; 114 ];
116 } 115 }
117 116
118 static List<Element> _managePauseBreakpointEvent(M.PauseBreakpointEvent event) { 117 static List<Element> _managePauseBreakpointEvent(
118 M.PauseBreakpointEvent event) {
119 String message = ' is paused'; 119 String message = ' is paused';
120 if (event.breakpoint != null) { 120 if (event.breakpoint != null) {
121 message += ' at breakpoint ${event.breakpoint.number}'; 121 message += ' at breakpoint ${event.breakpoint.number}';
122 } 122 }
123 return [ 123 return [
124 new SpanElement()..text = 'Isolate ', 124 new SpanElement()..text = 'Isolate ',
125 new AnchorElement( 125 new AnchorElement(href: Uris.inspect(event.isolate))
126 href: Uris.inspect(event.isolate))
127 ..text = event.isolate.name, 126 ..text = event.isolate.name,
128 new SpanElement() 127 new SpanElement()..text = message,
129 ..text = message, 128 new BRElement(),
130 new BRElement(), new BRElement(), new SpanElement()..text = '[', 129 new BRElement(),
131 new AnchorElement( 130 new SpanElement()..text = '[',
132 href: Uris.debugger(event.isolate)) 131 new AnchorElement(href: Uris.debugger(event.isolate))..text = 'debug',
133 ..text = 'debug',
134 new SpanElement()..text = ']' 132 new SpanElement()..text = ']'
135 ]; 133 ];
136 } 134 }
137 135
138 static List<Element> _managePauseInterruptedEvent(M.PauseInterruptedEvent even t) { 136 static List<Element> _managePauseInterruptedEvent(
137 M.PauseInterruptedEvent event) {
139 return [ 138 return [
140 new SpanElement()..text = 'Isolate ', 139 new SpanElement()..text = 'Isolate ',
141 new AnchorElement( 140 new AnchorElement(href: Uris.inspect(event.isolate))
142 href: Uris.inspect(event.isolate))
143 ..text = event.isolate.name, 141 ..text = event.isolate.name,
144 new SpanElement() 142 new SpanElement()..text = ' is paused',
145 ..text = ' is paused', 143 new BRElement(),
146 new BRElement(), new BRElement(), new SpanElement()..text = '[', 144 new BRElement(),
147 new AnchorElement( 145 new SpanElement()..text = '[',
148 href: Uris.debugger(event.isolate)) 146 new AnchorElement(href: Uris.debugger(event.isolate))..text = 'debug',
149 ..text = 'debug',
150 new SpanElement()..text = ']' 147 new SpanElement()..text = ']'
151 ]; 148 ];
152 } 149 }
153 150
154 static List<Element> _managePauseExceptionEvent(M.PauseExceptionEvent event) { 151 static List<Element> _managePauseExceptionEvent(M.PauseExceptionEvent event) {
155 return [ 152 return [
156 new SpanElement()..text = 'Isolate ', 153 new SpanElement()..text = 'Isolate ',
157 new AnchorElement( 154 new AnchorElement(href: Uris.inspect(event.isolate))
158 href: Uris.inspect(event.isolate))
159 ..text = event.isolate.name, 155 ..text = event.isolate.name,
160 new SpanElement() 156 new SpanElement()..text = ' is paused due to exception',
161 ..text = ' is paused due to exception', 157 new BRElement(),
162 new BRElement(), new BRElement(), new SpanElement()..text = '[', 158 new BRElement(),
163 new AnchorElement( 159 new SpanElement()..text = '[',
164 href: Uris.debugger(event.isolate)) 160 new AnchorElement(href: Uris.debugger(event.isolate))..text = 'debug',
165 ..text = 'debug',
166 new SpanElement()..text = ']' 161 new SpanElement()..text = ']'
167 ]; 162 ];
168 } 163 }
169 164
170 static List<Element> _manageNoneEvent(M.NoneEvent event) { 165 static List<Element> _manageNoneEvent(M.NoneEvent event) {
171 return [ 166 return [
172 new SpanElement()..text = 'Isolate ', 167 new SpanElement()..text = 'Isolate ',
173 new AnchorElement( 168 new AnchorElement(href: Uris.inspect(event.isolate))
174 href: Uris.inspect(event.isolate))
175 ..text = event.isolate.name, 169 ..text = event.isolate.name,
176 new SpanElement() 170 new SpanElement()..text = ' is paused',
177 ..text = ' is paused', 171 new BRElement(),
178 new BRElement(), new BRElement(), new SpanElement()..text = '[', 172 new BRElement(),
179 new AnchorElement( 173 new SpanElement()..text = '[',
180 href: Uris.debugger(event.isolate)) 174 new AnchorElement(href: Uris.debugger(event.isolate))..text = 'debug',
181 ..text = 'debug',
182 new SpanElement()..text = ']' 175 new SpanElement()..text = ']'
183 ]; 176 ];
184 } 177 }
185 178
186 static List<Element> _manageConnectionClosedEvent(M.ConnectionClosedEvent even t) { 179 static List<Element> _manageConnectionClosedEvent(
180 M.ConnectionClosedEvent event) {
187 return [ 181 return [
188 new SpanElement()..text = 'Disconnected from VM: ${event.reason}', 182 new SpanElement()..text = 'Disconnected from VM: ${event.reason}',
189 new BRElement(), new BRElement(), new SpanElement()..text = '[', 183 new BRElement(),
184 new BRElement(),
185 new SpanElement()..text = '[',
190 new AnchorElement(href: Uris.vmConnect())..text = 'Connect to a VM', 186 new AnchorElement(href: Uris.vmConnect())..text = 'Connect to a VM',
191 new SpanElement()..text = ']' 187 new SpanElement()..text = ']'
192 ]; 188 ];
193 } 189 }
194 190
195 static List<Element> _manageInspectEvent(M.InspectEvent event) { 191 static List<Element> _manageInspectEvent(M.InspectEvent event) {
196 return [ 192 return [
197 new SpanElement()..text = 'Inspect ${event.inspectee.id}', 193 new SpanElement()..text = 'Inspect ${event.inspectee.id}',
198 new BRElement(), new BRElement(), new SpanElement()..text = '[', 194 new BRElement(), new BRElement(), new SpanElement()..text = '[',
199 new AnchorElement(href: Uris.inspect(event.isolate, 195 new AnchorElement(
200 object: event.inspectee)) 196 href: Uris.inspect(event.isolate, object: event.inspectee))
201 ..text = 'Inspect', 197 ..text = 'Inspect',
202 new SpanElement()..text = ']' 198 new SpanElement()..text = ']'
203 // TODO(cbernaschina) add InstanceRefElement back. 199 // TODO(cbernaschina) add InstanceRefElement back.
204 //new InstanceRefElement()..instance = event.inspectee 200 //new InstanceRefElement()..instance = event.inspectee
205 ]; 201 ];
206 } 202 }
207 203
208 static List<Element> _manageIsolateReloadEvent(M.IsolateReloadEvent event) { 204 static List<Element> _manageIsolateReloadEvent(M.IsolateReloadEvent event) {
209 if (event.error != null) { 205 if (event.error != null) {
210 return [ 206 return [
211 new SpanElement()..text = 'Isolate reload failed:', 207 new SpanElement()..text = 'Isolate reload failed:',
212 new BRElement(), new BRElement(), 208 new BRElement(),
209 new BRElement(),
213 new DivElement() 210 new DivElement()
214 ..classes = ["indent", "error"] 211 ..classes = ["indent", "error"]
215 ..text = event.error.message.toString() 212 ..text = event.error.message.toString()
216 ]; 213 ];
217 } else { 214 } else {
218 return [new SpanElement()..text = 'Isolate reload']; 215 return [new SpanElement()..text = 'Isolate reload'];
219 } 216 }
220 } 217 }
221 218
222 EventDeleteEvent _toEvent(_) { 219 EventDeleteEvent _toEvent(_) {
223 return new EventDeleteEvent(_event); 220 return new EventDeleteEvent(_event);
224 } 221 }
225 222
226 void _delete(EventDeleteEvent e) { 223 void _delete(EventDeleteEvent e) {
227 _onDelete.add(e); 224 _onDelete.add(e);
228 } 225 }
229 226
230 void delete() { 227 void delete() {
231 _onDelete.add(new EventDeleteEvent(_event)); 228 _onDelete.add(new EventDeleteEvent(_event));
232 } 229 }
233 } 230 }
OLDNEW
« no previous file with comments | « runtime/observatory/lib/src/elements/nav/notify.dart ('k') | runtime/observatory/lib/src/elements/nav/notify_exception.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698