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 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 | 277 |
278 class ConnectionClosedEvent implements M.ConnectionClosedEvent { | 278 class ConnectionClosedEvent implements M.ConnectionClosedEvent { |
279 final DateTime timestamp; | 279 final DateTime timestamp; |
280 final String reason; | 280 final String reason; |
281 ConnectionClosedEvent(this.timestamp, this.reason) { | 281 ConnectionClosedEvent(this.timestamp, this.reason) { |
282 assert(timestamp != null); | 282 assert(timestamp != null); |
283 assert(reason != null); | 283 assert(reason != null); |
284 } | 284 } |
285 } | 285 } |
286 | 286 |
| 287 class ServiceRegisteredEvent implements M.ServiceRegisteredEvent { |
| 288 final DateTime timestamp; |
| 289 final String service; |
| 290 final String method; |
| 291 final String alias; |
| 292 ServiceRegisteredEvent( |
| 293 this.timestamp, this.service, this.method, this.alias) { |
| 294 assert(timestamp != null); |
| 295 assert(service != null); |
| 296 assert(method != null); |
| 297 assert(alias != null); |
| 298 } |
| 299 } |
| 300 |
| 301 class ServiceUnregisteredEvent implements M.ServiceUnregisteredEvent { |
| 302 final DateTime timestamp; |
| 303 final String service; |
| 304 final String method; |
| 305 ServiceUnregisteredEvent(this.timestamp, this.service, this.method) { |
| 306 assert(timestamp != null); |
| 307 assert(service != null); |
| 308 assert(method != null); |
| 309 } |
| 310 } |
| 311 |
287 M.Event createEventFromServiceEvent(S.ServiceEvent event) { | 312 M.Event createEventFromServiceEvent(S.ServiceEvent event) { |
288 switch (event.kind) { | 313 switch (event.kind) { |
289 case S.ServiceEvent.kVMUpdate: | 314 case S.ServiceEvent.kVMUpdate: |
290 return new VMUpdateEvent(event.timestamp, event.vm); | 315 return new VMUpdateEvent(event.timestamp, event.vm); |
291 case S.ServiceEvent.kIsolateStart: | 316 case S.ServiceEvent.kIsolateStart: |
292 return new IsolateStartEvent(event.timestamp, event.isolate); | 317 return new IsolateStartEvent(event.timestamp, event.isolate); |
293 case S.ServiceEvent.kIsolateRunnable: | 318 case S.ServiceEvent.kIsolateRunnable: |
294 return new IsolateRunnableEvent(event.timestamp, event.isolate); | 319 return new IsolateRunnableEvent(event.timestamp, event.isolate); |
295 case S.ServiceEvent.kIsolateUpdate: | 320 case S.ServiceEvent.kIsolateUpdate: |
296 return new IsolateUpdateEvent(event.timestamp, event.isolate); | 321 return new IsolateUpdateEvent(event.timestamp, event.isolate); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 case S.ServiceEvent.kPauseInterrupted: | 357 case S.ServiceEvent.kPauseInterrupted: |
333 return new PauseInterruptedEvent(event.timestamp, event.isolate, | 358 return new PauseInterruptedEvent(event.timestamp, event.isolate, |
334 event.topFrame, event.atAsyncSuspension); | 359 event.topFrame, event.atAsyncSuspension); |
335 case S.ServiceEvent.kPauseException: | 360 case S.ServiceEvent.kPauseException: |
336 return new PauseExceptionEvent( | 361 return new PauseExceptionEvent( |
337 event.timestamp, event.isolate, event.topFrame, event.exception); | 362 event.timestamp, event.isolate, event.topFrame, event.exception); |
338 case S.ServiceEvent.kInspect: | 363 case S.ServiceEvent.kInspect: |
339 return new InspectEvent(event.timestamp, event.isolate, event.inspectee); | 364 return new InspectEvent(event.timestamp, event.isolate, event.inspectee); |
340 case S.ServiceEvent.kGC: | 365 case S.ServiceEvent.kGC: |
341 return new GCEvent(event.timestamp, event.isolate); | 366 return new GCEvent(event.timestamp, event.isolate); |
| 367 case S.ServiceEvent.kServiceRegistered: |
| 368 return new ServiceRegisteredEvent( |
| 369 event.timestamp, event.service, event.method, event.alias); |
| 370 case S.ServiceEvent.kServiceUnregistered: |
| 371 return new ServiceUnregisteredEvent( |
| 372 event.timestamp, event.service, event.method); |
342 case S.ServiceEvent.kNone: | 373 case S.ServiceEvent.kNone: |
343 return new NoneEvent(event.timestamp, event.isolate); | 374 return new NoneEvent(event.timestamp, event.isolate); |
344 default: | 375 default: |
345 // Ignore unrecognized events. | 376 // Ignore unrecognized events. |
346 Logger.root.severe('Unrecognized event: $event'); | 377 Logger.root.severe('Unrecognized event: $event'); |
347 return null; | 378 return null; |
348 } | 379 } |
349 } | 380 } |
OLD | NEW |