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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/timeline/TimelinePanel.js

Issue 2557973002: DevTools: Introduce Landing page for Timeline panel. (Closed)
Patch Set: addressing comments Created 4 years 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * Copyright (C) 2012 Intel Inc. All rights reserved. 3 * Copyright (C) 2012 Intel Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 this._captureNetworkSetting = Common.settings.createSetting('timelineCapture Network', false); 76 this._captureNetworkSetting = Common.settings.createSetting('timelineCapture Network', false);
77 this._captureJSProfileSetting = Common.settings.createSetting('timelineEnabl eJSSampling', true); 77 this._captureJSProfileSetting = Common.settings.createSetting('timelineEnabl eJSSampling', true);
78 this._captureMemorySetting = Common.settings.createSetting('timelineCaptureM emory', false); 78 this._captureMemorySetting = Common.settings.createSetting('timelineCaptureM emory', false);
79 this._captureLayersAndPicturesSetting = Common.settings.createSetting('timel ineCaptureLayersAndPictures', false); 79 this._captureLayersAndPicturesSetting = Common.settings.createSetting('timel ineCaptureLayersAndPictures', false);
80 this._captureFilmStripSetting = Common.settings.createSetting('timelineCaptu reFilmStrip', false); 80 this._captureFilmStripSetting = Common.settings.createSetting('timelineCaptu reFilmStrip', false);
81 81
82 this._markUnusedCSS = Common.settings.createSetting('timelineMarkUnusedCSS', false); 82 this._markUnusedCSS = Common.settings.createSetting('timelineMarkUnusedCSS', false);
83 83
84 this._panelToolbar = new UI.Toolbar('', this.element); 84 this._panelToolbar = new UI.Toolbar('', this.element);
85 85
86 var timelinePane = new UI.VBox(); 86 this._timelinePane = new UI.VBox();
87 timelinePane.show(this.element); 87 this._timelinePane.show(this.element);
88 var topPaneElement = timelinePane.element.createChild('div', 'hbox'); 88 var topPaneElement = this._timelinePane.element.createChild('div', 'hbox');
89 topPaneElement.id = 'timeline-overview-panel'; 89 topPaneElement.id = 'timeline-overview-panel';
90 90
91 // Create top overview component. 91 // Create top overview component.
92 this._overviewPane = new UI.TimelineOverviewPane('timeline'); 92 this._overviewPane = new UI.TimelineOverviewPane('timeline');
93 this._overviewPane.addEventListener(UI.TimelineOverviewPane.Events.WindowCha nged, this._onWindowChanged.bind(this)); 93 this._overviewPane.addEventListener(UI.TimelineOverviewPane.Events.WindowCha nged, this._onWindowChanged.bind(this));
94 this._overviewPane.show(topPaneElement); 94 this._overviewPane.show(topPaneElement);
95 this._statusPaneContainer = timelinePane.element.createChild('div', 'status- pane-container fill'); 95 this._statusPaneContainer = this._timelinePane.element.createChild('div', 's tatus-pane-container fill');
96 96
97 this._createFileSelector(); 97 this._createFileSelector();
98 98
99 SDK.targetManager.addEventListener(SDK.TargetManager.Events.PageReloadReques ted, this._pageReloadRequested, this); 99 SDK.targetManager.addEventListener(SDK.TargetManager.Events.PageReloadReques ted, this._pageReloadRequested, this);
100 SDK.targetManager.addEventListener(SDK.TargetManager.Events.Load, this._load EventFired, this); 100 SDK.targetManager.addEventListener(SDK.TargetManager.Events.Load, this._load EventFired, this);
101 101
102 // Create top level properties splitter. 102 // Create top level properties splitter.
103 this._detailsSplitWidget = new UI.SplitWidget(false, true, 'timelinePanelDet ailsSplitViewState'); 103 this._detailsSplitWidget = new UI.SplitWidget(false, true, 'timelinePanelDet ailsSplitViewState');
104 this._detailsSplitWidget.element.classList.add('timeline-details-split'); 104 this._detailsSplitWidget.element.classList.add('timeline-details-split');
105 this._detailsView = new Timeline.TimelineDetailsView(this._model, this._filt ers, this); 105 this._detailsView = new Timeline.TimelineDetailsView(this._model, this._filt ers, this);
106 this._detailsSplitWidget.installResizer(this._detailsView.headerElement()); 106 this._detailsSplitWidget.installResizer(this._detailsView.headerElement());
107 this._detailsSplitWidget.setSidebarWidget(this._detailsView); 107 this._detailsSplitWidget.setSidebarWidget(this._detailsView);
108 108
109 this._searchableView = new UI.SearchableView(this); 109 this._searchableView = new UI.SearchableView(this);
110 this._searchableView.setMinimumSize(0, 100); 110 this._searchableView.setMinimumSize(0, 100);
111 this._searchableView.element.classList.add('searchable-view'); 111 this._searchableView.element.classList.add('searchable-view');
112 this._detailsSplitWidget.setMainWidget(this._searchableView); 112 this._detailsSplitWidget.setMainWidget(this._searchableView);
113 113
114 this._stackView = new UI.StackView(false); 114 this._stackView = new UI.StackView(false);
115 this._stackView.element.classList.add('timeline-view-stack'); 115 this._stackView.element.classList.add('timeline-view-stack');
116 116
117 this._stackView.show(this._searchableView.element); 117 this._stackView.show(this._searchableView.element);
118 this._onModeChanged(); 118 this._onModeChanged();
119 this._recreateToolbarItems(); 119 this._recreateToolbarItems();
120 120
121 this._captureNetworkSetting.addChangeListener(this._onNetworkChanged, this); 121 this._captureNetworkSetting.addChangeListener(this._onNetworkChanged, this);
122 this._captureMemorySetting.addChangeListener(this._onModeChanged, this); 122 this._captureMemorySetting.addChangeListener(this._onModeChanged, this);
123 this._captureFilmStripSetting.addChangeListener(this._onModeChanged, this); 123 this._captureFilmStripSetting.addChangeListener(this._onModeChanged, this);
124 124
125 this._detailsSplitWidget.show(timelinePane.element); 125 this._detailsSplitWidget.show(this._timelinePane.element);
126 this._detailsSplitWidget.hideSidebar(); 126 this._detailsSplitWidget.hideSidebar();
127 SDK.targetManager.addEventListener(SDK.TargetManager.Events.SuspendStateChan ged, this._onSuspendStateChanged, this); 127 SDK.targetManager.addEventListener(SDK.TargetManager.Events.SuspendStateChan ged, this._onSuspendStateChanged, this);
128 this._showRecordingHelpMessage(); 128 this._showRecordingHelpMessage();
129 129
130 /** @type {!SDK.TracingModel.Event}|undefined */ 130 /** @type {!SDK.TracingModel.Event}|undefined */
131 this._selectedSearchResult; 131 this._selectedSearchResult;
132 /** @type {!Array<!SDK.TracingModel.Event>}|undefined */ 132 /** @type {!Array<!SDK.TracingModel.Event>}|undefined */
133 this._searchResults; 133 this._searchResults;
134 } 134 }
135 135
(...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after
652 Components.LineLevelProfile.instance().reset(); 652 Components.LineLevelProfile.instance().reset();
653 this._tracingModel.reset(); 653 this._tracingModel.reset();
654 this._model.reset(); 654 this._model.reset();
655 this._showRecordingHelpMessage(); 655 this._showRecordingHelpMessage();
656 656
657 this.requestWindowTimes(0, Infinity); 657 this.requestWindowTimes(0, Infinity);
658 delete this._selection; 658 delete this._selection;
659 this._frameModel.reset(); 659 this._frameModel.reset();
660 this._filmStripModel.reset(this._tracingModel); 660 this._filmStripModel.reset(this._tracingModel);
661 this._overviewPane.reset(); 661 this._overviewPane.reset();
662 for (var i = 0; i < this._currentViews.length; ++i) 662 this._currentViews.forEach(view => view.reset());
663 this._currentViews[i].reset(); 663 this._overviewControls.forEach(overview => overview.reset());
664 for (var i = 0; i < this._overviewControls.length; ++i)
665 this._overviewControls[i].reset();
666 this.select(null); 664 this.select(null);
667 this._detailsSplitWidget.hideSidebar(); 665 this._detailsSplitWidget.hideSidebar();
668 } 666 }
669 667
670 /** 668 /**
671 * @override 669 * @override
672 */ 670 */
673 recordingStarted() { 671 recordingStarted() {
674 this._clear(); 672 this._clear();
675 this._setState(Timeline.TimelinePanel.State.Recording); 673 this._setState(Timeline.TimelinePanel.State.Recording);
676 this._showRecordingStarted(); 674 this._showRecordingStarted();
677 this._statusPane.updateStatus(Common.UIString('Recording\u2026')); 675 this._statusPane.updateStatus(Common.UIString('Recording\u2026'));
678 this._statusPane.updateProgressBar(Common.UIString('Buffer usage'), 0); 676 this._statusPane.updateProgressBar(Common.UIString('Buffer usage'), 0);
679 this._statusPane.startTimer(); 677 this._statusPane.startTimer();
680 this._hideRecordingHelpMessage(); 678 this._hideRecordingHelpMessage();
681 } 679 }
682 680
683 /** 681 /**
684 * @override 682 * @override
685 * @param {number} usage 683 * @param {number} usage
686 */ 684 */
687 recordingProgress(usage) { 685 recordingProgress(usage) {
688 this._statusPane.updateProgressBar(Common.UIString('Buffer usage'), usage * 100); 686 this._statusPane.updateProgressBar(Common.UIString('Buffer usage'), usage * 100);
689 } 687 }
690 688
691 _showRecordingHelpMessage() { 689 _showRecordingHelpMessage() {
690 if (Runtime.experiments.isEnabled('timelineLandingPage')) {
691 this._showLandingPage();
692 return;
693 }
694
692 /** 695 /**
693 * @param {string} tagName 696 * @param {string} tagName
694 * @param {string} contents 697 * @param {string} contents
695 * @return {!Element} 698 * @return {!Element}
696 */ 699 */
697 function encloseWithTag(tagName, contents) { 700 function encloseWithTag(tagName, contents) {
698 var e = createElement(tagName); 701 var e = createElement(tagName);
699 e.textContent = contents; 702 e.textContent = contents;
700 return e; 703 return e;
701 } 704 }
(...skipping 14 matching lines...) Expand all
716 hintText.createChild('br'); 719 hintText.createChild('br');
717 hintText.appendChild( 720 hintText.appendChild(
718 UI.formatLocalized('Then, zoom and pan the timeline with the mousewheel and %s keys.', [navigateNode])); 721 UI.formatLocalized('Then, zoom and pan the timeline with the mousewheel and %s keys.', [navigateNode]));
719 this._hideRecordingHelpMessage(); 722 this._hideRecordingHelpMessage();
720 this._helpMessageElement = 723 this._helpMessageElement =
721 this._searchableView.element.createChild('div', 'full-widget-dimmed-bann er timeline-status-pane'); 724 this._searchableView.element.createChild('div', 'full-widget-dimmed-bann er timeline-status-pane');
722 this._helpMessageElement.appendChild(hintText); 725 this._helpMessageElement.appendChild(hintText);
723 } 726 }
724 727
725 _hideRecordingHelpMessage() { 728 _hideRecordingHelpMessage() {
729 if (Runtime.experiments.isEnabled('timelineLandingPage')) {
730 this._hideLandingPage();
731 return;
732 }
726 if (this._helpMessageElement) 733 if (this._helpMessageElement)
727 this._helpMessageElement.remove(); 734 this._helpMessageElement.remove();
728 delete this._helpMessageElement; 735 delete this._helpMessageElement;
729 } 736 }
730 737
738 _showLandingPage() {
739 if (this._landingPage)
740 return;
741 this._detailsSplitWidget.detach();
742 this._landingPage = new Timeline.LandingPage();
743 this._landingPage.show(this._timelinePane.element);
744 }
745
746 _hideLandingPage() {
747 if (!this._landingPage)
748 return;
749 this._landingPage.detach();
750 this._landingPage = null;
751 this._detailsSplitWidget.show(this._timelinePane.element);
752 }
753
731 /** 754 /**
732 * @override 755 * @override
733 */ 756 */
734 loadingStarted() { 757 loadingStarted() {
735 this._hideRecordingHelpMessage(); 758 this._hideRecordingHelpMessage();
736 759
737 if (this._statusPane) 760 if (this._statusPane)
738 this._statusPane.hide(); 761 this._statusPane.hide();
739 this._statusPane = new Timeline.TimelinePanel.StatusPane(false, this._cancel Loading.bind(this)); 762 this._statusPane = new Timeline.TimelinePanel.StatusPane(false, this._cancel Loading.bind(this));
740 this._statusPane.showPane(this._statusPaneContainer); 763 this._statusPane.showPane(this._statusPaneContainer);
(...skipping 1216 matching lines...) Expand 10 before | Expand all | Expand 10 after
1957 } 1980 }
1958 1981
1959 /** 1982 /**
1960 * @override 1983 * @override
1961 * @param {!SDK.Target} target 1984 * @param {!SDK.Target} target
1962 */ 1985 */
1963 targetRemoved(target) { 1986 targetRemoved(target) {
1964 this._targets.remove(target, true); 1987 this._targets.remove(target, true);
1965 } 1988 }
1966 }; 1989 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698