Chromium Code Reviews| 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 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 416 * @param {number} value | 416 * @param {number} value |
| 417 */ | 417 */ |
| 418 function addGroupingOption(name, value) { | 418 function addGroupingOption(name, value) { |
| 419 var option = cpuThrottlingCombobox.createOption(name, '', String(value)); | 419 var option = cpuThrottlingCombobox.createOption(name, '', String(value)); |
| 420 cpuThrottlingCombobox.addOption(option); | 420 cpuThrottlingCombobox.addOption(option); |
| 421 if (hasSelection || (value && value !== currentRate)) | 421 if (hasSelection || (value && value !== currentRate)) |
| 422 return; | 422 return; |
| 423 cpuThrottlingCombobox.select(option); | 423 cpuThrottlingCombobox.select(option); |
| 424 hasSelection = true; | 424 hasSelection = true; |
| 425 } | 425 } |
| 426 var predefinedRates = new Map([ | 426 addGroupingOption(Common.UIString('No CPU throttling'), 1); |
| 427 [1, Common.UIString('No CPU throttling')], | 427 for (const rate of [2, 5, 10, 20]) |
| 428 [2, Common.UIString('2\xD7 slowdown')], | 428 addGroupingOption(Common.UIString('%d\xD7 slowdown', rate), rate); |
| 429 [5, Common.UIString('5\xD7 slowdown')], | |
| 430 [10, Common.UIString('10\xD7 slowdown')], | |
| 431 [20, Common.UIString('20\xD7 slowdown')] | |
| 432 ]); | |
| 433 for (var rate of predefinedRates) | |
| 434 addGroupingOption(rate[1], rate[0]); | |
| 435 } | 429 } |
| 436 | 430 |
| 437 _prepareToLoadTimeline() { | 431 _prepareToLoadTimeline() { |
| 438 console.assert(this._state === Timeline.TimelinePanel.State.Idle); | 432 console.assert(this._state === Timeline.TimelinePanel.State.Idle); |
| 439 this._setState(Timeline.TimelinePanel.State.Loading); | 433 this._setState(Timeline.TimelinePanel.State.Loading); |
| 440 } | 434 } |
| 441 | 435 |
| 442 _createFileSelector() { | 436 _createFileSelector() { |
| 443 if (this._fileSelectorElement) | 437 if (this._fileSelectorElement) |
| 444 this._fileSelectorElement.remove(); | 438 this._fileSelectorElement.remove(); |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 578 } | 572 } |
| 579 | 573 |
| 580 /** | 574 /** |
| 581 * @param {boolean} userInitiated | 575 * @param {boolean} userInitiated |
| 582 */ | 576 */ |
| 583 _startRecording(userInitiated) { | 577 _startRecording(userInitiated) { |
| 584 console.assert(!this._statusPane, 'Status pane is already opened.'); | 578 console.assert(!this._statusPane, 'Status pane is already opened.'); |
| 585 var mainTarget = SDK.targetManager.mainTarget(); | 579 var mainTarget = SDK.targetManager.mainTarget(); |
| 586 if (!mainTarget) | 580 if (!mainTarget) |
| 587 return; | 581 return; |
| 582 this._clear(); | |
|
caseq
2016/12/12 18:51:53
I don't think this should be here.
alph
2016/12/12 20:43:13
Done.
| |
| 588 this._setState(Timeline.TimelinePanel.State.StartPending); | 583 this._setState(Timeline.TimelinePanel.State.StartPending); |
| 589 this._showRecordingStarted(); | 584 this._showRecordingStarted(); |
| 590 | 585 |
| 591 if (Runtime.experiments.isEnabled('timelineRuleUsageRecording') && this._mar kUnusedCSS.get()) | 586 if (Runtime.experiments.isEnabled('timelineRuleUsageRecording') && this._mar kUnusedCSS.get()) |
| 592 SDK.CSSModel.fromTarget(mainTarget).startRuleUsageTracking(); | 587 SDK.CSSModel.fromTarget(mainTarget).startRuleUsageTracking(); |
| 593 | 588 |
| 594 this._autoRecordGeneration = userInitiated ? null : Symbol('Generation'); | 589 this._autoRecordGeneration = userInitiated ? null : Symbol('Generation'); |
| 595 this._controller = new Timeline.TimelineController(mainTarget, this, this._t racingModel); | 590 this._controller = new Timeline.TimelineController(mainTarget, this, this._t racingModel); |
| 596 this._controller.startRecording( | 591 this._controller.startRecording( |
| 597 true, this._captureJSProfileSetting.get(), this._captureMemorySetting.ge t(), | 592 true, this._captureJSProfileSetting.get(), this._captureMemorySetting.ge t(), |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 652 Components.LineLevelProfile.instance().reset(); | 647 Components.LineLevelProfile.instance().reset(); |
| 653 this._tracingModel.reset(); | 648 this._tracingModel.reset(); |
| 654 this._model.reset(); | 649 this._model.reset(); |
| 655 this._showRecordingHelpMessage(); | 650 this._showRecordingHelpMessage(); |
| 656 | 651 |
| 657 this.requestWindowTimes(0, Infinity); | 652 this.requestWindowTimes(0, Infinity); |
| 658 delete this._selection; | 653 delete this._selection; |
| 659 this._frameModel.reset(); | 654 this._frameModel.reset(); |
| 660 this._filmStripModel.reset(this._tracingModel); | 655 this._filmStripModel.reset(this._tracingModel); |
| 661 this._overviewPane.reset(); | 656 this._overviewPane.reset(); |
| 662 for (var i = 0; i < this._currentViews.length; ++i) | 657 this._currentViews.forEach(view => view.reset()); |
| 663 this._currentViews[i].reset(); | 658 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); | 659 this.select(null); |
| 667 this._detailsSplitWidget.hideSidebar(); | 660 this._detailsSplitWidget.hideSidebar(); |
| 668 } | 661 } |
| 669 | 662 |
| 670 /** | 663 /** |
| 671 * @override | 664 * @override |
| 672 */ | 665 */ |
| 673 recordingStarted() { | 666 recordingStarted() { |
| 674 this._clear(); | |
| 675 this._setState(Timeline.TimelinePanel.State.Recording); | 667 this._setState(Timeline.TimelinePanel.State.Recording); |
| 676 this._showRecordingStarted(); | 668 this._showRecordingStarted(); |
| 677 this._statusPane.updateStatus(Common.UIString('Recording\u2026')); | 669 this._statusPane.updateStatus(Common.UIString('Recording\u2026')); |
| 678 this._statusPane.updateProgressBar(Common.UIString('Buffer usage'), 0); | 670 this._statusPane.updateProgressBar(Common.UIString('Buffer usage'), 0); |
| 679 this._statusPane.startTimer(); | 671 this._statusPane.startTimer(); |
| 680 this._hideRecordingHelpMessage(); | 672 this._hideRecordingHelpMessage(); |
| 681 } | 673 } |
| 682 | 674 |
| 683 /** | 675 /** |
| 684 * @override | 676 * @override |
| 685 * @param {number} usage | 677 * @param {number} usage |
| 686 */ | 678 */ |
| 687 recordingProgress(usage) { | 679 recordingProgress(usage) { |
| 688 this._statusPane.updateProgressBar(Common.UIString('Buffer usage'), usage * 100); | 680 this._statusPane.updateProgressBar(Common.UIString('Buffer usage'), usage * 100); |
| 689 } | 681 } |
| 690 | 682 |
| 691 _showRecordingHelpMessage() { | 683 _showRecordingHelpMessage() { |
| 684 if (Runtime.experiments.isEnabled('timelineLandingPage')) { | |
| 685 this._showLandingPage(); | |
| 686 return; | |
| 687 } | |
| 688 | |
| 692 /** | 689 /** |
| 693 * @param {string} tagName | 690 * @param {string} tagName |
| 694 * @param {string} contents | 691 * @param {string} contents |
| 695 * @return {!Element} | 692 * @return {!Element} |
| 696 */ | 693 */ |
| 697 function encloseWithTag(tagName, contents) { | 694 function encloseWithTag(tagName, contents) { |
| 698 var e = createElement(tagName); | 695 var e = createElement(tagName); |
| 699 e.textContent = contents; | 696 e.textContent = contents; |
| 700 return e; | 697 return e; |
| 701 } | 698 } |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 716 hintText.createChild('br'); | 713 hintText.createChild('br'); |
| 717 hintText.appendChild( | 714 hintText.appendChild( |
| 718 UI.formatLocalized('Then, zoom and pan the timeline with the mousewheel and %s keys.', [navigateNode])); | 715 UI.formatLocalized('Then, zoom and pan the timeline with the mousewheel and %s keys.', [navigateNode])); |
| 719 this._hideRecordingHelpMessage(); | 716 this._hideRecordingHelpMessage(); |
| 720 this._helpMessageElement = | 717 this._helpMessageElement = |
| 721 this._searchableView.element.createChild('div', 'full-widget-dimmed-bann er timeline-status-pane'); | 718 this._searchableView.element.createChild('div', 'full-widget-dimmed-bann er timeline-status-pane'); |
| 722 this._helpMessageElement.appendChild(hintText); | 719 this._helpMessageElement.appendChild(hintText); |
| 723 } | 720 } |
| 724 | 721 |
| 725 _hideRecordingHelpMessage() { | 722 _hideRecordingHelpMessage() { |
| 723 if (Runtime.experiments.isEnabled('timelineLandingPage')) { | |
| 724 this._hideLandingPage(); | |
| 725 return; | |
| 726 } | |
| 726 if (this._helpMessageElement) | 727 if (this._helpMessageElement) |
| 727 this._helpMessageElement.remove(); | 728 this._helpMessageElement.remove(); |
| 728 delete this._helpMessageElement; | 729 delete this._helpMessageElement; |
| 729 } | 730 } |
| 730 | 731 |
| 732 _showLandingPage() { | |
| 733 if (this._landingPage) | |
| 734 return; | |
| 735 this._detailsSplitWidget.detach(); | |
| 736 this._landingPage = new Timeline.TimelineLandingPage(); | |
| 737 this._landingPage.show(this._timelinePane.element); | |
| 738 } | |
| 739 | |
| 740 _hideLandingPage() { | |
| 741 if (!this._landingPage) | |
| 742 return; | |
| 743 this._landingPage.detach(); | |
| 744 this._landingPage = null; | |
| 745 this._detailsSplitWidget.show(this._timelinePane.element); | |
| 746 } | |
| 747 | |
| 731 /** | 748 /** |
| 732 * @override | 749 * @override |
| 733 */ | 750 */ |
| 734 loadingStarted() { | 751 loadingStarted() { |
| 735 this._hideRecordingHelpMessage(); | 752 this._hideRecordingHelpMessage(); |
| 736 | 753 |
| 737 if (this._statusPane) | 754 if (this._statusPane) |
| 738 this._statusPane.hide(); | 755 this._statusPane.hide(); |
| 739 this._statusPane = new Timeline.TimelinePanel.StatusPane(false, this._cancel Loading.bind(this)); | 756 this._statusPane = new Timeline.TimelinePanel.StatusPane(false, this._cancel Loading.bind(this)); |
| 740 this._statusPane.showPane(this._statusPaneContainer); | 757 this._statusPane.showPane(this._statusPaneContainer); |
| (...skipping 1216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1957 } | 1974 } |
| 1958 | 1975 |
| 1959 /** | 1976 /** |
| 1960 * @override | 1977 * @override |
| 1961 * @param {!SDK.Target} target | 1978 * @param {!SDK.Target} target |
| 1962 */ | 1979 */ |
| 1963 targetRemoved(target) { | 1980 targetRemoved(target) { |
| 1964 this._targets.remove(target, true); | 1981 this._targets.remove(target, true); |
| 1965 } | 1982 } |
| 1966 }; | 1983 }; |
| OLD | NEW |