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

Unified Diff: runtime/observatory/lib/src/app/application.dart

Issue 2180803002: Converted Observatory vm-connect element (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Renamed DumpRepository to CrashDumpRepository Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/observatory/lib/repositories.dart ('k') | runtime/observatory/lib/src/app/page.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/observatory/lib/src/app/application.dart
diff --git a/runtime/observatory/lib/src/app/application.dart b/runtime/observatory/lib/src/app/application.dart
index b37eda2750e780e3f455058d31e1ac72e8ce0386..a8bfabbf69fd25cfdb3837bd53251f03f253c84b 100644
--- a/runtime/observatory/lib/src/app/application.dart
+++ b/runtime/observatory/lib/src/app/application.dart
@@ -9,6 +9,7 @@ part of app;
class ObservatoryApplication extends Observable {
static ObservatoryApplication app;
final RenderingQueue queue = new RenderingQueue();
+ final TargetRepository targets = new TargetRepository();
final NotificationRepository notifications = new NotificationRepository();
final _pageRegistry = new List<Page>();
LocationManager _locationManager;
@@ -17,7 +18,7 @@ class ObservatoryApplication extends Observable {
VM _vm;
VM get vm => _vm;
- set vm(VM vm) {
+ _setVM(VM vm) {
if (_vm == vm) {
// Do nothing.
return;
@@ -31,9 +32,6 @@ class ObservatoryApplication extends Observable {
Logger.root.info('Registering new VM callbacks');
vm.onConnect.then((_) {
- if (vm is WebSocketVM) {
- targets.add(vm.target);
- }
notifications.deleteDisconnectEvents();
});
@@ -52,7 +50,6 @@ class ObservatoryApplication extends Observable {
}
_vm = vm;
}
- final TargetManager targets;
@reflectable final ObservatoryApplicationElement rootElement;
TraceViewElement _traceView = null;
@@ -194,15 +191,20 @@ class ObservatoryApplication extends Observable {
currentPage = page;
}
- ObservatoryApplication(this.rootElement) :
- targets = new TargetManager() {
+ ObservatoryApplication(this.rootElement) {
_locationManager = new LocationManager(this);
- vm = new WebSocketVM(targets.defaultTarget);
+ targets.onChange.listen((e) {
+ if (targets.current == null) return _setVM(null);
+ if ((_vm as WebSocketVM)?.target != targets.current) {
+ _setVM(new WebSocketVM(targets.current));
+ }
+ });
+ _setVM(new WebSocketVM(targets.current));
_initOnce();
}
loadCrashDump(Map crashDump) {
- this.vm = new FakeVM(crashDump['result']);
+ _setVM(new FakeVM(crashDump['result']));
app.locationManager.go('#/vm');
}
« no previous file with comments | « runtime/observatory/lib/repositories.dart ('k') | runtime/observatory/lib/src/app/page.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698