Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 250 this._panelToolbar.appendSeparator(); | 248 this._panelToolbar.appendSeparator(); |
| 251 this._panelToolbar.appendToolbarItem(this._showSettingsPaneButton); | 249 this._panelToolbar.appendToolbarItem(this._showSettingsPaneButton); |
| 252 } | 250 } |
| 253 | 251 |
| 254 _createSettingsPane() { | 252 _createSettingsPane() { |
| 255 this._showSettingsPaneSetting = Common.settings.createSetting('timelineShowS ettingsToolbar', false); | 253 this._showSettingsPaneSetting = Common.settings.createSetting('timelineShowS ettingsToolbar', false); |
| 256 this._showSettingsPaneButton = new UI.ToolbarSettingToggle( | 254 this._showSettingsPaneButton = new UI.ToolbarSettingToggle( |
| 257 this._showSettingsPaneSetting, 'largeicon-settings-gear', Common.UIStrin g('Capture settings')); | 255 this._showSettingsPaneSetting, 'largeicon-settings-gear', Common.UIStrin g('Capture settings')); |
| 258 SDK.multitargetNetworkManager.addEventListener( | 256 SDK.multitargetNetworkManager.addEventListener( |
| 259 SDK.MultitargetNetworkManager.Events.ConditionsChanged, this._updateShow SettingsToolbarButton, this); | 257 SDK.MultitargetNetworkManager.Events.ConditionsChanged, this._updateShow SettingsToolbarButton, this); |
| 260 this._cpuThrottlingManager.addEventListener( | |
| 261 MobileThrottling.CPUThrottlingManager.Events.RateChanged, this._updateSh owSettingsToolbarButton, this); | |
| 262 this._disableCaptureJSProfileSetting.addChangeListener(this._updateShowSetti ngsToolbarButton, this); | 258 this._disableCaptureJSProfileSetting.addChangeListener(this._updateShowSetti ngsToolbarButton, this); |
| 263 this._captureLayersAndPicturesSetting.addChangeListener(this._updateShowSett ingsToolbarButton, this); | 259 this._captureLayersAndPicturesSetting.addChangeListener(this._updateShowSett ingsToolbarButton, this); |
| 264 | 260 |
| 265 this._settingsPane = new UI.HBox(); | 261 this._settingsPane = new UI.HBox(); |
| 266 this._settingsPane.element.classList.add('timeline-settings-pane'); | 262 this._settingsPane.element.classList.add('timeline-settings-pane'); |
| 267 this._settingsPane.show(this.element); | 263 this._settingsPane.show(this.element); |
| 268 | 264 |
| 269 var captureToolbar = new UI.Toolbar('', this._settingsPane.element); | 265 var captureToolbar = new UI.Toolbar('', this._settingsPane.element); |
| 270 captureToolbar.element.classList.add('flex-auto'); | 266 captureToolbar.element.classList.add('flex-auto'); |
| 271 captureToolbar.makeVertical(); | 267 captureToolbar.makeVertical(); |
| 272 captureToolbar.appendToolbarItem(this._createSettingCheckbox( | 268 captureToolbar.appendToolbarItem(this._createSettingCheckbox( |
| 273 this._disableCaptureJSProfileSetting, | 269 this._disableCaptureJSProfileSetting, |
| 274 Common.UIString('Disables JavaScript sampling, reduces overhead when run ning against mobile devices'))); | 270 Common.UIString('Disables JavaScript sampling, reduces overhead when run ning against mobile devices'))); |
| 275 captureToolbar.appendToolbarItem(this._createSettingCheckbox( | 271 captureToolbar.appendToolbarItem(this._createSettingCheckbox( |
| 276 this._captureLayersAndPicturesSetting, | 272 this._captureLayersAndPicturesSetting, |
| 277 Common.UIString('Captures advanced paint instrumentation, introduces sig nificant performance overhead'))); | 273 Common.UIString('Captures advanced paint instrumentation, introduces sig nificant performance overhead'))); |
| 278 | 274 |
| 279 var throttlingPane = new UI.VBox(); | 275 var throttlingPane = new UI.VBox(); |
| 280 throttlingPane.element.classList.add('flex-auto'); | 276 throttlingPane.element.classList.add('flex-auto'); |
| 281 throttlingPane.show(this._settingsPane.element); | 277 throttlingPane.show(this._settingsPane.element); |
| 282 | 278 |
| 283 var throttlingToolbar1 = new UI.Toolbar('', throttlingPane.element); | 279 var throttlingToolbar = new UI.Toolbar('', throttlingPane.element); |
| 284 throttlingToolbar1.appendText(Common.UIString('Network:')); | 280 throttlingToolbar.appendText(Common.UIString('Throttling:')); |
| 285 throttlingToolbar1.appendToolbarItem(this._createNetworkConditionsSelect()); | 281 throttlingToolbar.appendToolbarItem(this._createThrottlingSelect()); |
| 286 var throttlingToolbar2 = new UI.Toolbar('', throttlingPane.element); | 282 this._throttlingSelector.addEventListener( |
| 287 throttlingToolbar2.appendText(Common.UIString('CPU:')); | 283 MobileThrottling.Events.CPURateChanged, this._updateShowSettingsToolbarB utton, this); |
|
dgozman
2017/06/13 01:47:08
You actually want to update not only on cpu thrott
chenwilliam
2017/06/13 21:54:52
So I'm tracking the network throttling changes in
dgozman
2017/06/13 23:18:39
Let's have a single event and update only once. If
| |
| 288 throttlingToolbar2.appendToolbarItem(this._cpuThrottlingManager.createContro l()); | |
| 289 | 284 |
| 290 this._showSettingsPaneSetting.addChangeListener(this._updateSettingsPaneVisi bility.bind(this)); | 285 this._showSettingsPaneSetting.addChangeListener(this._updateSettingsPaneVisi bility.bind(this)); |
| 291 this._updateSettingsPaneVisibility(); | 286 this._updateSettingsPaneVisibility(); |
| 292 } | 287 } |
| 293 | 288 |
| 294 /** | 289 /** |
| 295 * @param {!Common.Event} event | 290 * @param {!Common.Event} event |
| 296 */ | 291 */ |
| 297 _appendExtensionsToToolbar(event) { | 292 _appendExtensionsToToolbar(event) { |
| 298 var provider = /** @type {!Extensions.ExtensionTraceProvider} */ (event.data ); | 293 var provider = /** @type {!Extensions.ExtensionTraceProvider} */ (event.data ); |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 312 setting = Common.settings.createSetting(providerId, false); | 307 setting = Common.settings.createSetting(providerId, false); |
| 313 setting.setTitle(traceProvider.shortDisplayName()); | 308 setting.setTitle(traceProvider.shortDisplayName()); |
| 314 traceProvider[Timeline.TimelinePanel._traceProviderSettingSymbol] = settin g; | 309 traceProvider[Timeline.TimelinePanel._traceProviderSettingSymbol] = settin g; |
| 315 } | 310 } |
| 316 return setting; | 311 return setting; |
| 317 } | 312 } |
| 318 | 313 |
| 319 /** | 314 /** |
| 320 * @return {!UI.ToolbarComboBox} | 315 * @return {!UI.ToolbarComboBox} |
| 321 */ | 316 */ |
| 322 _createNetworkConditionsSelect() { | 317 _createThrottlingSelect() { |
|
dgozman
2017/06/13 01:47:09
Inline it.
chenwilliam
2017/06/13 21:54:52
Done.
| |
| 323 var toolbarItem = new UI.ToolbarComboBox(null); | 318 var toolbarItem = new UI.ToolbarComboBox(null); |
| 324 toolbarItem.setMaxWidth(140); | 319 toolbarItem.setMaxWidth(160); |
| 325 MobileThrottling.NetworkConditionsSelector.decorateSelect(toolbarItem.select Element()); | 320 this._throttlingSelector = MobileThrottling.ThrottlingSelector.decorateSelec t(toolbarItem.selectElement()); |
| 326 return toolbarItem; | 321 return toolbarItem; |
| 327 } | 322 } |
| 328 | 323 |
| 329 _prepareToLoadTimeline() { | 324 _prepareToLoadTimeline() { |
| 330 console.assert(this._state === Timeline.TimelinePanel.State.Idle); | 325 console.assert(this._state === Timeline.TimelinePanel.State.Idle); |
| 331 this._setState(Timeline.TimelinePanel.State.Loading); | 326 this._setState(Timeline.TimelinePanel.State.Loading); |
| 332 this._pendingPerformanceModel = new Timeline.PerformanceModel(); | 327 this._pendingPerformanceModel = new Timeline.PerformanceModel(); |
| 333 } | 328 } |
| 334 | 329 |
| 335 _createFileSelector() { | 330 _createFileSelector() { |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 491 | 486 |
| 492 _updateSettingsPaneVisibility() { | 487 _updateSettingsPaneVisibility() { |
| 493 if (this._showSettingsPaneSetting.get()) | 488 if (this._showSettingsPaneSetting.get()) |
| 494 this._settingsPane.showWidget(); | 489 this._settingsPane.showWidget(); |
| 495 else | 490 else |
| 496 this._settingsPane.hideWidget(); | 491 this._settingsPane.hideWidget(); |
| 497 } | 492 } |
| 498 | 493 |
| 499 _updateShowSettingsToolbarButton() { | 494 _updateShowSettingsToolbarButton() { |
| 500 var messages = []; | 495 var messages = []; |
| 501 if (this._cpuThrottlingManager.rate() !== 1) | 496 if (this._throttlingSelector.cpuThrottlingRate() !== 1) |
| 502 messages.push(Common.UIString('- CPU throttling is enabled')); | 497 messages.push(Common.UIString('- CPU throttling is enabled')); |
| 503 if (SDK.multitargetNetworkManager.isThrottling()) | 498 if (SDK.multitargetNetworkManager.isThrottling()) |
| 504 messages.push(Common.UIString('- Network throttling is enabled')); | 499 messages.push(Common.UIString('- Network throttling is enabled')); |
| 505 if (this._captureLayersAndPicturesSetting.get()) | 500 if (this._captureLayersAndPicturesSetting.get()) |
| 506 messages.push(Common.UIString('- Significant overhead due to paint instrum entation')); | 501 messages.push(Common.UIString('- Significant overhead due to paint instrum entation')); |
| 507 if (this._disableCaptureJSProfileSetting.get()) | 502 if (this._disableCaptureJSProfileSetting.get()) |
| 508 messages.push(Common.UIString('- JavaScript sampling is disabled')); | 503 messages.push(Common.UIString('- JavaScript sampling is disabled')); |
| 509 | 504 |
| 510 this._showSettingsPaneButton.setDefaultWithRedColor(messages.length); | 505 this._showSettingsPaneButton.setDefaultWithRedColor(messages.length); |
| 511 this._showSettingsPaneButton.setToggleWithRedColor(messages.length); | 506 this._showSettingsPaneButton.setToggleWithRedColor(messages.length); |
| (...skipping 857 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1369 return true; | 1364 return true; |
| 1370 case 'timeline.show-history': | 1365 case 'timeline.show-history': |
| 1371 panel._showHistory(); | 1366 panel._showHistory(); |
| 1372 return true; | 1367 return true; |
| 1373 } | 1368 } |
| 1374 return false; | 1369 return false; |
| 1375 } | 1370 } |
| 1376 }; | 1371 }; |
| 1377 | 1372 |
| 1378 Timeline.TimelinePanel._traceProviderSettingSymbol = Symbol('traceProviderSettin g'); | 1373 Timeline.TimelinePanel._traceProviderSettingSymbol = Symbol('traceProviderSettin g'); |
| OLD | NEW |