| 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 observatory; | 5 part of observatory; |
| 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 { | 9 class ObservatoryApplication extends Observable { |
| 10 final LocationManager locationManager = new LocationManager(); | 10 @observable final LocationManager locationManager; |
| 11 final RequestManager requestManager = new HttpRequestManager(); | 11 @observable final RequestManager requestManager; |
| 12 final IsolateManager isolateManager = new IsolateManager(); | 12 @observable final IsolateManager isolateManager; |
| 13 | 13 |
| 14 ObservatoryApplication() { | 14 ObservatoryApplication() : |
| 15 locationManager = new LocationManager(), |
| 16 requestManager = new HttpRequestManager(), |
| 17 isolateManager = new IsolateManager() { |
| 15 locationManager._application = this; | 18 locationManager._application = this; |
| 16 requestManager._application = this; | 19 requestManager._application = this; |
| 17 isolateManager._application = this; | 20 isolateManager._application = this; |
| 18 requestManager.interceptor = isolateManager._responseInterceptor; | 21 requestManager.interceptor = isolateManager._responseInterceptor; |
| 19 locationManager.init(); | 22 locationManager.init(); |
| 20 } | 23 } |
| 21 | 24 |
| 22 /// Return the [Isolate] with [id]. | 25 /// Return the [Isolate] with [id]. |
| 23 Isolate getIsolate(int id) { | 26 Isolate getIsolate(int id) { |
| 24 return isolateManager.isolates[id]; | 27 return isolateManager.isolates[id]; |
| 25 } | 28 } |
| 26 | 29 |
| 27 /// Return the name of the isolate with [id]. | 30 /// Return the name of the isolate with [id]. |
| 28 String getIsolateName(int id) { | 31 String getIsolateName(int id) { |
| 29 var isolate = getIsolate(id); | 32 var isolate = getIsolate(id); |
| 30 if (isolate == null) { | 33 if (isolate == null) { |
| 31 return 'Null Isolate'; | 34 return 'Null Isolate'; |
| 32 } | 35 } |
| 33 return isolate.name; | 36 return isolate.name; |
| 34 } | 37 } |
| 35 } | 38 } |
| OLD | NEW |