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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/timeline/TimelineController.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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 /** 4 /**
5 * @implements {WebInspector.TargetManager.Observer} 5 * @implements {WebInspector.TargetManager.Observer}
6 * @implements {WebInspector.TracingManagerClient} 6 * @implements {WebInspector.TracingManagerClient}
7 * @unrestricted 7 * @unrestricted
8 */ 8 */
9 WebInspector.TimelineController = class { 9 WebInspector.TimelineController = class {
10 /** 10 /**
11 * @param {!WebInspector.Target} target 11 * @param {!WebInspector.Target} target
12 * @param {!WebInspector.TimelineLifecycleDelegate} delegate 12 * @param {!WebInspector.TimelineLifecycleDelegate} delegate
13 * @param {!WebInspector.TracingModel} tracingModel 13 * @param {!WebInspector.TracingModel} tracingModel
14 */ 14 */
15 constructor(target, delegate, tracingModel) { 15 constructor(target, delegate, tracingModel) {
16 this._delegate = delegate; 16 this._delegate = delegate;
17 this._target = target; 17 this._target = target;
18 this._tracingModel = tracingModel; 18 this._tracingModel = tracingModel;
19 this._targets = []; 19 this._targets = [];
20 WebInspector.targetManager.observeTargets(this); 20 WebInspector.targetManager.observeTargets(this);
21
22 if (Runtime.experiments.isEnabled('timelineRuleUsageRecording')) {
alph 2016/11/08 17:10:25 no need for {}
23 this._markUnusedCSS = WebInspector.settings.createSetting('timelineMarkUnu sedCSS', false);
24 }
21 } 25 }
22 26
23 /** 27 /**
24 * @param {boolean} captureCauses 28 * @param {boolean} captureCauses
25 * @param {boolean} enableJSSampling 29 * @param {boolean} enableJSSampling
26 * @param {boolean} captureMemory 30 * @param {boolean} captureMemory
27 * @param {boolean} capturePictures 31 * @param {boolean} capturePictures
28 * @param {boolean} captureFilmStrip 32 * @param {boolean} captureFilmStrip
29 */ 33 */
30 startRecording(captureCauses, enableJSSampling, captureMemory, capturePictures , captureFilmStrip) { 34 startRecording(captureCauses, enableJSSampling, captureMemory, capturePictures , captureFilmStrip) {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 71
68 var categories = categoriesArray.join(','); 72 var categories = categoriesArray.join(',');
69 this._startRecordingWithCategories(categories, enableJSSampling); 73 this._startRecordingWithCategories(categories, enableJSSampling);
70 } 74 }
71 75
72 stopRecording() { 76 stopRecording() {
73 var tracingStoppedPromises = []; 77 var tracingStoppedPromises = [];
74 tracingStoppedPromises.push(new Promise(resolve => this._tracingCompleteCall back = resolve)); 78 tracingStoppedPromises.push(new Promise(resolve => this._tracingCompleteCall back = resolve));
75 tracingStoppedPromises.push(this._stopProfilingOnAllTargets()); 79 tracingStoppedPromises.push(this._stopProfilingOnAllTargets());
76 this._target.tracingManager.stop(); 80 this._target.tracingManager.stop();
77 tracingStoppedPromises.push(WebInspector.targetManager.resumeAllTargets()); 81
82 if (!Runtime.experiments.isEnabled('timelineRuleUsageRecording') || !this._m arkUnusedCSS.get())
alph 2016/11/08 17:10:25 if an experiment is enabled after opening timeline
83 tracingStoppedPromises.push(WebInspector.targetManager.resumeAllTargets()) ;
84
78 Promise.all(tracingStoppedPromises).then(() => this._allSourcesFinished()); 85 Promise.all(tracingStoppedPromises).then(() => this._allSourcesFinished());
79 86
80 this._delegate.loadingStarted(); 87 this._delegate.loadingStarted();
81 88
82 for (var traceProvider of this._extensionTraceProviders) 89 for (var traceProvider of this._extensionTraceProviders)
83 traceProvider.stop(); 90 traceProvider.stop();
84 } 91 }
85 92
86 /** 93 /**
87 * @override 94 * @override
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 this._profiling = false; 160 this._profiling = false;
154 return Promise.all(targets.map(this._stopProfilingOnTarget, this)); 161 return Promise.all(targets.map(this._stopProfilingOnTarget, this));
155 } 162 }
156 163
157 /** 164 /**
158 * @param {string} categories 165 * @param {string} categories
159 * @param {boolean=} enableJSSampling 166 * @param {boolean=} enableJSSampling
160 * @param {function(?string)=} callback 167 * @param {function(?string)=} callback
161 */ 168 */
162 _startRecordingWithCategories(categories, enableJSSampling, callback) { 169 _startRecordingWithCategories(categories, enableJSSampling, callback) {
163 WebInspector.targetManager.suspendAllTargets(); 170
171 if (!Runtime.experiments.isEnabled('timelineRuleUsageRecording') || !this._m arkUnusedCSS.get())
alph 2016/11/08 17:10:25 This looks bad. We want to suspend targets not inv
172 WebInspector.targetManager.suspendAllTargets();
173
164 var profilingStartedPromise = enableJSSampling && !Runtime.experiments.isEna bled('timelineTracingJSProfile') ? 174 var profilingStartedPromise = enableJSSampling && !Runtime.experiments.isEna bled('timelineTracingJSProfile') ?
165 this._startProfilingOnAllTargets() : 175 this._startProfilingOnAllTargets() :
166 Promise.resolve(); 176 Promise.resolve();
167 var samplingFrequencyHz = WebInspector.moduleSetting('highResolutionCpuProfi ling').get() ? 10000 : 1000; 177 var samplingFrequencyHz = WebInspector.moduleSetting('highResolutionCpuProfi ling').get() ? 10000 : 1000;
168 var options = 'sampling-frequency=' + samplingFrequencyHz; 178 var options = 'sampling-frequency=' + samplingFrequencyHz;
169 var target = this._target; 179 var target = this._target;
170 var tracingManager = target.tracingManager; 180 var tracingManager = target.tracingManager;
171 WebInspector.targetManager.suspendReload(target); 181 WebInspector.targetManager.suspendReload(target);
172 profilingStartedPromise.then(tracingManager.start.bind(tracingManager, this, categories, options, onTraceStarted)); 182 profilingStartedPromise.then(tracingManager.start.bind(tracingManager, this, categories, options, onTraceStarted));
173 /** 183 /**
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 } 276 }
267 277
268 /** 278 /**
269 * @param {number} progress 279 * @param {number} progress
270 * @override 280 * @override
271 */ 281 */
272 eventsRetrievalProgress(progress) { 282 eventsRetrievalProgress(progress) {
273 this._delegate.loadingProgress(progress); 283 this._delegate.loadingProgress(progress);
274 } 284 }
275 }; 285 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698