OLD | NEW |
(Empty) | |
| 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 |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 part of app; |
| 6 |
| 7 class ExceptionNotification implements M.ExceptionNotification { |
| 8 final Exception exception; |
| 9 /// [optional] |
| 10 final StackTrace stacktrace; |
| 11 ExceptionNotification(this.exception, {this.stacktrace}); |
| 12 } |
| 13 |
| 14 class EventNotification implements M.EventNotification { |
| 15 final M.Event event; |
| 16 EventNotification(this.event); |
| 17 factory EventNotification.fromServiceEvent(ServiceEvent event) { |
| 18 M.Event e; |
| 19 switch(event.kind) { |
| 20 case ServiceEvent.kVMUpdate: |
| 21 e = new VMUpdateEventMock(timestamp: event.timestamp, vm: event.vm); |
| 22 break; |
| 23 case ServiceEvent.kIsolateStart: |
| 24 e = new IsolateStartEventMock(timestamp: event.timestamp, |
| 25 isolate: event.isolate); |
| 26 break; |
| 27 case ServiceEvent.kIsolateRunnable: |
| 28 e = new IsolateRunnableEventMock(timestamp: event.timestamp, |
| 29 isolate: event.isolate); |
| 30 break; |
| 31 case ServiceEvent.kIsolateExit: |
| 32 e = new IsolateExitEventMock(timestamp: event.timestamp, |
| 33 isolate: event.isolate); |
| 34 break; |
| 35 case ServiceEvent.kIsolateUpdate: |
| 36 e = new IsolateUpdateEventMock(timestamp: event.timestamp, |
| 37 isolate: event.isolate); |
| 38 break; |
| 39 case ServiceEvent.kIsolateReload: |
| 40 // TODO(bernaschina) add error: realoadError. |
| 41 e = new IsolateRealodEventMock(timestamp: event.timestamp, |
| 42 isolate: event.isolate); |
| 43 break; |
| 44 case ServiceEvent.kServiceExtensionAdded: |
| 45 e = new ServiceExtensionAddedEventMock(timestamp: event.timestamp, |
| 46 isolate: event.isolate, extensionRPC: event.extensionRPC); |
| 47 break; |
| 48 case ServiceEvent.kPauseStart: |
| 49 e = new PauseStartEventMock(timestamp: event.timestamp, |
| 50 isolate: event.isolate); |
| 51 break; |
| 52 case ServiceEvent.kPauseExit: |
| 53 e = new PauseExitEventMock(timestamp: event.timestamp, |
| 54 isolate: event.isolate); |
| 55 break; |
| 56 case ServiceEvent.kPauseBreakpoint: |
| 57 // TODO(cbernaschina) add pauseBreakpoints. |
| 58 e = new PauseBreakpointEventMock(timestamp: event.timestamp, |
| 59 isolate: event.isolate, breakpoint: event.breakpoint, |
| 60 pauseBreakpoints: const <M.Breakpoint>[], |
| 61 topFrame: event.topFrame, |
| 62 atAsyncSuspension: event.atAsyncSuspension); |
| 63 break; |
| 64 case ServiceEvent.kPauseInterrupted: |
| 65 e = new PauseInterruptedEventMock(timestamp: event.timestamp, |
| 66 isolate: event.isolate, topFrame: event.topFrame, |
| 67 atAsyncSuspension: event.atAsyncSuspension); |
| 68 break; |
| 69 case ServiceEvent.kPauseException: |
| 70 // TODO(cbernaschina) add exception. |
| 71 e = new PauseExceptionEventMock(timestamp: event.timestamp, |
| 72 isolate: event.isolate, topFrame: event.topFrame); |
| 73 break; |
| 74 case ServiceEvent.kNone: |
| 75 e = new NoneEventMock(timestamp: event.timestamp, |
| 76 isolate: event.isolate); |
| 77 break; |
| 78 case ServiceEvent.kResume: |
| 79 e = new ResumeEventMock(timestamp: event.timestamp, |
| 80 isolate: event.isolate); |
| 81 break; |
| 82 case ServiceEvent.kBreakpointAdded: |
| 83 e = new BreakpointAddedEventMock(timestamp: event.timestamp, |
| 84 isolate: event.isolate, breakpoint: event.breakpoint); |
| 85 break; |
| 86 case ServiceEvent.kBreakpointResolved: |
| 87 e = new BreakpointResolvedEventMock(timestamp: event.timestamp, |
| 88 isolate: event.isolate, breakpoint: event.breakpoint); |
| 89 break; |
| 90 case ServiceEvent.kBreakpointRemoved: |
| 91 e = new BreakpointRemovedEventMock(timestamp: event.timestamp, |
| 92 isolate: event.isolate, breakpoint: event.breakpoint); |
| 93 break; |
| 94 case ServiceEvent.kGC: |
| 95 e = new GCEventMock(timestamp: event.timestamp, |
| 96 isolate: event.isolate); |
| 97 break; |
| 98 case ServiceEvent.kInspect: |
| 99 // TODO(cbernaschina) add inspectee: event.inspectee. |
| 100 e = new InspectEventMock(timestamp: event.timestamp, |
| 101 isolate: event.isolate); |
| 102 break; |
| 103 case ServiceEvent.kConnectionClosed: |
| 104 e = new ConnectionClockedEventMock(timestamp: event.timestamp, |
| 105 reason: event.reason); |
| 106 break; |
| 107 case ServiceEvent.kExtension: |
| 108 e = new ExtensionEventMock(timestamp: event.timestamp, |
| 109 isolate: event.isolate, extensionKind: event.extensionKind, |
| 110 extensionData: event.extensionData); |
| 111 break; |
| 112 } |
| 113 return new EventNotification(e); |
| 114 } |
| 115 } |
OLD | NEW |