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

Side by Side Diff: runtime/bin/vmservice/client/lib/src/app/application.dart

Issue 381383010: Add breakpoints and single-stepping to Observatory. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: fix bugs, gen js Created 6 years, 4 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 | Annotate | Revision Log
OLDNEW
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 /// The observatory application. Instances of this are created and owned 7 /// The observatory application. Instances of this are created and owned
8 /// by the observatory_application custom element. 8 /// by the observatory_application custom element.
9 class ObservatoryApplication extends Observable { 9 class ObservatoryApplication extends Observable {
10 static ObservatoryApplication app; 10 static ObservatoryApplication app;
11 final _pageRegistry = new List<Page>(); 11 final _pageRegistry = new List<Page>();
12 @observable Page currentPage; 12 @observable Page currentPage;
13 @observable final LocationManager locationManager; 13 @observable final LocationManager locationManager;
14 VM _vm; 14 VM _vm;
15 VM get vm => _vm; 15 VM get vm => _vm;
16 set vm(VM vm) { 16 set vm(VM vm) {
17 if (_vm == vm) { 17 if (_vm == vm) {
18 // Do nothing. 18 // Do nothing.
19 return; 19 return;
20 } 20 }
21 if (_vm != null) { 21 if (_vm != null) {
22 // Disconnect from current VM. 22 // Disconnect from current VM.
23 notifications.clear();
23 _vm.disconnect(); 24 _vm.disconnect();
24 } 25 }
25 if (vm != null) { 26 if (vm != null) {
26 Logger.root.info('Registering new VM callbacks'); 27 Logger.root.info('Registering new VM callbacks');
27 vm.onConnect.then(_vmConnected); 28 vm.onConnect.then(_vmConnected);
28 vm.onDisconnect.then(_vmDisconnected); 29 vm.onDisconnect.then(_vmDisconnected);
29 vm.errors.stream.listen(_onError); 30 vm.errors.stream.listen(_onError);
31 vm.events.stream.listen(_onEvent);
30 vm.exceptions.stream.listen(_onException); 32 vm.exceptions.stream.listen(_onException);
31 } 33 }
32 _vm = vm; 34 _vm = vm;
33 } 35 }
34 final TargetManager targets; 36 final TargetManager targets;
35 @observable Isolate isolate; 37 @observable Isolate isolate;
36 @reflectable final ObservatoryApplicationElement rootElement; 38 @reflectable final ObservatoryApplicationElement rootElement;
37 39
38 @reflectable ServiceObject lastErrorOrException; 40 @reflectable ServiceObject lastErrorOrException;
39 @observable ObservableList<ServiceEvent> notifications = 41 @observable ObservableList<ServiceEvent> notifications =
(...skipping 12 matching lines...) Expand all
52 event.eventType == 'BreakpointReached' || 54 event.eventType == 'BreakpointReached' ||
53 event.eventType == 'ExceptionThrown'); 55 event.eventType == 'ExceptionThrown');
54 } 56 }
55 57
56 notifications.removeWhere((oldEvent) { 58 notifications.removeWhere((oldEvent) {
57 return (oldEvent.isolate == isolate && 59 return (oldEvent.isolate == isolate &&
58 isPauseEvent(oldEvent)); 60 isPauseEvent(oldEvent));
59 }); 61 });
60 } 62 }
61 63
62 void _handleEvent(ServiceEvent event) { 64 void _onEvent(ServiceEvent event) {
63 switch(event.eventType) { 65 switch(event.eventType) {
64 case 'IsolateCreated': 66 case 'IsolateCreated':
65 // vm.reload(); 67 // vm.reload();
66 break; 68 break;
67 69
68 case 'IsolateShutdown': 70 case 'IsolateShutdown':
69 // TODO(turnidge): Should we show the user isolate shutdown events? 71 // TODO(turnidge): Should we show the user isolate shutdown events?
70 // What if there are hundreds of them? Coalesce multiple 72 // What if there are hundreds of them? Coalesce multiple
71 // shutdown events into one notification? 73 // shutdown events into one notification?
72 removePauseEvents(event.isolate); 74 removePauseEvents(event.isolate);
73 // vm.reload(); 75 // vm.reload();
74 break; 76 break;
75 77
76 case 'BreakpointResolved': 78 case 'BreakpointResolved':
77 // Do nothing. 79 event.isolate.reloadBreakpoints();
78 break; 80 break;
79 81
80 case 'BreakpointReached': 82 case 'BreakpointReached':
81 case 'IsolateInterrupted': 83 case 'IsolateInterrupted':
82 case 'ExceptionThrown': 84 case 'ExceptionThrown':
83 removePauseEvents(event.isolate); 85 removePauseEvents(event.isolate);
84 notifications.add(event); 86 notifications.add(event);
85 break; 87 break;
86 88
87 default: 89 default:
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 183
182 _vmDisconnected(VM vm) { 184 _vmDisconnected(VM vm) {
183 if (this.vm != vm) { 185 if (this.vm != vm) {
184 // This disconnect event occured *after* a new VM was installed. 186 // This disconnect event occured *after* a new VM was installed.
185 return; 187 return;
186 } 188 }
187 this.vm = null; 189 this.vm = null;
188 locationManager.go(locationManager.makeLink('/vm-connect/')); 190 locationManager.go(locationManager.makeLink('/vm-connect/'));
189 } 191 }
190 } 192 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698