| OLD | NEW |
| 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 Loading... |
| 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 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 403 | 403 |
| 404 _populateCPUThrottingCombobox() { | 404 _populateCPUThrottingCombobox() { |
| 405 var cpuThrottlingCombobox = this._cpuThrottlingCombobox; | 405 var cpuThrottlingCombobox = this._cpuThrottlingCombobox; |
| 406 cpuThrottlingCombobox.removeOptions(); | 406 cpuThrottlingCombobox.removeOptions(); |
| 407 var currentRate = this._cpuThrottlingManager.rate(); | 407 var currentRate = this._cpuThrottlingManager.rate(); |
| 408 var hasSelection = false; | 408 var hasSelection = false; |
| 409 /** | 409 /** |
| 410 * @param {string} name | 410 * @param {string} name |
| 411 * @param {number} value | 411 * @param {number} value |
| 412 */ | 412 */ |
| 413 function addGroupingOption(name, value) { | 413 function addOption(name, value) { |
| 414 var option = cpuThrottlingCombobox.createOption(name, '', String(value)); | 414 var option = cpuThrottlingCombobox.createOption(name, '', String(value)); |
| 415 cpuThrottlingCombobox.addOption(option); | 415 cpuThrottlingCombobox.addOption(option); |
| 416 if (hasSelection || (value && value !== currentRate)) | 416 if (hasSelection || (value && value !== currentRate)) |
| 417 return; | 417 return; |
| 418 cpuThrottlingCombobox.select(option); | 418 cpuThrottlingCombobox.select(option); |
| 419 hasSelection = true; | 419 hasSelection = true; |
| 420 } | 420 } |
| 421 var predefinedRates = new Map([ | 421 addOption(Common.UIString('No CPU throttling'), 1); |
| 422 [1, Common.UIString('No CPU throttling')], [2, Common.UIString('2\xD7 slow
down')], | 422 for (const rate of [2, 5, 10, 20]) |
| 423 [5, Common.UIString('5\xD7 slowdown')], [10, Common.UIString('10\xD7 slowd
own')], | 423 addOption(Common.UIString('%d\xD7 slowdown', rate), rate); |
| 424 [20, Common.UIString('20\xD7 slowdown')] | |
| 425 ]); | |
| 426 for (var rate of predefinedRates) | |
| 427 addGroupingOption(rate[1], rate[0]); | |
| 428 } | 424 } |
| 429 | 425 |
| 430 _prepareToLoadTimeline() { | 426 _prepareToLoadTimeline() { |
| 431 console.assert(this._state === Timeline.TimelinePanel.State.Idle); | 427 console.assert(this._state === Timeline.TimelinePanel.State.Idle); |
| 432 this._setState(Timeline.TimelinePanel.State.Loading); | 428 this._setState(Timeline.TimelinePanel.State.Loading); |
| 433 } | 429 } |
| 434 | 430 |
| 435 _createFileSelector() { | 431 _createFileSelector() { |
| 436 if (this._fileSelectorElement) | 432 if (this._fileSelectorElement) |
| 437 this._fileSelectorElement.remove(); | 433 this._fileSelectorElement.remove(); |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 626 } | 622 } |
| 627 | 623 |
| 628 _toggleRecording() { | 624 _toggleRecording() { |
| 629 if (this._state === Timeline.TimelinePanel.State.Idle) | 625 if (this._state === Timeline.TimelinePanel.State.Idle) |
| 630 this._startRecording(true); | 626 this._startRecording(true); |
| 631 else if (this._state === Timeline.TimelinePanel.State.Recording) | 627 else if (this._state === Timeline.TimelinePanel.State.Recording) |
| 632 this._stopRecording(); | 628 this._stopRecording(); |
| 633 } | 629 } |
| 634 | 630 |
| 635 _clear() { | 631 _clear() { |
| 632 this._showRecordingHelpMessage(); |
| 633 this._detailsSplitWidget.hideSidebar(); |
| 634 this._reset(); |
| 635 } |
| 636 |
| 637 _reset() { |
| 636 if (Runtime.experiments.isEnabled('timelineRuleUsageRecording') && this._mar
kUnusedCSS.get()) | 638 if (Runtime.experiments.isEnabled('timelineRuleUsageRecording') && this._mar
kUnusedCSS.get()) |
| 637 Components.CoverageProfile.instance().reset(); | 639 Components.CoverageProfile.instance().reset(); |
| 638 | 640 |
| 639 Components.LineLevelProfile.instance().reset(); | 641 Components.LineLevelProfile.instance().reset(); |
| 640 this._tracingModel.reset(); | 642 this._tracingModel.reset(); |
| 641 this._model.reset(); | 643 this._model.reset(); |
| 642 this._showRecordingHelpMessage(); | |
| 643 | 644 |
| 644 this.requestWindowTimes(0, Infinity); | 645 this.requestWindowTimes(0, Infinity); |
| 645 delete this._selection; | 646 delete this._selection; |
| 646 this._frameModel.reset(); | 647 this._frameModel.reset(); |
| 647 this._filmStripModel.reset(this._tracingModel); | 648 this._filmStripModel.reset(this._tracingModel); |
| 648 this._overviewPane.reset(); | 649 this._overviewPane.reset(); |
| 649 for (var i = 0; i < this._currentViews.length; ++i) | 650 this._currentViews.forEach(view => view.reset()); |
| 650 this._currentViews[i].reset(); | 651 this._overviewControls.forEach(overview => overview.reset()); |
| 651 for (var i = 0; i < this._overviewControls.length; ++i) | |
| 652 this._overviewControls[i].reset(); | |
| 653 this.select(null); | 652 this.select(null); |
| 654 this._detailsSplitWidget.hideSidebar(); | |
| 655 } | 653 } |
| 656 | 654 |
| 657 /** | 655 /** |
| 658 * @override | 656 * @override |
| 659 */ | 657 */ |
| 660 recordingStarted() { | 658 recordingStarted() { |
| 661 this._clear(); | 659 this._reset(); |
| 662 this._setState(Timeline.TimelinePanel.State.Recording); | 660 this._setState(Timeline.TimelinePanel.State.Recording); |
| 663 this._showRecordingStarted(); | 661 this._showRecordingStarted(); |
| 664 this._statusPane.updateStatus(Common.UIString('Recording\u2026')); | 662 this._statusPane.updateStatus(Common.UIString('Recording\u2026')); |
| 665 this._statusPane.updateProgressBar(Common.UIString('Buffer usage'), 0); | 663 this._statusPane.updateProgressBar(Common.UIString('Buffer usage'), 0); |
| 666 this._statusPane.startTimer(); | 664 this._statusPane.startTimer(); |
| 667 this._hideRecordingHelpMessage(); | 665 this._hideRecordingHelpMessage(); |
| 668 } | 666 } |
| 669 | 667 |
| 670 /** | 668 /** |
| 671 * @override | 669 * @override |
| 672 * @param {number} usage | 670 * @param {number} usage |
| 673 */ | 671 */ |
| 674 recordingProgress(usage) { | 672 recordingProgress(usage) { |
| 675 this._statusPane.updateProgressBar(Common.UIString('Buffer usage'), usage *
100); | 673 this._statusPane.updateProgressBar(Common.UIString('Buffer usage'), usage *
100); |
| 676 } | 674 } |
| 677 | 675 |
| 678 _showRecordingHelpMessage() { | 676 _showRecordingHelpMessage() { |
| 677 if (Runtime.experiments.isEnabled('timelineLandingPage')) { |
| 678 this._showLandingPage(); |
| 679 return; |
| 680 } |
| 681 |
| 679 /** | 682 /** |
| 680 * @param {string} tagName | 683 * @param {string} tagName |
| 681 * @param {string} contents | 684 * @param {string} contents |
| 682 * @return {!Element} | 685 * @return {!Element} |
| 683 */ | 686 */ |
| 684 function encloseWithTag(tagName, contents) { | 687 function encloseWithTag(tagName, contents) { |
| 685 var e = createElement(tagName); | 688 var e = createElement(tagName); |
| 686 e.textContent = contents; | 689 e.textContent = contents; |
| 687 return e; | 690 return e; |
| 688 } | 691 } |
| (...skipping 14 matching lines...) Expand all Loading... |
| 703 hintText.createChild('br'); | 706 hintText.createChild('br'); |
| 704 hintText.appendChild( | 707 hintText.appendChild( |
| 705 UI.formatLocalized('Then, zoom and pan the timeline with the mousewheel
and %s keys.', [navigateNode])); | 708 UI.formatLocalized('Then, zoom and pan the timeline with the mousewheel
and %s keys.', [navigateNode])); |
| 706 this._hideRecordingHelpMessage(); | 709 this._hideRecordingHelpMessage(); |
| 707 this._helpMessageElement = | 710 this._helpMessageElement = |
| 708 this._searchableView.element.createChild('div', 'full-widget-dimmed-bann
er timeline-status-pane'); | 711 this._searchableView.element.createChild('div', 'full-widget-dimmed-bann
er timeline-status-pane'); |
| 709 this._helpMessageElement.appendChild(hintText); | 712 this._helpMessageElement.appendChild(hintText); |
| 710 } | 713 } |
| 711 | 714 |
| 712 _hideRecordingHelpMessage() { | 715 _hideRecordingHelpMessage() { |
| 716 if (Runtime.experiments.isEnabled('timelineLandingPage')) { |
| 717 this._hideLandingPage(); |
| 718 return; |
| 719 } |
| 713 if (this._helpMessageElement) | 720 if (this._helpMessageElement) |
| 714 this._helpMessageElement.remove(); | 721 this._helpMessageElement.remove(); |
| 715 delete this._helpMessageElement; | 722 delete this._helpMessageElement; |
| 716 } | 723 } |
| 717 | 724 |
| 725 _showLandingPage() { |
| 726 if (this._landingPage) |
| 727 return; |
| 728 this._detailsSplitWidget.detach(); |
| 729 this._landingPage = new Timeline.TimelineLandingPage(); |
| 730 this._landingPage.show(this._timelinePane.element); |
| 731 } |
| 732 |
| 733 _hideLandingPage() { |
| 734 if (!this._landingPage) |
| 735 return; |
| 736 this._landingPage.detach(); |
| 737 this._landingPage = null; |
| 738 this._detailsSplitWidget.show(this._timelinePane.element); |
| 739 } |
| 740 |
| 718 /** | 741 /** |
| 719 * @override | 742 * @override |
| 720 */ | 743 */ |
| 721 loadingStarted() { | 744 loadingStarted() { |
| 722 this._hideRecordingHelpMessage(); | 745 this._hideRecordingHelpMessage(); |
| 723 | 746 |
| 724 if (this._statusPane) | 747 if (this._statusPane) |
| 725 this._statusPane.hide(); | 748 this._statusPane.hide(); |
| 726 this._statusPane = new Timeline.TimelinePanel.StatusPane(false, this._cancel
Loading.bind(this)); | 749 this._statusPane = new Timeline.TimelinePanel.StatusPane(false, this._cancel
Loading.bind(this)); |
| 727 this._statusPane.showPane(this._statusPaneContainer); | 750 this._statusPane.showPane(this._statusPaneContainer); |
| (...skipping 1216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1944 } | 1967 } |
| 1945 | 1968 |
| 1946 /** | 1969 /** |
| 1947 * @override | 1970 * @override |
| 1948 * @param {!SDK.Target} target | 1971 * @param {!SDK.Target} target |
| 1949 */ | 1972 */ |
| 1950 targetRemoved(target) { | 1973 targetRemoved(target) { |
| 1951 this._targets.remove(target, true); | 1974 this._targets.remove(target, true); |
| 1952 } | 1975 } |
| 1953 }; | 1976 }; |
| OLD | NEW |