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 _classSampleProfileRepository = new ClassSampleProfileRepository(); | 9 final _classSampleProfileRepository = new ClassSampleProfileRepository(); |
10 final _classRepository = new ClassRepository(); | 10 final _classRepository = new ClassRepository(); |
(...skipping 30 matching lines...) Expand all Loading... |
41 RetainedSizeRepository _retainedSizeRepository = new RetainedSizeRepository(); | 41 RetainedSizeRepository _retainedSizeRepository = new RetainedSizeRepository(); |
42 ReachableSizeRepository _reachableSizeRepository | 42 ReachableSizeRepository _reachableSizeRepository |
43 = new ReachableSizeRepository(); | 43 = new ReachableSizeRepository(); |
44 RetainingPathRepository _retainingPathRepository | 44 RetainingPathRepository _retainingPathRepository |
45 = new RetainingPathRepository(); | 45 = new RetainingPathRepository(); |
46 | 46 |
47 /// A [Page] controls the user interface of Observatory. At any given time | 47 /// A [Page] controls the user interface of Observatory. At any given time |
48 /// one page will be the current page. Pages are registered at startup. | 48 /// one page will be the current page. Pages are registered at startup. |
49 /// When the user navigates within the application, each page is asked if it | 49 /// When the user navigates within the application, each page is asked if it |
50 /// can handle the current location, the first page to say yes, wins. | 50 /// can handle the current location, the first page to say yes, wins. |
51 abstract class Page extends Observable { | 51 abstract class Page { |
52 final ObservatoryApplication app; | 52 final ObservatoryApplication app; |
53 final ObservableMap<String, String> internalArguments = | 53 final Map<String, String> internalArguments = <String, String>{}; |
54 new ObservableMap<String, String>(); | 54 HtmlElement element; |
55 @observable HtmlElement element; | |
56 | 55 |
57 Page(this.app); | 56 Page(this.app); |
58 | 57 |
59 /// Called when the page is installed, this callback must initialize | 58 /// Called when the page is installed, this callback must initialize |
60 /// [element]. | 59 /// [element]. |
61 void onInstall(); | 60 void onInstall(); |
62 | 61 |
63 /// Called when the page is uninstalled, this callback must clear | 62 /// Called when the page is uninstalled, this callback must clear |
64 /// [element]. | 63 /// [element]. |
65 void onUninstall() { | 64 void onUninstall() { |
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
451 | 450 |
452 void onInstall() { | 451 void onInstall() { |
453 if (element == null) { | 452 if (element == null) { |
454 element = container; | 453 element = container; |
455 } | 454 } |
456 assert(element != null); | 455 assert(element != null); |
457 } | 456 } |
458 | 457 |
459 @override | 458 @override |
460 void onUninstall() { | 459 void onUninstall() { |
461 assert(element != null); | 460 super.onUninstall(); |
462 element.children = const []; | 461 container.children = const []; |
463 } | 462 } |
464 } | 463 } |
465 | 464 |
466 class ObjectStorePage extends MatchingPage { | 465 class ObjectStorePage extends MatchingPage { |
467 ObjectStorePage(app) : super('object-store', app); | 466 ObjectStorePage(app) : super('object-store', app); |
468 | 467 |
469 final DivElement container = new DivElement(); | 468 final DivElement container = new DivElement(); |
470 | 469 |
471 void _visit(Uri uri) { | 470 void _visit(Uri uri) { |
472 super._visit(uri); | 471 super._visit(uri); |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
554 }); | 553 }); |
555 } | 554 } |
556 | 555 |
557 void onInstall() { | 556 void onInstall() { |
558 if (element == null) { | 557 if (element == null) { |
559 element = container; | 558 element = container; |
560 } | 559 } |
561 app.startGCEventListener(); | 560 app.startGCEventListener(); |
562 } | 561 } |
563 | 562 |
| 563 @override |
564 void onUninstall() { | 564 void onUninstall() { |
565 super.onUninstall(); | 565 super.onUninstall(); |
566 app.stopGCEventListener(); | 566 app.stopGCEventListener(); |
| 567 container.children = const []; |
567 } | 568 } |
568 } | 569 } |
569 | 570 |
570 class PortsPage extends MatchingPage { | 571 class PortsPage extends MatchingPage { |
571 PortsPage(app) : super('ports', app); | 572 PortsPage(app) : super('ports', app); |
572 | 573 |
573 final DivElement container = new DivElement(); | 574 final DivElement container = new DivElement(); |
574 | 575 |
575 void _visit(Uri uri) { | 576 void _visit(Uri uri) { |
576 super._visit(uri); | 577 super._visit(uri); |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
666 | 667 |
667 @override | 668 @override |
668 void onInstall() { | 669 void onInstall() { |
669 element = container; | 670 element = container; |
670 container.children = const []; | 671 container.children = const []; |
671 app.startLoggingEventListener(); | 672 app.startLoggingEventListener(); |
672 } | 673 } |
673 | 674 |
674 @override | 675 @override |
675 void onUninstall() { | 676 void onUninstall() { |
| 677 super.onUninstall(); |
| 678 container.children = const []; |
676 app.stopLoggingEventListener(); | 679 app.stopLoggingEventListener(); |
677 } | 680 } |
678 | 681 |
679 void _visit(Uri uri) { | 682 void _visit(Uri uri) { |
680 assert(element != null); | 683 assert(element != null); |
681 assert(canVisit(uri)); | 684 assert(canVisit(uri)); |
682 getIsolate(uri).then((isolate) { | 685 getIsolate(uri).then((isolate) { |
683 container.children = [ | 686 container.children = [ |
684 new LoggingPageElement(app.vm, isolate, app.events, | 687 new LoggingPageElement(app.vm, isolate, app.events, |
685 app.notifications, queue: app.queue) | 688 app.notifications, queue: app.queue) |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
773 } | 776 } |
774 | 777 |
775 void onInstall() { | 778 void onInstall() { |
776 if (element == null) { | 779 if (element == null) { |
777 element = container; | 780 element = container; |
778 } | 781 } |
779 } | 782 } |
780 | 783 |
781 @override | 784 @override |
782 void onUninstall() { | 785 void onUninstall() { |
| 786 super.onUninstall(); |
783 _metricRepository.stopSampling(lastIsolate); | 787 _metricRepository.stopSampling(lastIsolate); |
| 788 container.children = const []; |
784 } | 789 } |
785 } | 790 } |
786 | 791 |
787 class TimelinePage extends Page { | 792 class TimelinePage extends Page { |
788 TimelinePage(app) : super(app); | 793 TimelinePage(app) : super(app); |
789 | 794 |
790 void onInstall() { | 795 void onInstall() { |
791 element = new TimelinePageElement(app.vm, app.events, app.notifications, | 796 element = new TimelinePageElement(app.vm, app.events, app.notifications, |
792 queue: app.queue); | 797 queue: app.queue); |
793 } | 798 } |
794 | 799 |
795 void _visit(Uri uri) { | 800 void _visit(Uri uri) { |
796 assert(canVisit(uri)); | 801 assert(canVisit(uri)); |
797 } | 802 } |
798 | 803 |
799 bool canVisit(Uri uri) => uri.path == 'timeline'; | 804 bool canVisit(Uri uri) => uri.path == 'timeline'; |
800 } | 805 } |
OLD | NEW |