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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/devtools/front_end/timeline/TimelinePanel.js
diff --git a/third_party/WebKit/Source/devtools/front_end/timeline/TimelinePanel.js b/third_party/WebKit/Source/devtools/front_end/timeline/TimelinePanel.js
index a0f40b06ee1e006f99fb00392c97750976cda153..51433c15c4a5d5cb993868ac741c999fa657db66 100644
--- a/third_party/WebKit/Source/devtools/front_end/timeline/TimelinePanel.js
+++ b/third_party/WebKit/Source/devtools/front_end/timeline/TimelinePanel.js
@@ -81,6 +81,8 @@ WebInspector.TimelinePanel = class extends WebInspector.Panel {
WebInspector.settings.createSetting('timelineCaptureLayersAndPictures', false);
this._captureFilmStripSetting = WebInspector.settings.createSetting('timelineCaptureFilmStrip', false);
+ this._markUnusedCSS = WebInspector.settings.createSetting('timelineMarkUnusedCSS', false);
+
this._panelToolbar = new WebInspector.Toolbar('', this.element);
this._createToolbarItems();
@@ -364,6 +366,12 @@ WebInspector.TimelinePanel = class extends WebInspector.Panel {
this._panelToolbar.appendToolbarItem(screenshotCheckbox);
}
+ if (Runtime.experiments.isEnabled('timelineRuleUsageRecording')) {
+ this._panelToolbar.appendToolbarItem(this._createSettingCheckbox(
+ WebInspector.UIString('CSS coverage'), this._markUnusedCSS,
+ WebInspector.UIString('Mark unused CSS in souces.')));
+ }
+
this._captureNetworkSetting.addChangeListener(this._onNetworkChanged, this);
this._captureMemorySetting.addChangeListener(this._onModeChanged, this);
this._captureFilmStripSetting.addChangeListener(this._onModeChanged, this);
@@ -574,6 +582,9 @@ WebInspector.TimelinePanel = class extends WebInspector.Panel {
this._setState(WebInspector.TimelinePanel.State.StartPending);
this._showRecordingStarted();
+ if (Runtime.experiments.isEnabled('timelineRuleUsageRecording') && this._markUnusedCSS.get())
+ WebInspector.CSSModel.fromTarget(mainTarget).startRuleUsageTracking();
+
this._autoRecordGeneration = userInitiated ? null : Symbol('Generation');
this._controller = new WebInspector.TimelineController(mainTarget, this, this._tracingModel);
this._controller.startRecording(
@@ -629,6 +640,9 @@ WebInspector.TimelinePanel = class extends WebInspector.Panel {
}
_clear() {
+ if (Runtime.experiments.isEnabled('timelineRuleUsageRecording') && this._markUnusedCSS.get())
+ WebInspector.CoverageProfile.instance().reset();
+
WebInspector.LineLevelProfile.instance().reset();
this._tracingModel.reset();
this._model.reset();

Powered by Google App Engine
This is Rietveld 408576698