OLD | NEW |
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 'package:logging/logging.dart'; | 5 import 'package:logging/logging.dart'; |
6 import 'package:observatory/models.dart' as M; | 6 import 'package:observatory/models.dart' as M; |
7 import 'package:observatory/service.dart' as S; | 7 import 'package:observatory/service.dart' as S; |
8 | 8 |
9 class VMUpdateEvent implements M.VMUpdateEvent { | 9 class VMUpdateEvent implements M.VMUpdateEvent { |
10 final DateTime timestamp; | 10 final DateTime timestamp; |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 assert(isolate != null); | 99 assert(isolate != null); |
100 } | 100 } |
101 } | 101 } |
102 | 102 |
103 class PauseBreakpointEvent implements M.PauseBreakpointEvent { | 103 class PauseBreakpointEvent implements M.PauseBreakpointEvent { |
104 final DateTime timestamp; | 104 final DateTime timestamp; |
105 final M.IsolateRef isolate; | 105 final M.IsolateRef isolate; |
106 final Iterable<M.Breakpoint> pauseBreakpoints; | 106 final Iterable<M.Breakpoint> pauseBreakpoints; |
107 final M.Frame topFrame; | 107 final M.Frame topFrame; |
108 final bool atAsyncSuspension; | 108 final bool atAsyncSuspension; |
| 109 |
109 /// [optional] | 110 /// [optional] |
110 final M.Breakpoint breakpoint; | 111 final M.Breakpoint breakpoint; |
111 PauseBreakpointEvent(this.timestamp, this.isolate, | 112 PauseBreakpointEvent( |
112 Iterable<M.Breakpoint> pauseBreakpoints, this.topFrame, | 113 this.timestamp, |
113 this.atAsyncSuspension, [this.breakpoint]) | 114 this.isolate, |
114 : pauseBreakpoints = new List.unmodifiable(pauseBreakpoints){ | 115 Iterable<M.Breakpoint> pauseBreakpoints, |
| 116 this.topFrame, |
| 117 this.atAsyncSuspension, |
| 118 [this.breakpoint]) |
| 119 : pauseBreakpoints = new List.unmodifiable(pauseBreakpoints) { |
115 assert(timestamp != null); | 120 assert(timestamp != null); |
116 assert(isolate != null); | 121 assert(isolate != null); |
117 assert(pauseBreakpoints != null); | 122 assert(pauseBreakpoints != null); |
118 assert(topFrame != null); | 123 assert(topFrame != null); |
119 assert(atAsyncSuspension != null); | 124 assert(atAsyncSuspension != null); |
120 } | 125 } |
121 } | 126 } |
122 | 127 |
123 class PauseInterruptedEvent implements M.PauseInterruptedEvent { | 128 class PauseInterruptedEvent implements M.PauseInterruptedEvent { |
124 final DateTime timestamp; | 129 final DateTime timestamp; |
125 final M.IsolateRef isolate; | 130 final M.IsolateRef isolate; |
126 final M.Frame topFrame; | 131 final M.Frame topFrame; |
127 final bool atAsyncSuspension; | 132 final bool atAsyncSuspension; |
128 PauseInterruptedEvent(this.timestamp, this.isolate, this.topFrame, | 133 PauseInterruptedEvent( |
129 this.atAsyncSuspension) { | 134 this.timestamp, this.isolate, this.topFrame, this.atAsyncSuspension) { |
130 assert(timestamp != null); | 135 assert(timestamp != null); |
131 assert(isolate != null); | 136 assert(isolate != null); |
132 assert(atAsyncSuspension != null); | 137 assert(atAsyncSuspension != null); |
133 } | 138 } |
134 } | 139 } |
135 | 140 |
136 class PauseExceptionEvent implements M.PauseExceptionEvent { | 141 class PauseExceptionEvent implements M.PauseExceptionEvent { |
137 final DateTime timestamp; | 142 final DateTime timestamp; |
138 final M.IsolateRef isolate; | 143 final M.IsolateRef isolate; |
139 final M.Frame topFrame; | 144 final M.Frame topFrame; |
140 final M.InstanceRef exception; | 145 final M.InstanceRef exception; |
141 PauseExceptionEvent(this.timestamp, this.isolate, this.topFrame, | 146 PauseExceptionEvent( |
142 this.exception) { | 147 this.timestamp, this.isolate, this.topFrame, this.exception) { |
143 assert(timestamp != null); | 148 assert(timestamp != null); |
144 assert(isolate != null); | 149 assert(isolate != null); |
145 assert(topFrame != null); | 150 assert(topFrame != null); |
146 assert(exception != null); | 151 assert(exception != null); |
147 } | 152 } |
148 } | 153 } |
149 | 154 |
150 class ResumeEvent implements M.ResumeEvent { | 155 class ResumeEvent implements M.ResumeEvent { |
151 final DateTime timestamp; | 156 final DateTime timestamp; |
152 final M.IsolateRef isolate; | 157 final M.IsolateRef isolate; |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 assert(isolate != null); | 233 assert(isolate != null); |
229 assert(logRecord != null); | 234 assert(logRecord != null); |
230 } | 235 } |
231 } | 236 } |
232 | 237 |
233 class ExtensionEvent implements M.ExtensionEvent { | 238 class ExtensionEvent implements M.ExtensionEvent { |
234 final DateTime timestamp; | 239 final DateTime timestamp; |
235 final M.IsolateRef isolate; | 240 final M.IsolateRef isolate; |
236 final String extensionKind; | 241 final String extensionKind; |
237 final M.ExtensionData extensionData; | 242 final M.ExtensionData extensionData; |
238 ExtensionEvent(this.timestamp, this.isolate, this.extensionKind, | 243 ExtensionEvent( |
239 this.extensionData) { | 244 this.timestamp, this.isolate, this.extensionKind, this.extensionData) { |
240 assert(timestamp != null); | 245 assert(timestamp != null); |
241 assert(isolate != null); | 246 assert(isolate != null); |
242 assert(extensionKind != null); | 247 assert(extensionKind != null); |
243 assert(extensionData != null); | 248 assert(extensionData != null); |
244 } | 249 } |
245 } | 250 } |
246 | 251 |
247 class TimelineEventsEvent implements M.TimelineEventsEvent { | 252 class TimelineEventsEvent implements M.TimelineEventsEvent { |
248 final DateTime timestamp; | 253 final DateTime timestamp; |
249 final M.IsolateRef isolate; | 254 final M.IsolateRef isolate; |
250 final Iterable<M.TimelineEvent> timelineEvents; | 255 final Iterable<M.TimelineEvent> timelineEvents; |
251 TimelineEventsEvent(this.timestamp, this.isolate, | 256 TimelineEventsEvent( |
252 Iterable<M.TimelineEvent> timelineEvents) | 257 this.timestamp, this.isolate, Iterable<M.TimelineEvent> timelineEvents) |
253 : timelineEvents = new List.unmodifiable(timelineEvents){ | 258 : timelineEvents = new List.unmodifiable(timelineEvents) { |
254 assert(timestamp != null); | 259 assert(timestamp != null); |
255 assert(isolate != null); | 260 assert(isolate != null); |
256 assert(timelineEvents != null); | 261 assert(timelineEvents != null); |
257 } | 262 } |
258 } | 263 } |
259 | 264 |
260 class ConnectionClosedEvent implements M.ConnectionClosedEvent { | 265 class ConnectionClosedEvent implements M.ConnectionClosedEvent { |
261 final DateTime timestamp; | 266 final DateTime timestamp; |
262 final String reason; | 267 final String reason; |
263 ConnectionClosedEvent(this.timestamp, this.reason) { | 268 ConnectionClosedEvent(this.timestamp, this.reason) { |
264 assert(timestamp != null); | 269 assert(timestamp != null); |
265 assert(reason != null); | 270 assert(reason != null); |
266 } | 271 } |
267 } | 272 } |
268 | 273 |
269 M.Event createEventFromServiceEvent(S.ServiceEvent event) { | 274 M.Event createEventFromServiceEvent(S.ServiceEvent event) { |
270 switch(event.kind) { | 275 switch (event.kind) { |
271 case S.ServiceEvent.kVMUpdate: | 276 case S.ServiceEvent.kVMUpdate: |
272 return new VMUpdateEvent(event.timestamp, event.vm); | 277 return new VMUpdateEvent(event.timestamp, event.vm); |
273 case S.ServiceEvent.kIsolateStart: | 278 case S.ServiceEvent.kIsolateStart: |
274 return new IsolateStartEvent(event.timestamp, event.isolate); | 279 return new IsolateStartEvent(event.timestamp, event.isolate); |
275 case S.ServiceEvent.kIsolateRunnable: | 280 case S.ServiceEvent.kIsolateRunnable: |
276 return new IsolateRunnableEvent(event.timestamp, event.isolate); | 281 return new IsolateRunnableEvent(event.timestamp, event.isolate); |
277 case S.ServiceEvent.kIsolateUpdate: | 282 case S.ServiceEvent.kIsolateUpdate: |
278 return new IsolateUpdateEvent(event.timestamp, event.isolate); | 283 return new IsolateUpdateEvent(event.timestamp, event.isolate); |
279 case S.ServiceEvent.kIsolateReload: | 284 case S.ServiceEvent.kIsolateReload: |
280 return new IsolateReloadEvent(event.timestamp, event.isolate, event.error)
; | 285 return new IsolateReloadEvent( |
| 286 event.timestamp, event.isolate, event.error); |
281 case S.ServiceEvent.kIsolateExit: | 287 case S.ServiceEvent.kIsolateExit: |
282 return new IsolateExitEvent(event.timestamp, event.isolate); | 288 return new IsolateExitEvent(event.timestamp, event.isolate); |
283 case S.ServiceEvent.kBreakpointAdded: | 289 case S.ServiceEvent.kBreakpointAdded: |
284 return new BreakpointAddedEvent(event.timestamp, event.isolate, | 290 return new BreakpointAddedEvent( |
285 event.breakpoint); | 291 event.timestamp, event.isolate, event.breakpoint); |
286 case S.ServiceEvent.kBreakpointResolved: | 292 case S.ServiceEvent.kBreakpointResolved: |
287 return new BreakpointResolvedEvent(event.timestamp, event.isolate, | 293 return new BreakpointResolvedEvent( |
288 event.breakpoint); | 294 event.timestamp, event.isolate, event.breakpoint); |
289 case S.ServiceEvent.kBreakpointRemoved: | 295 case S.ServiceEvent.kBreakpointRemoved: |
290 return new BreakpointRemovedEvent(event.timestamp, event.isolate, | 296 return new BreakpointRemovedEvent( |
291 event.breakpoint); | 297 event.timestamp, event.isolate, event.breakpoint); |
292 case S.ServiceEvent.kDebuggerSettingsUpdate: | 298 case S.ServiceEvent.kDebuggerSettingsUpdate: |
293 return new DebuggerSettingsUpdateEvent(event.timestamp, event.isolate); | 299 return new DebuggerSettingsUpdateEvent(event.timestamp, event.isolate); |
294 case S.ServiceEvent.kResume: | 300 case S.ServiceEvent.kResume: |
295 return new ResumeEvent(event.timestamp, event.isolate, event.topFrame); | 301 return new ResumeEvent(event.timestamp, event.isolate, event.topFrame); |
296 case S.ServiceEvent.kPauseStart: | 302 case S.ServiceEvent.kPauseStart: |
297 return new PauseStartEvent(event.timestamp, event.isolate); | 303 return new PauseStartEvent(event.timestamp, event.isolate); |
298 case S.ServiceEvent.kPauseExit: | 304 case S.ServiceEvent.kPauseExit: |
299 return new PauseExitEvent(event.timestamp, event.isolate); | 305 return new PauseExitEvent(event.timestamp, event.isolate); |
300 case S.ServiceEvent.kPauseBreakpoint: | 306 case S.ServiceEvent.kPauseBreakpoint: |
301 return new PauseBreakpointEvent(event.timestamp, event.isolate, | 307 return new PauseBreakpointEvent( |
302 event.pauseBreakpoints, event.topFrame, event.atAsyncSuspension, | 308 event.timestamp, |
| 309 event.isolate, |
| 310 event.pauseBreakpoints, |
| 311 event.topFrame, |
| 312 event.atAsyncSuspension, |
303 event.breakpoint); | 313 event.breakpoint); |
304 case S.Isolate.kLoggingStream: | 314 case S.Isolate.kLoggingStream: |
305 return new LoggingEvent(event.timestamp, event.isolate, event.logRecord); | 315 return new LoggingEvent(event.timestamp, event.isolate, event.logRecord); |
306 case S.ServiceEvent.kPauseInterrupted: | 316 case S.ServiceEvent.kPauseInterrupted: |
307 return new PauseInterruptedEvent(event.timestamp, event.isolate, | 317 return new PauseInterruptedEvent(event.timestamp, event.isolate, |
308 event.topFrame, event.atAsyncSuspension); | 318 event.topFrame, event.atAsyncSuspension); |
309 case S.ServiceEvent.kPauseException: | 319 case S.ServiceEvent.kPauseException: |
310 return new PauseExceptionEvent(event.timestamp, event.isolate, | 320 return new PauseExceptionEvent( |
311 event.topFrame, event.exception); | 321 event.timestamp, event.isolate, event.topFrame, event.exception); |
312 case S.ServiceEvent.kInspect: | 322 case S.ServiceEvent.kInspect: |
313 return new InspectEvent(event.timestamp, event.isolate, | 323 return new InspectEvent(event.timestamp, event.isolate, event.inspectee); |
314 event.inspectee); | |
315 case S.ServiceEvent.kGC: | 324 case S.ServiceEvent.kGC: |
316 return new GCEvent(event.timestamp, event.isolate); | 325 return new GCEvent(event.timestamp, event.isolate); |
317 case S.ServiceEvent.kNone: | 326 case S.ServiceEvent.kNone: |
318 return new NoneEvent(event.timestamp, event.isolate); | 327 return new NoneEvent(event.timestamp, event.isolate); |
319 default: | 328 default: |
320 // Ignore unrecognized events. | 329 // Ignore unrecognized events. |
321 Logger.root.severe('Unrecognized event: $event'); | 330 Logger.root.severe('Unrecognized event: $event'); |
322 return null; | 331 return null; |
323 } | 332 } |
324 } | 333 } |
OLD | NEW |