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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 74 /** @type {!Array.<!WebInspector.TimelineModeView>} */ | 74 /** @type {!Array.<!WebInspector.TimelineModeView>} */ |
| 75 this._currentViews = []; | 75 this._currentViews = []; |
| 76 | 76 |
| 77 this._captureNetworkSetting = WebInspector.settings.createSetting('timelineC aptureNetwork', false); | 77 this._captureNetworkSetting = WebInspector.settings.createSetting('timelineC aptureNetwork', false); |
| 78 this._captureJSProfileSetting = WebInspector.settings.createSetting('timelin eEnableJSSampling', true); | 78 this._captureJSProfileSetting = WebInspector.settings.createSetting('timelin eEnableJSSampling', true); |
| 79 this._captureMemorySetting = WebInspector.settings.createSetting('timelineCa ptureMemory', false); | 79 this._captureMemorySetting = WebInspector.settings.createSetting('timelineCa ptureMemory', false); |
| 80 this._captureLayersAndPicturesSetting = | 80 this._captureLayersAndPicturesSetting = |
| 81 WebInspector.settings.createSetting('timelineCaptureLayersAndPictures', false); | 81 WebInspector.settings.createSetting('timelineCaptureLayersAndPictures', false); |
| 82 this._captureFilmStripSetting = WebInspector.settings.createSetting('timelin eCaptureFilmStrip', false); | 82 this._captureFilmStripSetting = WebInspector.settings.createSetting('timelin eCaptureFilmStrip', false); |
| 83 | 83 |
| 84 if (Runtime.experiments.isEnabled('timelineRuleUsageRecording')) { | |
| 85 this._markUnusedCSS = WebInspector.settings.createSetting('timelineMarkUnu sedCSS', false); | |
| 86 } | |
| 87 | |
| 84 this._panelToolbar = new WebInspector.Toolbar('', this.element); | 88 this._panelToolbar = new WebInspector.Toolbar('', this.element); |
| 85 this._createToolbarItems(); | 89 this._createToolbarItems(); |
| 86 | 90 |
| 87 var timelinePane = new WebInspector.VBox(); | 91 var timelinePane = new WebInspector.VBox(); |
| 88 timelinePane.show(this.element); | 92 timelinePane.show(this.element); |
| 89 var topPaneElement = timelinePane.element.createChild('div', 'hbox'); | 93 var topPaneElement = timelinePane.element.createChild('div', 'hbox'); |
| 90 topPaneElement.id = 'timeline-overview-panel'; | 94 topPaneElement.id = 'timeline-overview-panel'; |
| 91 | 95 |
| 92 // Create top overview component. | 96 // Create top overview component. |
| 93 this._overviewPane = new WebInspector.TimelineOverviewPane('timeline'); | 97 this._overviewPane = new WebInspector.TimelineOverviewPane('timeline'); |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 357 WebInspector.UIString('Memory'), this._captureMemorySetting, | 361 WebInspector.UIString('Memory'), this._captureMemorySetting, |
| 358 WebInspector.UIString('Capture memory information on every timeline ev ent.'))); | 362 WebInspector.UIString('Capture memory information on every timeline ev ent.'))); |
| 359 this._panelToolbar.appendToolbarItem(this._createSettingCheckbox( | 363 this._panelToolbar.appendToolbarItem(this._createSettingCheckbox( |
| 360 WebInspector.UIString('Paint'), this._captureLayersAndPicturesSetting, | 364 WebInspector.UIString('Paint'), this._captureLayersAndPicturesSetting, |
| 361 WebInspector.UIString( | 365 WebInspector.UIString( |
| 362 'Capture graphics layer positions and rasterization draw calls. (H as large performance overhead)'))); | 366 'Capture graphics layer positions and rasterization draw calls. (H as large performance overhead)'))); |
| 363 } else { | 367 } else { |
| 364 this._panelToolbar.appendToolbarItem(screenshotCheckbox); | 368 this._panelToolbar.appendToolbarItem(screenshotCheckbox); |
| 365 } | 369 } |
| 366 | 370 |
| 371 if (Runtime.experiments.isEnabled('timelineRuleUsageRecording')) { | |
| 372 this._panelToolbar.appendToolbarItem(this._createSettingCheckbox( | |
| 373 WebInspector.UIString('Audits'), this._markUnusedCSS, | |
| 374 WebInspector.UIString('Mark unused CSS in souces.'))); | |
| 375 } | |
| 376 | |
| 367 this._captureNetworkSetting.addChangeListener(this._onNetworkChanged, this); | 377 this._captureNetworkSetting.addChangeListener(this._onNetworkChanged, this); |
| 368 this._captureMemorySetting.addChangeListener(this._onModeChanged, this); | 378 this._captureMemorySetting.addChangeListener(this._onModeChanged, this); |
| 369 this._captureFilmStripSetting.addChangeListener(this._onModeChanged, this); | 379 this._captureFilmStripSetting.addChangeListener(this._onModeChanged, this); |
| 370 | 380 |
| 371 this._panelToolbar.appendSeparator(); | 381 this._panelToolbar.appendSeparator(); |
| 372 var garbageCollectButton = | 382 var garbageCollectButton = |
| 373 new WebInspector.ToolbarButton(WebInspector.UIString('Collect garbage'), 'garbage-collect-toolbar-item'); | 383 new WebInspector.ToolbarButton(WebInspector.UIString('Collect garbage'), 'garbage-collect-toolbar-item'); |
| 374 garbageCollectButton.addEventListener('click', this._garbageCollectButtonCli cked, this); | 384 garbageCollectButton.addEventListener('click', this._garbageCollectButtonCli cked, this); |
| 375 this._panelToolbar.appendToolbarItem(garbageCollectButton); | 385 this._panelToolbar.appendToolbarItem(garbageCollectButton); |
| 376 | 386 |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 567 * @param {boolean} userInitiated | 577 * @param {boolean} userInitiated |
| 568 */ | 578 */ |
| 569 _startRecording(userInitiated) { | 579 _startRecording(userInitiated) { |
| 570 console.assert(!this._statusPane, 'Status pane is already opened.'); | 580 console.assert(!this._statusPane, 'Status pane is already opened.'); |
| 571 var mainTarget = WebInspector.targetManager.mainTarget(); | 581 var mainTarget = WebInspector.targetManager.mainTarget(); |
| 572 if (!mainTarget) | 582 if (!mainTarget) |
| 573 return; | 583 return; |
| 574 this._setState(WebInspector.TimelinePanel.State.StartPending); | 584 this._setState(WebInspector.TimelinePanel.State.StartPending); |
| 575 this._showRecordingStarted(); | 585 this._showRecordingStarted(); |
| 576 | 586 |
| 587 if (Runtime.experiments.isEnabled('timelineRuleUsageRecording')) | |
|
caseq
2016/11/04 21:10:02
Also check the setting here.
| |
| 588 WebInspector.CSSModel.fromTarget(mainTarget).startRuleUsageTracking(); | |
| 589 | |
| 577 this._autoRecordGeneration = userInitiated ? null : Symbol('Generation'); | 590 this._autoRecordGeneration = userInitiated ? null : Symbol('Generation'); |
| 578 this._controller = new WebInspector.TimelineController(mainTarget, this, thi s._tracingModel); | 591 this._controller = new WebInspector.TimelineController(mainTarget, this, thi s._tracingModel); |
| 579 this._controller.startRecording( | 592 this._controller.startRecording( |
| 580 true, this._captureJSProfileSetting.get(), this._captureMemorySetting.ge t(), | 593 true, this._captureJSProfileSetting.get(), this._captureMemorySetting.ge t(), |
| 581 this._captureLayersAndPicturesSetting.get(), | 594 this._captureLayersAndPicturesSetting.get(), |
| 582 this._captureFilmStripSetting && this._captureFilmStripSetting.get()); | 595 this._captureFilmStripSetting && this._captureFilmStripSetting.get()); |
| 583 | 596 |
| 584 for (var i = 0; i < this._overviewControls.length; ++i) | 597 for (var i = 0; i < this._overviewControls.length; ++i) |
| 585 this._overviewControls[i].timelineStarted(); | 598 this._overviewControls[i].timelineStarted(); |
| 586 | 599 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 622 this._stopRecording(); | 635 this._stopRecording(); |
| 623 } | 636 } |
| 624 | 637 |
| 625 _garbageCollectButtonClicked() { | 638 _garbageCollectButtonClicked() { |
| 626 var targets = WebInspector.targetManager.targets(); | 639 var targets = WebInspector.targetManager.targets(); |
| 627 for (var i = 0; i < targets.length; ++i) | 640 for (var i = 0; i < targets.length; ++i) |
| 628 targets[i].heapProfilerAgent().collectGarbage(); | 641 targets[i].heapProfilerAgent().collectGarbage(); |
| 629 } | 642 } |
| 630 | 643 |
| 631 _clear() { | 644 _clear() { |
| 645 if (Runtime.experiments.isEnabled('timelineRuleUsageRecording')) | |
| 646 WebInspector.LineMarkingProfile.instance().reset(); | |
| 647 | |
| 632 WebInspector.LineLevelProfile.instance().reset(); | 648 WebInspector.LineLevelProfile.instance().reset(); |
| 633 this._tracingModel.reset(); | 649 this._tracingModel.reset(); |
| 634 this._model.reset(); | 650 this._model.reset(); |
| 635 this._showRecordingHelpMessage(); | 651 this._showRecordingHelpMessage(); |
| 636 | 652 |
| 637 this.requestWindowTimes(0, Infinity); | 653 this.requestWindowTimes(0, Infinity); |
| 638 delete this._selection; | 654 delete this._selection; |
| 639 this._frameModel.reset(); | 655 this._frameModel.reset(); |
| 640 this._filmStripModel.reset(this._tracingModel); | 656 this._filmStripModel.reset(this._tracingModel); |
| 641 this._overviewPane.reset(); | 657 this._overviewPane.reset(); |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 755 this._statusPane.updateStatus(WebInspector.UIString('Processing timeline\u 2026')); | 771 this._statusPane.updateStatus(WebInspector.UIString('Processing timeline\u 2026')); |
| 756 this._model.setEvents(this._tracingModel, loadedFromFile); | 772 this._model.setEvents(this._tracingModel, loadedFromFile); |
| 757 this._frameModel.reset(); | 773 this._frameModel.reset(); |
| 758 this._frameModel.addTraceEvents( | 774 this._frameModel.addTraceEvents( |
| 759 WebInspector.targetManager.mainTarget(), this._model.inspectedTargetEven ts(), this._model.sessionId() || ''); | 775 WebInspector.targetManager.mainTarget(), this._model.inspectedTargetEven ts(), this._model.sessionId() || ''); |
| 760 this._filmStripModel.reset(this._tracingModel); | 776 this._filmStripModel.reset(this._tracingModel); |
| 761 var groups = WebInspector.TimelineModel.AsyncEventGroup; | 777 var groups = WebInspector.TimelineModel.AsyncEventGroup; |
| 762 var asyncEventsByGroup = this._model.mainThreadAsyncEvents(); | 778 var asyncEventsByGroup = this._model.mainThreadAsyncEvents(); |
| 763 this._irModel.populate(asyncEventsByGroup.get(groups.input), asyncEventsByGr oup.get(groups.animation)); | 779 this._irModel.populate(asyncEventsByGroup.get(groups.input), asyncEventsByGr oup.get(groups.animation)); |
| 764 this._model.cpuProfiles().forEach(profile => WebInspector.LineLevelProfile.i nstance().appendCPUProfile(profile)); | 780 this._model.cpuProfiles().forEach(profile => WebInspector.LineLevelProfile.i nstance().appendCPUProfile(profile)); |
| 781 | |
| 782 if (Runtime.experiments.isEnabled('timelineRuleUsageRecording')) { | |
| 783 var cssModel = WebInspector.CSSModel.fromTarget(WebInspector.targetManager .mainTarget()); | |
| 784 | |
| 785 function ruleListReceived(ruleUsageList) { | |
| 786 if (!ruleUsageList) | |
| 787 return; | |
| 788 | |
| 789 for (var i = 0; i < ruleUsageList.length; ++i) { | |
|
caseq
2016/11/04 21:10:02
for (var rule of ruleUsageList)
| |
| 790 if (!ruleUsageList[i].wasUsed) { | |
|
caseq
2016/11/04 21:10:02
if (!rule.wasUsed)
continue;
| |
| 791 | |
| 792 var styleSheetHeader = cssModel.styleSheetHeaderForId(ruleUsageList[ i].styleSheetId); | |
| 793 var url = styleSheetHeader.sourceURL; | |
| 794 | |
| 795 WebInspector.LineMarkingProfile.instance().appendUnusedRule(url, rul eUsageList[i].range.startLine); | |
| 796 } | |
| 797 } | |
| 798 } | |
| 799 | |
| 800 cssModel.ruleListPromise().then(ruleListReceived); | |
| 801 } | |
| 802 | |
| 765 if (this._statusPane) | 803 if (this._statusPane) |
| 766 this._statusPane.hide(); | 804 this._statusPane.hide(); |
| 767 delete this._statusPane; | 805 delete this._statusPane; |
| 768 this._overviewPane.reset(); | 806 this._overviewPane.reset(); |
| 769 this._overviewPane.setBounds(this._model.minimumRecordTime(), this._model.ma ximumRecordTime()); | 807 this._overviewPane.setBounds(this._model.minimumRecordTime(), this._model.ma ximumRecordTime()); |
| 770 this._setAutoWindowTimes(); | 808 this._setAutoWindowTimes(); |
| 771 this._refreshViews(); | 809 this._refreshViews(); |
| 772 for (var i = 0; i < this._overviewControls.length; ++i) | 810 for (var i = 0; i < this._overviewControls.length; ++i) |
| 773 this._overviewControls[i].timelineStopped(); | 811 this._overviewControls[i].timelineStopped(); |
| 774 this._setMarkers(); | 812 this._setMarkers(); |
| (...skipping 1221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1996 /** | 2034 /** |
| 1997 * @param {!Event} event | 2035 * @param {!Event} event |
| 1998 */ | 2036 */ |
| 1999 _onKeyDown(event) { | 2037 _onKeyDown(event) { |
| 2000 if (event.keyCode === WebInspector.KeyboardShortcut.Keys.Enter.code) { | 2038 if (event.keyCode === WebInspector.KeyboardShortcut.Keys.Enter.code) { |
| 2001 event.preventDefault(); | 2039 event.preventDefault(); |
| 2002 this._apply(); | 2040 this._apply(); |
| 2003 } | 2041 } |
| 2004 } | 2042 } |
| 2005 }; | 2043 }; |
| OLD | NEW |