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

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

Issue 2938503002: DevTools: unify Network & CPU throttling (Closed)
Patch Set: n it Created 3 years, 5 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 this._filters.push(new TimelineModel.ExcludeTopLevelFilter()); 70 this._filters.push(new TimelineModel.ExcludeTopLevelFilter());
71 } 71 }
72 if (!Runtime.experiments.isEnabled('timelinePaintTimingMarkers')) 72 if (!Runtime.experiments.isEnabled('timelinePaintTimingMarkers'))
73 this._filters.push(Timeline.TimelineUIUtils.paintEventsFilter()); 73 this._filters.push(Timeline.TimelineUIUtils.paintEventsFilter());
74 74
75 /** @type {?Timeline.PerformanceModel} */ 75 /** @type {?Timeline.PerformanceModel} */
76 this._performanceModel = null; 76 this._performanceModel = null;
77 /** @type {?Timeline.PerformanceModel} */ 77 /** @type {?Timeline.PerformanceModel} */
78 this._pendingPerformanceModel = null; 78 this._pendingPerformanceModel = null;
79 79
80 this._cpuThrottlingManager = new MobileThrottling.CPUThrottlingManager();
81
82 this._viewModeSetting = 80 this._viewModeSetting =
83 Common.settings.createSetting('timelineViewMode', Timeline.TimelinePanel .ViewMode.FlameChart); 81 Common.settings.createSetting('timelineViewMode', Timeline.TimelinePanel .ViewMode.FlameChart);
84 82
85 this._disableCaptureJSProfileSetting = Common.settings.createSetting('timeli neDisableJSSampling', false); 83 this._disableCaptureJSProfileSetting = Common.settings.createSetting('timeli neDisableJSSampling', false);
86 this._disableCaptureJSProfileSetting.setTitle(Common.UIString('Disable JavaS cript samples')); 84 this._disableCaptureJSProfileSetting.setTitle(Common.UIString('Disable JavaS cript samples'));
87 this._captureLayersAndPicturesSetting = Common.settings.createSetting('timel ineCaptureLayersAndPictures', false); 85 this._captureLayersAndPicturesSetting = Common.settings.createSetting('timel ineCaptureLayersAndPictures', false);
88 this._captureLayersAndPicturesSetting.setTitle(Common.UIString('Enable advan ced paint instrumentation (slow)')); 86 this._captureLayersAndPicturesSetting.setTitle(Common.UIString('Enable advan ced paint instrumentation (slow)'));
89 87
90 this._showScreenshotsSetting = Common.settings.createSetting('timelineShowSc reenshots', true); 88 this._showScreenshotsSetting = Common.settings.createSetting('timelineShowSc reenshots', true);
91 this._showScreenshotsSetting.setTitle(Common.UIString('Screenshots')); 89 this._showScreenshotsSetting.setTitle(Common.UIString('Screenshots'));
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 this._panelToolbar.appendSeparator(); 249 this._panelToolbar.appendSeparator();
252 this._panelToolbar.appendToolbarItem(this._showSettingsPaneButton); 250 this._panelToolbar.appendToolbarItem(this._showSettingsPaneButton);
253 } 251 }
254 252
255 _createSettingsPane() { 253 _createSettingsPane() {
256 this._showSettingsPaneSetting = Common.settings.createSetting('timelineShowS ettingsToolbar', false); 254 this._showSettingsPaneSetting = Common.settings.createSetting('timelineShowS ettingsToolbar', false);
257 this._showSettingsPaneButton = new UI.ToolbarSettingToggle( 255 this._showSettingsPaneButton = new UI.ToolbarSettingToggle(
258 this._showSettingsPaneSetting, 'largeicon-settings-gear', Common.UIStrin g('Capture settings')); 256 this._showSettingsPaneSetting, 'largeicon-settings-gear', Common.UIStrin g('Capture settings'));
259 SDK.multitargetNetworkManager.addEventListener( 257 SDK.multitargetNetworkManager.addEventListener(
260 SDK.MultitargetNetworkManager.Events.ConditionsChanged, this._updateShow SettingsToolbarButton, this); 258 SDK.MultitargetNetworkManager.Events.ConditionsChanged, this._updateShow SettingsToolbarButton, this);
261 this._cpuThrottlingManager.addEventListener( 259 MobileThrottling.throttlingManager().addEventListener(
262 MobileThrottling.CPUThrottlingManager.Events.RateChanged, this._updateSh owSettingsToolbarButton, this); 260 MobileThrottling.ThrottlingManager.Events.RateChanged, this._updateShowS ettingsToolbarButton, this);
263 this._disableCaptureJSProfileSetting.addChangeListener(this._updateShowSetti ngsToolbarButton, this); 261 this._disableCaptureJSProfileSetting.addChangeListener(this._updateShowSetti ngsToolbarButton, this);
264 this._captureLayersAndPicturesSetting.addChangeListener(this._updateShowSett ingsToolbarButton, this); 262 this._captureLayersAndPicturesSetting.addChangeListener(this._updateShowSett ingsToolbarButton, this);
265 263
266 this._settingsPane = new UI.HBox(); 264 this._settingsPane = new UI.HBox();
267 this._settingsPane.element.classList.add('timeline-settings-pane'); 265 this._settingsPane.element.classList.add('timeline-settings-pane');
268 this._settingsPane.show(this.element); 266 this._settingsPane.show(this.element);
269 267
270 var captureToolbar = new UI.Toolbar('', this._settingsPane.element); 268 var captureToolbar = new UI.Toolbar('', this._settingsPane.element);
271 captureToolbar.element.classList.add('flex-auto'); 269 captureToolbar.element.classList.add('flex-auto');
272 captureToolbar.makeVertical(); 270 captureToolbar.makeVertical();
273 captureToolbar.appendToolbarItem(this._createSettingCheckbox( 271 captureToolbar.appendToolbarItem(this._createSettingCheckbox(
274 this._disableCaptureJSProfileSetting, 272 this._disableCaptureJSProfileSetting,
275 Common.UIString('Disables JavaScript sampling, reduces overhead when run ning against mobile devices'))); 273 Common.UIString('Disables JavaScript sampling, reduces overhead when run ning against mobile devices')));
276 captureToolbar.appendToolbarItem(this._createSettingCheckbox( 274 captureToolbar.appendToolbarItem(this._createSettingCheckbox(
277 this._captureLayersAndPicturesSetting, 275 this._captureLayersAndPicturesSetting,
278 Common.UIString('Captures advanced paint instrumentation, introduces sig nificant performance overhead'))); 276 Common.UIString('Captures advanced paint instrumentation, introduces sig nificant performance overhead')));
279 277
280 var throttlingPane = new UI.VBox(); 278 var throttlingPane = new UI.VBox();
281 throttlingPane.element.classList.add('flex-auto'); 279 throttlingPane.element.classList.add('flex-auto');
282 throttlingPane.show(this._settingsPane.element); 280 throttlingPane.show(this._settingsPane.element);
283 281
284 var throttlingToolbar1 = new UI.Toolbar('', throttlingPane.element); 282 var networkThrottlingToolbar = new UI.Toolbar('', throttlingPane.element);
285 throttlingToolbar1.appendText(Common.UIString('Network:')); 283 networkThrottlingToolbar.appendText(Common.UIString('Network:'));
286 throttlingToolbar1.appendToolbarItem(this._createNetworkConditionsSelect()); 284 this._networkThrottlingSelect = this._createNetworkConditionsSelect();
287 var throttlingToolbar2 = new UI.Toolbar('', throttlingPane.element); 285 networkThrottlingToolbar.appendToolbarItem(this._networkThrottlingSelect);
288 throttlingToolbar2.appendText(Common.UIString('CPU:')); 286
289 throttlingToolbar2.appendToolbarItem(this._cpuThrottlingManager.createContro l()); 287 var cpuThrottlingToolbar = new UI.Toolbar('', throttlingPane.element);
288 cpuThrottlingToolbar.appendText(Common.UIString('CPU:'));
289 this._cpuThrottlingSelect = MobileThrottling.throttlingManager().createContr ol();
290 cpuThrottlingToolbar.appendToolbarItem(this._cpuThrottlingSelect);
290 291
291 this._showSettingsPaneSetting.addChangeListener(this._updateSettingsPaneVisi bility.bind(this)); 292 this._showSettingsPaneSetting.addChangeListener(this._updateSettingsPaneVisi bility.bind(this));
292 this._updateSettingsPaneVisibility(); 293 this._updateSettingsPaneVisibility();
293 } 294 }
294 295
295 /** 296 /**
296 * @param {!Common.Event} event 297 * @param {!Common.Event} event
297 */ 298 */
298 _appendExtensionsToToolbar(event) { 299 _appendExtensionsToToolbar(event) {
299 var provider = /** @type {!Extensions.ExtensionTraceProvider} */ (event.data ); 300 var provider = /** @type {!Extensions.ExtensionTraceProvider} */ (event.data );
(...skipping 16 matching lines...) Expand all
316 } 317 }
317 return setting; 318 return setting;
318 } 319 }
319 320
320 /** 321 /**
321 * @return {!UI.ToolbarComboBox} 322 * @return {!UI.ToolbarComboBox}
322 */ 323 */
323 _createNetworkConditionsSelect() { 324 _createNetworkConditionsSelect() {
324 var toolbarItem = new UI.ToolbarComboBox(null); 325 var toolbarItem = new UI.ToolbarComboBox(null);
325 toolbarItem.setMaxWidth(140); 326 toolbarItem.setMaxWidth(140);
326 MobileThrottling.NetworkConditionsSelector.decorateSelect(toolbarItem.select Element()); 327 MobileThrottling.throttlingManager().decorateSelectWithNetworkThrottling(too lbarItem.selectElement());
327 return toolbarItem; 328 return toolbarItem;
328 } 329 }
329 330
331
dgozman 2017/06/30 23:21:49 stray blank line
chenwilliam 2017/07/05 22:35:32 Done.
330 _prepareToLoadTimeline() { 332 _prepareToLoadTimeline() {
331 console.assert(this._state === Timeline.TimelinePanel.State.Idle); 333 console.assert(this._state === Timeline.TimelinePanel.State.Idle);
332 this._setState(Timeline.TimelinePanel.State.Loading); 334 this._setState(Timeline.TimelinePanel.State.Loading);
333 this._pendingPerformanceModel = new Timeline.PerformanceModel(); 335 this._pendingPerformanceModel = new Timeline.PerformanceModel();
334 } 336 }
335 337
336 _createFileSelector() { 338 _createFileSelector() {
337 if (this._fileSelectorElement) 339 if (this._fileSelectorElement)
338 this._fileSelectorElement.remove(); 340 this._fileSelectorElement.remove();
339 this._fileSelectorElement = UI.createFileSelectorElement(this._loadFromFile. bind(this)); 341 this._fileSelectorElement = UI.createFileSelectorElement(this._loadFromFile. bind(this));
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 493
492 _updateSettingsPaneVisibility() { 494 _updateSettingsPaneVisibility() {
493 if (this._showSettingsPaneSetting.get()) 495 if (this._showSettingsPaneSetting.get())
494 this._settingsPane.showWidget(); 496 this._settingsPane.showWidget();
495 else 497 else
496 this._settingsPane.hideWidget(); 498 this._settingsPane.hideWidget();
497 } 499 }
498 500
499 _updateShowSettingsToolbarButton() { 501 _updateShowSettingsToolbarButton() {
500 var messages = []; 502 var messages = [];
501 if (this._cpuThrottlingManager.rate() !== 1) 503 if (MobileThrottling.throttlingManager().cpuThrottlingRate() !== 1)
502 messages.push(Common.UIString('- CPU throttling is enabled')); 504 messages.push(Common.UIString('- CPU throttling is enabled'));
503 if (SDK.multitargetNetworkManager.isThrottling()) 505 if (SDK.multitargetNetworkManager.isThrottling())
504 messages.push(Common.UIString('- Network throttling is enabled')); 506 messages.push(Common.UIString('- Network throttling is enabled'));
505 if (this._captureLayersAndPicturesSetting.get()) 507 if (this._captureLayersAndPicturesSetting.get())
506 messages.push(Common.UIString('- Significant overhead due to paint instrum entation')); 508 messages.push(Common.UIString('- Significant overhead due to paint instrum entation'));
507 if (this._disableCaptureJSProfileSetting.get()) 509 if (this._disableCaptureJSProfileSetting.get())
508 messages.push(Common.UIString('- JavaScript sampling is disabled')); 510 messages.push(Common.UIString('- JavaScript sampling is disabled'));
509 511
510 this._showSettingsPaneButton.setDefaultWithRedColor(messages.length); 512 this._showSettingsPaneButton.setDefaultWithRedColor(messages.length);
511 this._showSettingsPaneButton.setToggleWithRedColor(messages.length); 513 this._showSettingsPaneButton.setToggleWithRedColor(messages.length);
(...skipping 859 matching lines...) Expand 10 before | Expand all | Expand 10 after
1371 return true; 1373 return true;
1372 case 'timeline.show-history': 1374 case 'timeline.show-history':
1373 panel._showHistory(); 1375 panel._showHistory();
1374 return true; 1376 return true;
1375 } 1377 }
1376 return false; 1378 return false;
1377 } 1379 }
1378 }; 1380 };
1379 1381
1380 Timeline.TimelinePanel._traceProviderSettingSymbol = Symbol('traceProviderSettin g'); 1382 Timeline.TimelinePanel._traceProviderSettingSymbol = Symbol('traceProviderSettin g');
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698