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

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: a 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 /** @type {!Array<!{title: string, model: !SDK.TracingModel}>} */ 71 /** @type {!Array<!{title: string, model: !SDK.TracingModel}>} */
72 this._extensionTracingModels = []; 72 this._extensionTracingModels = [];
73 this._cpuThrottlingManager = new Components.CPUThrottlingManager(); 73 this._cpuThrottlingManager = new Components.CPUThrottlingManager();
74 74
75 /** @type {!Array<!Timeline.TimelineModeView>} */ 75 /** @type {!Array<!Timeline.TimelineModeView>} */
76 this._currentViews = []; 76 this._currentViews = [];
77 77
78 this._viewModeSetting = 78 this._viewModeSetting =
79 Common.settings.createSetting('timelineViewMode', Timeline.TimelinePanel .ViewMode.FlameChart); 79 Common.settings.createSetting('timelineViewMode', Timeline.TimelinePanel .ViewMode.FlameChart);
80 80
81 this._disableCaptureJSProfileSetting = Common.settings.createSetting('timeli neDisableJSSampling', false); 81 this._disableCaptureJSProfileSetting = Common.settings.createSetting(
82 this._captureLayersAndPicturesSetting = Common.settings.createSetting('timel ineCaptureLayersAndPictures', false); 82 'timelineDisableJSSampling', false, false, Common.UIString('Disable Java Script Samples'));
83 this._captureLayersAndPicturesSetting = Common.settings.createSetting(
84 'timelineCaptureLayersAndPictures', false, false,
85 Common.UIString('Enable advanced paint instrumentation (slow)'));
83 86
84 this._showScreenshotsSetting = Common.settings.createLocalSetting('timelineS howScreenshots', true); 87 this._showScreenshotsSetting =
88 Common.settings.createLocalSetting('timelineShowScreenshots', true, Comm on.UIString('Screenshots'));
85 this._showScreenshotsSetting.addChangeListener(this._onModeChanged, this); 89 this._showScreenshotsSetting.addChangeListener(this._onModeChanged, this);
86 this._showMemorySetting = Common.settings.createLocalSetting('timelineShowMe mory', false); 90 this._showMemorySetting =
91 Common.settings.createLocalSetting('timelineShowMemory', false, Common.U IString('Memory'));
87 this._showMemorySetting.addChangeListener(this._onModeChanged, this); 92 this._showMemorySetting.addChangeListener(this._onModeChanged, this);
88 93
89 this._panelToolbar = new UI.Toolbar('', this.element); 94 this._panelToolbar = new UI.Toolbar('', this.element);
90 this._createSettingsPane(); 95 this._createSettingsPane();
91 this._updateShowSettingsToolbarButton(); 96 this._updateShowSettingsToolbarButton();
92 97
93 this._timelinePane = new UI.VBox(); 98 this._timelinePane = new UI.VBox();
94 this._timelinePane.show(this.element); 99 this._timelinePane.show(this.element);
95 var topPaneElement = this._timelinePane.element.createChild('div', 'hbox'); 100 var topPaneElement = this._timelinePane.element.createChild('div', 'hbox');
96 topPaneElement.id = 'timeline-overview-panel'; 101 topPaneElement.id = 'timeline-overview-panel';
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 269
265 /** 270 /**
266 * @param {!Timeline.TimelinePanel.State} state 271 * @param {!Timeline.TimelinePanel.State} state
267 */ 272 */
268 _setState(state) { 273 _setState(state) {
269 this._state = state; 274 this._state = state;
270 this._updateTimelineControls(); 275 this._updateTimelineControls();
271 } 276 }
272 277
273 /** 278 /**
274 * @param {string} name
275 * @param {!Common.Setting} setting 279 * @param {!Common.Setting} setting
276 * @param {string} tooltip 280 * @param {string} tooltip
277 * @return {!UI.ToolbarItem} 281 * @return {!UI.ToolbarItem}
278 */ 282 */
279 _createSettingCheckbox(name, setting, tooltip) { 283 _createSettingCheckbox(setting, tooltip) {
280 const checkboxItem = new UI.ToolbarCheckbox(name, tooltip, setting); 284 const checkboxItem = new UI.ToolbarSettingCheckbox(setting, tooltip);
281 this._recordingOptionUIControls.push(checkboxItem); 285 this._recordingOptionUIControls.push(checkboxItem);
282 return checkboxItem; 286 return checkboxItem;
283 } 287 }
284 288
285 _populateToolbar() { 289 _populateToolbar() {
286 // Record 290 // Record
287 this._panelToolbar.appendToolbarItem(UI.Toolbar.createActionButton(this._tog gleRecordAction)); 291 this._panelToolbar.appendToolbarItem(UI.Toolbar.createActionButton(this._tog gleRecordAction));
288 this._panelToolbar.appendToolbarItem(UI.Toolbar.createActionButtonForId('mai n.reload')); 292 this._panelToolbar.appendToolbarItem(UI.Toolbar.createActionButtonForId('mai n.reload'));
289 var clearButton = new UI.ToolbarButton(Common.UIString('Clear'), 'largeicon- clear'); 293 var clearButton = new UI.ToolbarButton(Common.UIString('Clear'), 'largeicon- clear');
290 clearButton.addEventListener(UI.ToolbarButton.Events.Click, () => this._clea r()); 294 clearButton.addEventListener(UI.ToolbarButton.Events.Click, () => this._clea r());
291 this._panelToolbar.appendToolbarItem(clearButton); 295 this._panelToolbar.appendToolbarItem(clearButton);
292 this._panelToolbar.appendSeparator(); 296 this._panelToolbar.appendSeparator();
293 297
294 // View 298 // View
295 this._panelToolbar.appendSeparator(); 299 this._panelToolbar.appendSeparator();
296 this._showScreenshotsToolbarCheckbox = this._createSettingCheckbox( 300 this._showScreenshotsToolbarCheckbox =
297 Common.UIString('Screenshots'), this._showScreenshotsSetting, Common.UIS tring('Capture screenshots')); 301 this._createSettingCheckbox(this._showScreenshotsSetting, Common.UIStrin g('Capture screenshots'));
298 this._panelToolbar.appendToolbarItem(this._showScreenshotsToolbarCheckbox); 302 this._panelToolbar.appendToolbarItem(this._showScreenshotsToolbarCheckbox);
299 303
300 this._showMemoryToolbarCheckbox = this._createSettingCheckbox( 304 this._showMemoryToolbarCheckbox =
301 Common.UIString('Memory'), this._showMemorySetting, Common.UIString('Sho w memory timeline.')); 305 this._createSettingCheckbox(this._showMemorySetting, Common.UIString('Sh ow memory timeline.'));
302 this._panelToolbar.appendToolbarItem(this._showMemoryToolbarCheckbox); 306 this._panelToolbar.appendToolbarItem(this._showMemoryToolbarCheckbox);
303 307
304 // GC 308 // GC
305 this._panelToolbar.appendToolbarItem(UI.Toolbar.createActionButtonForId('com ponents.collect-garbage')); 309 this._panelToolbar.appendToolbarItem(UI.Toolbar.createActionButtonForId('com ponents.collect-garbage'));
306 310
307 // Settings 311 // Settings
308 this._panelToolbar.appendSpacer(); 312 this._panelToolbar.appendSpacer();
309 this._panelToolbar.appendText(''); 313 this._panelToolbar.appendText('');
310 this._panelToolbar.appendSeparator(); 314 this._panelToolbar.appendSeparator();
311 this._panelToolbar.appendToolbarItem(this._showSettingsPaneButton); 315 this._panelToolbar.appendToolbarItem(this._showSettingsPaneButton);
(...skipping 11 matching lines...) Expand all
323 this._captureLayersAndPicturesSetting.addChangeListener(this._updateShowSett ingsToolbarButton, this); 327 this._captureLayersAndPicturesSetting.addChangeListener(this._updateShowSett ingsToolbarButton, this);
324 328
325 this._settingsPane = new UI.HBox(); 329 this._settingsPane = new UI.HBox();
326 this._settingsPane.element.classList.add('timeline-settings-pane'); 330 this._settingsPane.element.classList.add('timeline-settings-pane');
327 this._settingsPane.show(this.element); 331 this._settingsPane.show(this.element);
328 332
329 var captureToolbar = new UI.Toolbar('', this._settingsPane.element); 333 var captureToolbar = new UI.Toolbar('', this._settingsPane.element);
330 captureToolbar.element.classList.add('flex-auto'); 334 captureToolbar.element.classList.add('flex-auto');
331 captureToolbar.makeVertical(); 335 captureToolbar.makeVertical();
332 captureToolbar.appendToolbarItem(this._createSettingCheckbox( 336 captureToolbar.appendToolbarItem(this._createSettingCheckbox(
333 Common.UIString('Disable JavaScript Samples'), this._disableCaptureJSPro fileSetting, 337 this._disableCaptureJSProfileSetting,
334 Common.UIString('Disables JavaScript sampling, reduces overhead when run ning against mobile devices'))); 338 Common.UIString('Disables JavaScript sampling, reduces overhead when run ning against mobile devices')));
335 captureToolbar.appendToolbarItem(this._createSettingCheckbox( 339 captureToolbar.appendToolbarItem(this._createSettingCheckbox(
336 Common.UIString('Enable advanced paint instrumentation (slow)'), this._c aptureLayersAndPicturesSetting, 340 this._captureLayersAndPicturesSetting,
337 Common.UIString('Captures advanced paint instrumentation, introduces sig nificant performance overhead'))); 341 Common.UIString('Captures advanced paint instrumentation, introduces sig nificant performance overhead')));
338 342
339 var throttlingPane = new UI.VBox(); 343 var throttlingPane = new UI.VBox();
340 throttlingPane.element.classList.add('flex-auto'); 344 throttlingPane.element.classList.add('flex-auto');
341 throttlingPane.show(this._settingsPane.element); 345 throttlingPane.show(this._settingsPane.element);
342 346
343 var throttlingToolbar1 = new UI.Toolbar('', throttlingPane.element); 347 var throttlingToolbar1 = new UI.Toolbar('', throttlingPane.element);
344 throttlingToolbar1.appendText(Common.UIString('Network:')); 348 throttlingToolbar1.appendText(Common.UIString('Network:'));
345 throttlingToolbar1.appendToolbarItem(this._createNetworkConditionsSelect()); 349 throttlingToolbar1.appendToolbarItem(this._createNetworkConditionsSelect());
346 var throttlingToolbar2 = new UI.Toolbar('', throttlingPane.element); 350 var throttlingToolbar2 = new UI.Toolbar('', throttlingPane.element);
347 throttlingToolbar2.appendText(Common.UIString('CPU:')); 351 throttlingToolbar2.appendText(Common.UIString('CPU:'));
348 throttlingToolbar2.appendToolbarItem(this._cpuThrottlingManager.createContro l()); 352 throttlingToolbar2.appendToolbarItem(this._cpuThrottlingManager.createContro l());
349 353
350 this._showSettingsPaneSetting.addChangeListener(this._updateSettingsPaneVisi bility.bind(this)); 354 this._showSettingsPaneSetting.addChangeListener(this._updateSettingsPaneVisi bility.bind(this));
351 this._updateSettingsPaneVisibility(); 355 this._updateSettingsPaneVisibility();
352 } 356 }
353 357
354 /** 358 /**
355 * @param {!Common.Event} event 359 * @param {!Common.Event} event
356 */ 360 */
357 _appendExtensionsToToolbar(event) { 361 _appendExtensionsToToolbar(event) {
358 var provider = /** @type {!Extensions.ExtensionTraceProvider} */ (event.data ); 362 var provider = /** @type {!Extensions.ExtensionTraceProvider} */ (event.data );
359 const setting = Timeline.TimelinePanel._settingForTraceProvider(provider); 363 const setting = Timeline.TimelinePanel._settingForTraceProvider(provider);
360 const checkbox = this._createSettingCheckbox(provider.shortDisplayName(), se tting, provider.longDisplayName()); 364 const checkbox = this._createSettingCheckbox(setting, provider.longDisplayNa me());
361 this._panelToolbar.appendToolbarItem(checkbox); 365 this._panelToolbar.appendToolbarItem(checkbox);
362 } 366 }
363 367
364 /** 368 /**
365 * @param {!Extensions.ExtensionTraceProvider} traceProvider 369 * @param {!Extensions.ExtensionTraceProvider} traceProvider
366 * @return {!Common.Setting<boolean>} 370 * @return {!Common.Setting<boolean>}
367 */ 371 */
368 static _settingForTraceProvider(traceProvider) { 372 static _settingForTraceProvider(traceProvider) {
369 var setting = traceProvider[Timeline.TimelinePanel._traceProviderSettingSymb ol]; 373 var setting = traceProvider[Timeline.TimelinePanel._traceProviderSettingSymb ol];
370 if (!setting) { 374 if (!setting) {
371 var providerId = traceProvider.persistentIdentifier(); 375 var providerId = traceProvider.persistentIdentifier();
372 setting = Common.settings.createSetting(providerId, false); 376 setting = Common.settings.createSetting(providerId, false, false, tracePro vider.shortDisplayName());
373 traceProvider[Timeline.TimelinePanel._traceProviderSettingSymbol] = settin g; 377 traceProvider[Timeline.TimelinePanel._traceProviderSettingSymbol] = settin g;
374 } 378 }
375 return setting; 379 return setting;
376 } 380 }
377 381
378 /** 382 /**
379 * @return {!UI.ToolbarComboBox} 383 * @return {!UI.ToolbarComboBox}
380 */ 384 */
381 _createNetworkConditionsSelect() { 385 _createNetworkConditionsSelect() {
382 var toolbarItem = new UI.ToolbarComboBox(null); 386 var toolbarItem = new UI.ToolbarComboBox(null);
(...skipping 1166 matching lines...) Expand 10 before | Expand all | Expand 10 after
1549 return true; 1553 return true;
1550 case 'timeline.jump-to-next-frame': 1554 case 'timeline.jump-to-next-frame':
1551 panel._jumpToFrame(1); 1555 panel._jumpToFrame(1);
1552 return true; 1556 return true;
1553 } 1557 }
1554 return false; 1558 return false;
1555 } 1559 }
1556 }; 1560 };
1557 1561
1558 Timeline.TimelinePanel._traceProviderSettingSymbol = Symbol('traceProviderSettin g'); 1562 Timeline.TimelinePanel._traceProviderSettingSymbol = Symbol('traceProviderSettin g');
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698