OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 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 | 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 part of app; | 5 part of app; |
6 | 6 |
7 class Notification { | 7 class Notification { |
8 Notification.fromEvent(this.event); | 8 Notification.fromEvent(this.event); |
9 Notification.fromException(this.exception, this.stacktrace); | 9 Notification.fromException(this.exception, this.stacktrace); |
10 | 10 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 vm.onDisconnect.then((String reason) { | 46 vm.onDisconnect.then((String reason) { |
47 if (this.vm != vm) { | 47 if (this.vm != vm) { |
48 // This disconnect event occured *after* a new VM was installed. | 48 // This disconnect event occured *after* a new VM was installed. |
49 return; | 49 return; |
50 } | 50 } |
51 notifications.add( | 51 notifications.add( |
52 new Notification.fromEvent( | 52 new Notification.fromEvent( |
53 new ServiceEvent.connectionClosed(reason))); | 53 new ServiceEvent.connectionClosed(reason))); |
54 }); | 54 }); |
55 | 55 |
56 vm.isolateEvents.listen(_onEvent); | 56 vm.events.stream.listen(_onEvent); |
57 vm.debugEvents.listen(_onEvent); | |
58 } | 57 } |
59 _vm = vm; | 58 _vm = vm; |
60 } | 59 } |
61 final TargetManager targets; | 60 final TargetManager targets; |
62 @reflectable final ObservatoryApplicationElement rootElement; | 61 @reflectable final ObservatoryApplicationElement rootElement; |
63 | 62 |
64 TraceViewElement _traceView = null; | 63 TraceViewElement _traceView = null; |
65 | 64 |
66 @reflectable ServiceObject lastErrorOrException; | 65 @reflectable ServiceObject lastErrorOrException; |
67 @observable ObservableList<Notification> notifications = | 66 @observable ObservableList<Notification> notifications = |
(...skipping 14 matching lines...) Expand all Loading... |
82 return (event != null && | 81 return (event != null && |
83 event.isolate == isolate && | 82 event.isolate == isolate && |
84 event.isPauseEvent); | 83 event.isPauseEvent); |
85 }); | 84 }); |
86 } | 85 } |
87 | 86 |
88 void _onEvent(ServiceEvent event) { | 87 void _onEvent(ServiceEvent event) { |
89 switch(event.eventType) { | 88 switch(event.eventType) { |
90 case ServiceEvent.kIsolateStart: | 89 case ServiceEvent.kIsolateStart: |
91 case ServiceEvent.kIsolateUpdate: | 90 case ServiceEvent.kIsolateUpdate: |
| 91 case ServiceEvent.kGraph: |
92 case ServiceEvent.kBreakpointAdded: | 92 case ServiceEvent.kBreakpointAdded: |
93 case ServiceEvent.kBreakpointResolved: | 93 case ServiceEvent.kBreakpointResolved: |
94 case ServiceEvent.kBreakpointRemoved: | 94 case ServiceEvent.kBreakpointRemoved: |
| 95 case ServiceEvent.kGC: |
95 // Ignore for now. | 96 // Ignore for now. |
96 break; | 97 break; |
97 | 98 |
98 case ServiceEvent.kIsolateExit: | 99 case ServiceEvent.kIsolateExit: |
99 case ServiceEvent.kResume: | 100 case ServiceEvent.kResume: |
100 removePauseEvents(event.isolate); | 101 removePauseEvents(event.isolate); |
101 break; | 102 break; |
102 | 103 |
103 case ServiceEvent.kPauseStart: | 104 case ServiceEvent.kPauseStart: |
104 case ServiceEvent.kPauseExit: | 105 case ServiceEvent.kPauseExit: |
105 case ServiceEvent.kPauseBreakpoint: | 106 case ServiceEvent.kPauseBreakpoint: |
106 case ServiceEvent.kPauseInterrupted: | 107 case ServiceEvent.kPauseInterrupted: |
107 case ServiceEvent.kPauseException: | 108 case ServiceEvent.kPauseException: |
108 removePauseEvents(event.isolate); | 109 removePauseEvents(event.isolate); |
109 notifications.add(new Notification.fromEvent(event)); | 110 notifications.add(new Notification.fromEvent(event)); |
110 break; | 111 break; |
111 | 112 |
112 case ServiceEvent.kInspect: | 113 case ServiceEvent.kInspect: |
113 notifications.add(new Notification.fromEvent(event)); | 114 notifications.add(new Notification.fromEvent(event)); |
114 break; | 115 break; |
115 | 116 |
116 default: | 117 default: |
117 // Ignore unrecognized events. | 118 // Ignore unrecognized events. |
118 Logger.root.severe('Ignoring unexpected event: $event'); | 119 Logger.root.severe('Unrecognized event: $event'); |
119 break; | 120 break; |
120 } | 121 } |
121 } | 122 } |
122 | 123 |
123 void _registerPages() { | 124 void _registerPages() { |
124 _pageRegistry.add(new VMPage(this)); | 125 _pageRegistry.add(new VMPage(this)); |
125 _pageRegistry.add(new FlagsPage(this)); | 126 _pageRegistry.add(new FlagsPage(this)); |
126 _pageRegistry.add(new InspectPage(this)); | 127 _pageRegistry.add(new InspectPage(this)); |
127 _pageRegistry.add(new ClassTreePage(this)); | 128 _pageRegistry.add(new ClassTreePage(this)); |
128 _pageRegistry.add(new DebuggerPage(this)); | 129 _pageRegistry.add(new DebuggerPage(this)); |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 this.vm = new FakeVM(crashDump['result']); | 217 this.vm = new FakeVM(crashDump['result']); |
217 app.locationManager.go('#/vm'); | 218 app.locationManager.go('#/vm'); |
218 } | 219 } |
219 | 220 |
220 void handleException(e, st) { | 221 void handleException(e, st) { |
221 // TODO(turnidge): Report this failure via analytics. | 222 // TODO(turnidge): Report this failure via analytics. |
222 Logger.root.warning('Caught exception: ${e}\n${st}'); | 223 Logger.root.warning('Caught exception: ${e}\n${st}'); |
223 notifications.add(new Notification.fromException(e, st)); | 224 notifications.add(new Notification.fromException(e, st)); |
224 } | 225 } |
225 } | 226 } |
OLD | NEW |