| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 final _allocationProfileRepository = new AllocationProfileRepository(); | 7 final _allocationProfileRepository = new AllocationProfileRepository(); |
| 8 final _breakpointRepository = new BreakpointRepository(); | 8 final _breakpointRepository = new BreakpointRepository(); |
| 9 final _classRepository = new ClassRepository(); | 9 final _classRepository = new ClassRepository(); |
| 10 final _classSampleProfileRepository = new ClassSampleProfileRepository(); | 10 final _classSampleProfileRepository = new ClassSampleProfileRepository(); |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 var isolateId = uri.queryParameters['isolateId']; | 98 var isolateId = uri.queryParameters['isolateId']; |
| 99 return app.vm.getIsolate(isolateId).then((isolate) { | 99 return app.vm.getIsolate(isolateId).then((isolate) { |
| 100 if (isolate == null) { | 100 if (isolate == null) { |
| 101 throw new IsolateNotFound(isolateId); | 101 throw new IsolateNotFound(isolateId); |
| 102 } | 102 } |
| 103 return isolate; | 103 return isolate; |
| 104 }); | 104 }); |
| 105 } | 105 } |
| 106 | 106 |
| 107 EditorRepository getEditor(Uri uri) { | 107 EditorRepository getEditor(Uri uri) { |
| 108 var editor = uri.queryParameters['editor']; | 108 final editor = uri.queryParameters['editor']; |
| 109 if (editor != null) { | 109 return new EditorRepository(app.vm, editor: editor); |
| 110 return new EditorRepository(editor); | |
| 111 } | |
| 112 return null; | 110 return null; |
| 113 } | 111 } |
| 114 | 112 |
| 115 bool canVisit(Uri uri) => uri.path == path; | 113 bool canVisit(Uri uri) => uri.path == path; |
| 116 } | 114 } |
| 117 | 115 |
| 118 /// A [SimplePage] matches a single uri path and displays a single element. | 116 /// A [SimplePage] matches a single uri path and displays a single element. |
| 119 class SimplePage extends MatchingPage { | 117 class SimplePage extends MatchingPage { |
| 120 final String elementTagName; | 118 final String elementTagName; |
| 121 SimplePage(String path, this.elementTagName, app) : super(path, app); | 119 SimplePage(String path, this.elementTagName, app) : super(path, app); |
| (...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 692 } | 690 } |
| 693 } | 691 } |
| 694 | 692 |
| 695 class MemoryDashboardPage extends MatchingPage { | 693 class MemoryDashboardPage extends MatchingPage { |
| 696 MemoryDashboardPage(app) : super('memory-dashboard', app); | 694 MemoryDashboardPage(app) : super('memory-dashboard', app); |
| 697 | 695 |
| 698 final DivElement container = new DivElement(); | 696 final DivElement container = new DivElement(); |
| 699 | 697 |
| 700 void _visit(Uri uri) { | 698 void _visit(Uri uri) { |
| 701 super._visit(uri); | 699 super._visit(uri); |
| 702 getIsolate(uri).then((isolate) { | 700 if (app.vm == null) { |
| 701 Logger.root.severe('MemoryDashboard has no VM'); |
| 702 // Reroute to vm-connect. |
| 703 app.locationManager.go(Uris.vmConnect()); |
| 704 return; |
| 705 } |
| 706 final editor = getEditor(uri); |
| 707 app.vm.reload().then((VM vm) async { |
| 708 // Preload all isolates to avoid sorting problems. |
| 709 await Future.wait(vm.isolates.map((i) => i.load())); |
| 703 container.children = [ | 710 container.children = [ |
| 704 new MemoryDashboardElement(isolate.vm, isolate, app.events, | 711 new MemoryDashboardElement(vm, new IsolateRepository(vm), editor, |
| 705 app.notifications, _allocationProfileRepository, getEditor(uri), | 712 _allocationProfileRepository, app.events, app.notifications, |
| 706 queue: app.queue) | 713 queue: app.queue) |
| 707 ]; | 714 ]; |
| 715 }).catchError((e, stack) { |
| 716 Logger.root.severe('MemoryDashboard visit error: $e'); |
| 717 // Reroute to vm-connect. |
| 718 app.locationManager.go(Uris.vmConnect()); |
| 708 }); | 719 }); |
| 709 } | 720 } |
| 710 | 721 |
| 711 void onInstall() { | 722 void onInstall() { |
| 712 if (element == null) { | 723 if (element == null) { |
| 713 element = container; | 724 element = container; |
| 714 } | 725 } |
| 715 app.startGCEventListener(); | 726 app.startGCEventListener(); |
| 716 } | 727 } |
| 717 | 728 |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 953 element = new TimelinePageElement(app.vm, app.events, app.notifications, | 964 element = new TimelinePageElement(app.vm, app.events, app.notifications, |
| 954 queue: app.queue); | 965 queue: app.queue); |
| 955 } | 966 } |
| 956 | 967 |
| 957 void _visit(Uri uri) { | 968 void _visit(Uri uri) { |
| 958 assert(canVisit(uri)); | 969 assert(canVisit(uri)); |
| 959 } | 970 } |
| 960 | 971 |
| 961 bool canVisit(Uri uri) => uri.path == 'timeline'; | 972 bool canVisit(Uri uri) => uri.path == 'timeline'; |
| 962 } | 973 } |
| OLD | NEW |