| 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 Future<Isolate> getIsolate(Uri uri) { | 98 Future<Isolate> getIsolate(Uri uri) { |
| 99 var isolateId = uri.queryParameters['isolateId']; | 99 var isolateId = uri.queryParameters['isolateId']; |
| 100 return app.vm.getIsolate(isolateId).then((isolate) { | 100 return app.vm.getIsolate(isolateId).then((isolate) { |
| 101 if (isolate == null) { | 101 if (isolate == null) { |
| 102 throw new IsolateNotFound(isolateId); | 102 throw new IsolateNotFound(isolateId); |
| 103 } | 103 } |
| 104 return isolate; | 104 return isolate; |
| 105 }); | 105 }); |
| 106 } | 106 } |
| 107 | 107 |
| 108 EditorRepository getEditor(Uri uri) { |
| 109 var editor = uri.queryParameters['editor']; |
| 110 if (editor != null) { |
| 111 return new EditorRepository(editor); |
| 112 } |
| 113 return null; |
| 114 } |
| 115 |
| 108 bool canVisit(Uri uri) => uri.path == path; | 116 bool canVisit(Uri uri) => uri.path == path; |
| 109 } | 117 } |
| 110 | 118 |
| 111 /// A [SimplePage] matches a single uri path and displays a single element. | 119 /// A [SimplePage] matches a single uri path and displays a single element. |
| 112 class SimplePage extends MatchingPage { | 120 class SimplePage extends MatchingPage { |
| 113 final String elementTagName; | 121 final String elementTagName; |
| 114 SimplePage(String path, this.elementTagName, app) : super(path, app); | 122 SimplePage(String path, this.elementTagName, app) : super(path, app); |
| 115 | 123 |
| 116 void onInstall() { | 124 void onInstall() { |
| 117 if (element == null) { | 125 if (element == null) { |
| (...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 678 } | 686 } |
| 679 | 687 |
| 680 @override | 688 @override |
| 681 void onUninstall() { | 689 void onUninstall() { |
| 682 super.onUninstall(); | 690 super.onUninstall(); |
| 683 app.stopGCEventListener(); | 691 app.stopGCEventListener(); |
| 684 container.children = const []; | 692 container.children = const []; |
| 685 } | 693 } |
| 686 } | 694 } |
| 687 | 695 |
| 696 class MemoryDashboardPage extends MatchingPage { |
| 697 MemoryDashboardPage(app) : super('memory-dashboard', app); |
| 698 |
| 699 final DivElement container = new DivElement(); |
| 700 |
| 701 void _visit(Uri uri) { |
| 702 super._visit(uri); |
| 703 getIsolate(uri).then((isolate) { |
| 704 container.children = [ |
| 705 new MemoryDashboardElement(isolate.vm, isolate, app.events, |
| 706 app.notifications, _allocationProfileRepository, getEditor(uri), |
| 707 queue: app.queue) |
| 708 ]; |
| 709 }); |
| 710 } |
| 711 |
| 712 void onInstall() { |
| 713 if (element == null) { |
| 714 element = container; |
| 715 } |
| 716 app.startGCEventListener(); |
| 717 } |
| 718 |
| 719 @override |
| 720 void onUninstall() { |
| 721 super.onUninstall(); |
| 722 app.stopGCEventListener(); |
| 723 container.children = const []; |
| 724 } |
| 725 } |
| 726 |
| 688 class PortsPage extends MatchingPage { | 727 class PortsPage extends MatchingPage { |
| 689 PortsPage(app) : super('ports', app); | 728 PortsPage(app) : super('ports', app); |
| 690 | 729 |
| 691 final DivElement container = new DivElement(); | 730 final DivElement container = new DivElement(); |
| 692 | 731 |
| 693 void _visit(Uri uri) { | 732 void _visit(Uri uri) { |
| 694 super._visit(uri); | 733 super._visit(uri); |
| 695 getIsolate(uri).then((isolate) { | 734 getIsolate(uri).then((isolate) { |
| 696 container.children = [ | 735 container.children = [ |
| 697 new PortsElement(isolate.vm, isolate, app.events, app.notifications, | 736 new PortsElement(isolate.vm, isolate, app.events, app.notifications, |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 915 element = new TimelinePageElement(app.vm, app.events, app.notifications, | 954 element = new TimelinePageElement(app.vm, app.events, app.notifications, |
| 916 queue: app.queue); | 955 queue: app.queue); |
| 917 } | 956 } |
| 918 | 957 |
| 919 void _visit(Uri uri) { | 958 void _visit(Uri uri) { |
| 920 assert(canVisit(uri)); | 959 assert(canVisit(uri)); |
| 921 } | 960 } |
| 922 | 961 |
| 923 bool canVisit(Uri uri) => uri.path == 'timeline'; | 962 bool canVisit(Uri uri) => uri.path == 'timeline'; |
| 924 } | 963 } |
| OLD | NEW |