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 /// 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 { |
10 static ObservatoryApplication app; | 10 static ObservatoryApplication app; |
11 final RenderingQueue queue = new RenderingQueue(); | 11 final RenderingQueue queue = new RenderingQueue(); |
12 final TargetRepository targets = new TargetRepository(); | 12 final TargetRepository targets = new TargetRepository(); |
13 final EventRepository events = new EventRepository(); | 13 final EventRepository events = new EventRepository(); |
14 final NotificationRepository notifications = new NotificationRepository(); | 14 final NotificationRepository notifications = new NotificationRepository(); |
15 final _pageRegistry = new List<Page>(); | 15 final _pageRegistry = new List<Page>(); |
16 LocationManager _locationManager; | 16 LocationManager _locationManager; |
17 LocationManager get locationManager => _locationManager; | 17 LocationManager get locationManager => _locationManager; |
18 @observable Page currentPage; | 18 Page currentPage; |
19 VM _vm; | 19 VM _vm; |
20 VM get vm => _vm; | 20 VM get vm => _vm; |
21 | 21 |
22 _setVM(VM vm) { | 22 _setVM(VM vm) { |
23 if (_vm == vm) { | 23 if (_vm == vm) { |
24 // Do nothing. | 24 // Do nothing. |
25 return; | 25 return; |
26 } | 26 } |
27 if (_vm != null) { | 27 if (_vm != null) { |
28 _gcSubscription = null; | 28 _gcSubscription = null; |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 | 81 |
82 Future stopLoggingEventListener() async { | 82 Future stopLoggingEventListener() async { |
83 if (_loggingSubscription == null) { | 83 if (_loggingSubscription == null) { |
84 return; | 84 return; |
85 } | 85 } |
86 _loggingSubscription.cancel(); | 86 _loggingSubscription.cancel(); |
87 _loggingSubscription = null; | 87 _loggingSubscription = null; |
88 } | 88 } |
89 | 89 |
90 | 90 |
91 @reflectable final ObservatoryApplicationElement rootElement; | 91 final ObservatoryApplicationElement rootElement; |
92 | 92 |
93 @reflectable ServiceObject lastErrorOrException; | 93 ServiceObject lastErrorOrException; |
94 | 94 |
95 void _initOnce() { | 95 void _initOnce() { |
96 assert(app == null); | 96 assert(app == null); |
97 app = this; | 97 app = this; |
98 _registerPages(); | 98 _registerPages(); |
99 Analytics.initialize(); | 99 Analytics.initialize(); |
100 // Visit the current page. | 100 // Visit the current page. |
101 locationManager._visit(); | 101 locationManager._visit(); |
102 } | 102 } |
103 | 103 |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 } | 233 } |
234 | 234 |
235 // TODO(turnidge): Report this failure via analytics. | 235 // TODO(turnidge): Report this failure via analytics. |
236 Logger.root.warning('Caught exception: ${e}\n${st}'); | 236 Logger.root.warning('Caught exception: ${e}\n${st}'); |
237 notifications.add(new ExceptionNotification(e, stacktrace: st)); | 237 notifications.add(new ExceptionNotification(e, stacktrace: st)); |
238 } | 238 } |
239 | 239 |
240 // This map keeps track of which curly-blocks have been expanded by the user. | 240 // This map keeps track of which curly-blocks have been expanded by the user. |
241 Map<String,bool> expansions = {}; | 241 Map<String,bool> expansions = {}; |
242 } | 242 } |
OLD | NEW |