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

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

Issue 2678623002: DevTools: pass title when creating settings (Closed)
Patch Set: ac Created 3 years, 10 months 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 /* 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 67
68 this._cpuThrottlingManager = new Components.CPUThrottlingManager(); 68 this._cpuThrottlingManager = new Components.CPUThrottlingManager();
69 69
70 /** @type {!Array<!Timeline.TimelineModeView>} */ 70 /** @type {!Array<!Timeline.TimelineModeView>} */
71 this._currentViews = []; 71 this._currentViews = [];
72 72
73 this._viewModeSetting = 73 this._viewModeSetting =
74 Common.settings.createSetting('timelineViewMode', Timeline.TimelinePanel .ViewMode.FlameChart); 74 Common.settings.createSetting('timelineViewMode', Timeline.TimelinePanel .ViewMode.FlameChart);
75 75
76 this._disableCaptureJSProfileSetting = Common.settings.createSetting('timeli neDisableJSSampling', false); 76 this._disableCaptureJSProfileSetting = Common.settings.createSetting('timeli neDisableJSSampling', false);
77 this._disableCaptureJSProfileSetting.setTitle(Common.UIString('Disable JavaS cript Samples'));
77 this._captureLayersAndPicturesSetting = Common.settings.createSetting('timel ineCaptureLayersAndPictures', false); 78 this._captureLayersAndPicturesSetting = Common.settings.createSetting('timel ineCaptureLayersAndPictures', false);
79 this._captureLayersAndPicturesSetting.setTitle(Common.UIString('Enable advan ced paint instrumentation (slow)'));
78 80
79 this._showScreenshotsSetting = Common.settings.createLocalSetting('timelineS howScreenshots', true); 81 this._showScreenshotsSetting = Common.settings.createLocalSetting('timelineS howScreenshots', true);
82 this._showScreenshotsSetting.setTitle(Common.UIString('Screenshots'));
80 this._showScreenshotsSetting.addChangeListener(this._onModeChanged, this); 83 this._showScreenshotsSetting.addChangeListener(this._onModeChanged, this);
81 this._showMemorySetting = Common.settings.createLocalSetting('timelineShowMe mory', false); 84 this._showMemorySetting = Common.settings.createLocalSetting('timelineShowMe mory', false);
85 this._showMemorySetting.setTitle(Common.UIString('Memory'));
82 this._showMemorySetting.addChangeListener(this._onModeChanged, this); 86 this._showMemorySetting.addChangeListener(this._onModeChanged, this);
83 87
84 this._panelToolbar = new UI.Toolbar('', this.element); 88 this._panelToolbar = new UI.Toolbar('', this.element);
85 this._createSettingsPane(); 89 this._createSettingsPane();
86 this._updateShowSettingsToolbarButton(); 90 this._updateShowSettingsToolbarButton();
87 91
88 this._timelinePane = new UI.VBox(); 92 this._timelinePane = new UI.VBox();
89 this._timelinePane.show(this.element); 93 this._timelinePane.show(this.element);
90 var topPaneElement = this._timelinePane.element.createChild('div', 'hbox'); 94 var topPaneElement = this._timelinePane.element.createChild('div', 'hbox');
91 topPaneElement.id = 'timeline-overview-panel'; 95 topPaneElement.id = 'timeline-overview-panel';
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 242
239 /** 243 /**
240 * @param {!Timeline.TimelinePanel.State} state 244 * @param {!Timeline.TimelinePanel.State} state
241 */ 245 */
242 _setState(state) { 246 _setState(state) {
243 this._state = state; 247 this._state = state;
244 this._updateTimelineControls(); 248 this._updateTimelineControls();
245 } 249 }
246 250
247 /** 251 /**
248 * @param {string} name
249 * @param {!Common.Setting} setting 252 * @param {!Common.Setting} setting
250 * @param {string} tooltip 253 * @param {string} tooltip
251 * @return {!UI.ToolbarItem} 254 * @return {!UI.ToolbarItem}
252 */ 255 */
253 _createSettingCheckbox(name, setting, tooltip) { 256 _createSettingCheckbox(setting, tooltip) {
254 const checkboxItem = new UI.ToolbarCheckbox(name, tooltip, setting); 257 const checkboxItem = new UI.ToolbarSettingCheckbox(setting, tooltip);
255 this._recordingOptionUIControls.push(checkboxItem); 258 this._recordingOptionUIControls.push(checkboxItem);
256 return checkboxItem; 259 return checkboxItem;
257 } 260 }
258 261
259 _populateToolbar() { 262 _populateToolbar() {
260 // Record 263 // Record
261 this._panelToolbar.appendToolbarItem(UI.Toolbar.createActionButton(this._tog gleRecordAction)); 264 this._panelToolbar.appendToolbarItem(UI.Toolbar.createActionButton(this._tog gleRecordAction));
262 this._panelToolbar.appendToolbarItem(UI.Toolbar.createActionButtonForId('mai n.reload')); 265 this._panelToolbar.appendToolbarItem(UI.Toolbar.createActionButtonForId('mai n.reload'));
263 var clearButton = new UI.ToolbarButton(Common.UIString('Clear'), 'largeicon- clear'); 266 var clearButton = new UI.ToolbarButton(Common.UIString('Clear'), 'largeicon- clear');
264 clearButton.addEventListener(UI.ToolbarButton.Events.Click, () => this._clea r()); 267 clearButton.addEventListener(UI.ToolbarButton.Events.Click, () => this._clea r());
265 this._panelToolbar.appendToolbarItem(clearButton); 268 this._panelToolbar.appendToolbarItem(clearButton);
266 this._panelToolbar.appendSeparator(); 269 this._panelToolbar.appendSeparator();
267 270
268 // View 271 // View
269 this._panelToolbar.appendSeparator(); 272 this._panelToolbar.appendSeparator();
270 this._showScreenshotsToolbarCheckbox = this._createSettingCheckbox( 273 this._showScreenshotsToolbarCheckbox =
271 Common.UIString('Screenshots'), this._showScreenshotsSetting, Common.UIS tring('Capture screenshots')); 274 this._createSettingCheckbox(this._showScreenshotsSetting, Common.UIStrin g('Capture screenshots'));
272 this._panelToolbar.appendToolbarItem(this._showScreenshotsToolbarCheckbox); 275 this._panelToolbar.appendToolbarItem(this._showScreenshotsToolbarCheckbox);
273 276
274 this._showMemoryToolbarCheckbox = this._createSettingCheckbox( 277 this._showMemoryToolbarCheckbox =
275 Common.UIString('Memory'), this._showMemorySetting, Common.UIString('Sho w memory timeline.')); 278 this._createSettingCheckbox(this._showMemorySetting, Common.UIString('Sh ow memory timeline'));
276 this._panelToolbar.appendToolbarItem(this._showMemoryToolbarCheckbox); 279 this._panelToolbar.appendToolbarItem(this._showMemoryToolbarCheckbox);
277 280
278 // GC 281 // GC
279 this._panelToolbar.appendToolbarItem(UI.Toolbar.createActionButtonForId('com ponents.collect-garbage')); 282 this._panelToolbar.appendToolbarItem(UI.Toolbar.createActionButtonForId('com ponents.collect-garbage'));
280 283
281 // Settings 284 // Settings
282 this._panelToolbar.appendSpacer(); 285 this._panelToolbar.appendSpacer();
283 this._panelToolbar.appendText(''); 286 this._panelToolbar.appendText('');
284 this._panelToolbar.appendSeparator(); 287 this._panelToolbar.appendSeparator();
285 this._panelToolbar.appendToolbarItem(this._showSettingsPaneButton); 288 this._panelToolbar.appendToolbarItem(this._showSettingsPaneButton);
(...skipping 11 matching lines...) Expand all
297 this._captureLayersAndPicturesSetting.addChangeListener(this._updateShowSett ingsToolbarButton, this); 300 this._captureLayersAndPicturesSetting.addChangeListener(this._updateShowSett ingsToolbarButton, this);
298 301
299 this._settingsPane = new UI.HBox(); 302 this._settingsPane = new UI.HBox();
300 this._settingsPane.element.classList.add('timeline-settings-pane'); 303 this._settingsPane.element.classList.add('timeline-settings-pane');
301 this._settingsPane.show(this.element); 304 this._settingsPane.show(this.element);
302 305
303 var captureToolbar = new UI.Toolbar('', this._settingsPane.element); 306 var captureToolbar = new UI.Toolbar('', this._settingsPane.element);
304 captureToolbar.element.classList.add('flex-auto'); 307 captureToolbar.element.classList.add('flex-auto');
305 captureToolbar.makeVertical(); 308 captureToolbar.makeVertical();
306 captureToolbar.appendToolbarItem(this._createSettingCheckbox( 309 captureToolbar.appendToolbarItem(this._createSettingCheckbox(
307 Common.UIString('Disable JavaScript Samples'), this._disableCaptureJSPro fileSetting, 310 this._disableCaptureJSProfileSetting,
308 Common.UIString('Disables JavaScript sampling, reduces overhead when run ning against mobile devices'))); 311 Common.UIString('Disables JavaScript sampling, reduces overhead when run ning against mobile devices')));
309 captureToolbar.appendToolbarItem(this._createSettingCheckbox( 312 captureToolbar.appendToolbarItem(this._createSettingCheckbox(
310 Common.UIString('Enable advanced paint instrumentation (slow)'), this._c aptureLayersAndPicturesSetting, 313 this._captureLayersAndPicturesSetting,
311 Common.UIString('Captures advanced paint instrumentation, introduces sig nificant performance overhead'))); 314 Common.UIString('Captures advanced paint instrumentation, introduces sig nificant performance overhead')));
312 315
313 var throttlingPane = new UI.VBox(); 316 var throttlingPane = new UI.VBox();
314 throttlingPane.element.classList.add('flex-auto'); 317 throttlingPane.element.classList.add('flex-auto');
315 throttlingPane.show(this._settingsPane.element); 318 throttlingPane.show(this._settingsPane.element);
316 319
317 var throttlingToolbar1 = new UI.Toolbar('', throttlingPane.element); 320 var throttlingToolbar1 = new UI.Toolbar('', throttlingPane.element);
318 throttlingToolbar1.appendText(Common.UIString('Network:')); 321 throttlingToolbar1.appendText(Common.UIString('Network:'));
319 throttlingToolbar1.appendToolbarItem(this._createNetworkConditionsSelect()); 322 throttlingToolbar1.appendToolbarItem(this._createNetworkConditionsSelect());
320 var throttlingToolbar2 = new UI.Toolbar('', throttlingPane.element); 323 var throttlingToolbar2 = new UI.Toolbar('', throttlingPane.element);
321 throttlingToolbar2.appendText(Common.UIString('CPU:')); 324 throttlingToolbar2.appendText(Common.UIString('CPU:'));
322 throttlingToolbar2.appendToolbarItem(this._cpuThrottlingManager.createContro l()); 325 throttlingToolbar2.appendToolbarItem(this._cpuThrottlingManager.createContro l());
323 326
324 this._showSettingsPaneSetting.addChangeListener(this._updateSettingsPaneVisi bility.bind(this)); 327 this._showSettingsPaneSetting.addChangeListener(this._updateSettingsPaneVisi bility.bind(this));
325 this._updateSettingsPaneVisibility(); 328 this._updateSettingsPaneVisibility();
326 } 329 }
327 330
328 /** 331 /**
329 * @param {!Common.Event} event 332 * @param {!Common.Event} event
330 */ 333 */
331 _appendExtensionsToToolbar(event) { 334 _appendExtensionsToToolbar(event) {
332 var provider = /** @type {!Extensions.ExtensionTraceProvider} */ (event.data ); 335 var provider = /** @type {!Extensions.ExtensionTraceProvider} */ (event.data );
333 const setting = Timeline.TimelinePanel._settingForTraceProvider(provider); 336 const setting = Timeline.TimelinePanel._settingForTraceProvider(provider);
334 const checkbox = this._createSettingCheckbox(provider.shortDisplayName(), se tting, provider.longDisplayName()); 337 const checkbox = this._createSettingCheckbox(setting, provider.longDisplayNa me());
335 this._panelToolbar.appendToolbarItem(checkbox); 338 this._panelToolbar.appendToolbarItem(checkbox);
336 } 339 }
337 340
338 /** 341 /**
339 * @param {!Extensions.ExtensionTraceProvider} traceProvider 342 * @param {!Extensions.ExtensionTraceProvider} traceProvider
340 * @return {!Common.Setting<boolean>} 343 * @return {!Common.Setting<boolean>}
341 */ 344 */
342 static _settingForTraceProvider(traceProvider) { 345 static _settingForTraceProvider(traceProvider) {
343 var setting = traceProvider[Timeline.TimelinePanel._traceProviderSettingSymb ol]; 346 var setting = traceProvider[Timeline.TimelinePanel._traceProviderSettingSymb ol];
344 if (!setting) { 347 if (!setting) {
345 var providerId = traceProvider.persistentIdentifier(); 348 var providerId = traceProvider.persistentIdentifier();
346 setting = Common.settings.createSetting(providerId, false); 349 setting = Common.settings.createSetting(providerId, false);
350 setting.setTitle(traceProvider.shortDisplayName());
347 traceProvider[Timeline.TimelinePanel._traceProviderSettingSymbol] = settin g; 351 traceProvider[Timeline.TimelinePanel._traceProviderSettingSymbol] = settin g;
348 } 352 }
349 return setting; 353 return setting;
350 } 354 }
351 355
352 /** 356 /**
353 * @return {!UI.ToolbarComboBox} 357 * @return {!UI.ToolbarComboBox}
354 */ 358 */
355 _createNetworkConditionsSelect() { 359 _createNetworkConditionsSelect() {
356 var toolbarItem = new UI.ToolbarComboBox(null); 360 var toolbarItem = new UI.ToolbarComboBox(null);
(...skipping 1105 matching lines...) Expand 10 before | Expand all | Expand 10 after
1462 return true; 1466 return true;
1463 case 'timeline.jump-to-next-frame': 1467 case 'timeline.jump-to-next-frame':
1464 panel._jumpToFrame(1); 1468 panel._jumpToFrame(1);
1465 return true; 1469 return true;
1466 } 1470 }
1467 return false; 1471 return false;
1468 } 1472 }
1469 }; 1473 };
1470 1474
1471 Timeline.TimelinePanel._traceProviderSettingSymbol = Symbol('traceProviderSettin g'); 1475 Timeline.TimelinePanel._traceProviderSettingSymbol = Symbol('traceProviderSettin g');
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698