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

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

Issue 2472213005: DevTools: introduce "Track CSS Usage" experiment (Closed)
Patch Set: Unused CSS highlight in sources panel Created 4 years, 1 month 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
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/timeline/TimelineController.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 this._markUnusedCSS = WebInspector.settings.createSetting('timelineMarkUnuse dCSS', false);
85
84 this._panelToolbar = new WebInspector.Toolbar('', this.element); 86 this._panelToolbar = new WebInspector.Toolbar('', this.element);
85 this._createToolbarItems(); 87 this._createToolbarItems();
86 88
87 var timelinePane = new WebInspector.VBox(); 89 var timelinePane = new WebInspector.VBox();
88 timelinePane.show(this.element); 90 timelinePane.show(this.element);
89 var topPaneElement = timelinePane.element.createChild('div', 'hbox'); 91 var topPaneElement = timelinePane.element.createChild('div', 'hbox');
90 topPaneElement.id = 'timeline-overview-panel'; 92 topPaneElement.id = 'timeline-overview-panel';
91 93
92 // Create top overview component. 94 // Create top overview component.
93 this._overviewPane = new WebInspector.TimelineOverviewPane('timeline'); 95 this._overviewPane = new WebInspector.TimelineOverviewPane('timeline');
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 WebInspector.UIString('Memory'), this._captureMemorySetting, 359 WebInspector.UIString('Memory'), this._captureMemorySetting,
358 WebInspector.UIString('Capture memory information on every timeline ev ent.'))); 360 WebInspector.UIString('Capture memory information on every timeline ev ent.')));
359 this._panelToolbar.appendToolbarItem(this._createSettingCheckbox( 361 this._panelToolbar.appendToolbarItem(this._createSettingCheckbox(
360 WebInspector.UIString('Paint'), this._captureLayersAndPicturesSetting, 362 WebInspector.UIString('Paint'), this._captureLayersAndPicturesSetting,
361 WebInspector.UIString( 363 WebInspector.UIString(
362 'Capture graphics layer positions and rasterization draw calls. (H as large performance overhead)'))); 364 'Capture graphics layer positions and rasterization draw calls. (H as large performance overhead)')));
363 } else { 365 } else {
364 this._panelToolbar.appendToolbarItem(screenshotCheckbox); 366 this._panelToolbar.appendToolbarItem(screenshotCheckbox);
365 } 367 }
366 368
369 if (Runtime.experiments.isEnabled('timelineRuleUsageRecording')) {
370 this._panelToolbar.appendToolbarItem(this._createSettingCheckbox(
371 WebInspector.UIString('CSS coverage'), this._markUnusedCSS,
372 WebInspector.UIString('Mark unused CSS in souces.')));
373 }
374
367 this._captureNetworkSetting.addChangeListener(this._onNetworkChanged, this); 375 this._captureNetworkSetting.addChangeListener(this._onNetworkChanged, this);
368 this._captureMemorySetting.addChangeListener(this._onModeChanged, this); 376 this._captureMemorySetting.addChangeListener(this._onModeChanged, this);
369 this._captureFilmStripSetting.addChangeListener(this._onModeChanged, this); 377 this._captureFilmStripSetting.addChangeListener(this._onModeChanged, this);
370 378
371 this._panelToolbar.appendSeparator(); 379 this._panelToolbar.appendSeparator();
372 var garbageCollectButton = 380 var garbageCollectButton =
373 new WebInspector.ToolbarButton(WebInspector.UIString('Collect garbage'), 'largeicon-trash-bin'); 381 new WebInspector.ToolbarButton(WebInspector.UIString('Collect garbage'), 'largeicon-trash-bin');
374 garbageCollectButton.addEventListener('click', this._garbageCollectButtonCli cked, this); 382 garbageCollectButton.addEventListener('click', this._garbageCollectButtonCli cked, this);
375 this._panelToolbar.appendToolbarItem(garbageCollectButton); 383 this._panelToolbar.appendToolbarItem(garbageCollectButton);
376 384
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
567 * @param {boolean} userInitiated 575 * @param {boolean} userInitiated
568 */ 576 */
569 _startRecording(userInitiated) { 577 _startRecording(userInitiated) {
570 console.assert(!this._statusPane, 'Status pane is already opened.'); 578 console.assert(!this._statusPane, 'Status pane is already opened.');
571 var mainTarget = WebInspector.targetManager.mainTarget(); 579 var mainTarget = WebInspector.targetManager.mainTarget();
572 if (!mainTarget) 580 if (!mainTarget)
573 return; 581 return;
574 this._setState(WebInspector.TimelinePanel.State.StartPending); 582 this._setState(WebInspector.TimelinePanel.State.StartPending);
575 this._showRecordingStarted(); 583 this._showRecordingStarted();
576 584
585 if (Runtime.experiments.isEnabled('timelineRuleUsageRecording') && this._mar kUnusedCSS.get())
586 WebInspector.CSSModel.fromTarget(mainTarget).startRuleUsageTracking();
587
577 this._autoRecordGeneration = userInitiated ? null : Symbol('Generation'); 588 this._autoRecordGeneration = userInitiated ? null : Symbol('Generation');
578 this._controller = new WebInspector.TimelineController(mainTarget, this, thi s._tracingModel); 589 this._controller = new WebInspector.TimelineController(mainTarget, this, thi s._tracingModel);
579 this._controller.startRecording( 590 this._controller.startRecording(
580 true, this._captureJSProfileSetting.get(), this._captureMemorySetting.ge t(), 591 true, this._captureJSProfileSetting.get(), this._captureMemorySetting.ge t(),
581 this._captureLayersAndPicturesSetting.get(), 592 this._captureLayersAndPicturesSetting.get(),
582 this._captureFilmStripSetting && this._captureFilmStripSetting.get()); 593 this._captureFilmStripSetting && this._captureFilmStripSetting.get());
583 594
584 for (var i = 0; i < this._overviewControls.length; ++i) 595 for (var i = 0; i < this._overviewControls.length; ++i)
585 this._overviewControls[i].timelineStarted(); 596 this._overviewControls[i].timelineStarted();
586 597
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
622 this._stopRecording(); 633 this._stopRecording();
623 } 634 }
624 635
625 _garbageCollectButtonClicked() { 636 _garbageCollectButtonClicked() {
626 var targets = WebInspector.targetManager.targets(); 637 var targets = WebInspector.targetManager.targets();
627 for (var i = 0; i < targets.length; ++i) 638 for (var i = 0; i < targets.length; ++i)
628 targets[i].heapProfilerAgent().collectGarbage(); 639 targets[i].heapProfilerAgent().collectGarbage();
629 } 640 }
630 641
631 _clear() { 642 _clear() {
643 if (Runtime.experiments.isEnabled('timelineRuleUsageRecording') && this._mar kUnusedCSS.get())
644 WebInspector.CoverageProfile.instance().reset();
645
632 WebInspector.LineLevelProfile.instance().reset(); 646 WebInspector.LineLevelProfile.instance().reset();
633 this._tracingModel.reset(); 647 this._tracingModel.reset();
634 this._model.reset(); 648 this._model.reset();
635 this._showRecordingHelpMessage(); 649 this._showRecordingHelpMessage();
636 650
637 this.requestWindowTimes(0, Infinity); 651 this.requestWindowTimes(0, Infinity);
638 delete this._selection; 652 delete this._selection;
639 this._frameModel.reset(); 653 this._frameModel.reset();
640 this._filmStripModel.reset(this._tracingModel); 654 this._filmStripModel.reset(this._tracingModel);
641 this._overviewPane.reset(); 655 this._overviewPane.reset();
(...skipping 1354 matching lines...) Expand 10 before | Expand all | Expand 10 after
1996 /** 2010 /**
1997 * @param {!Event} event 2011 * @param {!Event} event
1998 */ 2012 */
1999 _onKeyDown(event) { 2013 _onKeyDown(event) {
2000 if (event.keyCode === WebInspector.KeyboardShortcut.Keys.Enter.code) { 2014 if (event.keyCode === WebInspector.KeyboardShortcut.Keys.Enter.code) {
2001 event.preventDefault(); 2015 event.preventDefault();
2002 this._apply(); 2016 this._apply();
2003 } 2017 }
2004 } 2018 }
2005 }; 2019 };
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/timeline/TimelineController.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698