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 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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.cpuThrottlingRateSetting().addChangeListener(this._updateSh owSettingsToolbarButton, this); |
| 262 MobileThrottling.CPUThrottlingManager.Events.RateChanged, this._updateSh owSettingsToolbarButton, this); | |
| 263 this._disableCaptureJSProfileSetting.addChangeListener(this._updateShowSetti ngsToolbarButton, this); | 260 this._disableCaptureJSProfileSetting.addChangeListener(this._updateShowSetti ngsToolbarButton, this); |
| 264 this._captureLayersAndPicturesSetting.addChangeListener(this._updateShowSett ingsToolbarButton, this); | 261 this._captureLayersAndPicturesSetting.addChangeListener(this._updateShowSett ingsToolbarButton, this); |
| 265 | 262 |
| 266 this._settingsPane = new UI.HBox(); | 263 this._settingsPane = new UI.HBox(); |
| 267 this._settingsPane.element.classList.add('timeline-settings-pane'); | 264 this._settingsPane.element.classList.add('timeline-settings-pane'); |
| 268 this._settingsPane.show(this.element); | 265 this._settingsPane.show(this.element); |
| 269 | 266 |
| 270 var captureToolbar = new UI.Toolbar('', this._settingsPane.element); | 267 var captureToolbar = new UI.Toolbar('', this._settingsPane.element); |
| 271 captureToolbar.element.classList.add('flex-auto'); | 268 captureToolbar.element.classList.add('flex-auto'); |
| 272 captureToolbar.makeVertical(); | 269 captureToolbar.makeVertical(); |
| 273 captureToolbar.appendToolbarItem(this._createSettingCheckbox( | 270 captureToolbar.appendToolbarItem(this._createSettingCheckbox( |
| 274 this._disableCaptureJSProfileSetting, | 271 this._disableCaptureJSProfileSetting, |
| 275 Common.UIString('Disables JavaScript sampling, reduces overhead when run ning against mobile devices'))); | 272 Common.UIString('Disables JavaScript sampling, reduces overhead when run ning against mobile devices'))); |
| 276 captureToolbar.appendToolbarItem(this._createSettingCheckbox( | 273 captureToolbar.appendToolbarItem(this._createSettingCheckbox( |
| 277 this._captureLayersAndPicturesSetting, | 274 this._captureLayersAndPicturesSetting, |
| 278 Common.UIString('Captures advanced paint instrumentation, introduces sig nificant performance overhead'))); | 275 Common.UIString('Captures advanced paint instrumentation, introduces sig nificant performance overhead'))); |
| 279 | 276 |
| 280 var throttlingPane = new UI.VBox(); | 277 var throttlingPane = new UI.VBox(); |
| 281 throttlingPane.element.classList.add('flex-auto'); | 278 throttlingPane.element.classList.add('flex-auto'); |
| 282 throttlingPane.show(this._settingsPane.element); | 279 throttlingPane.show(this._settingsPane.element); |
| 283 | 280 |
| 284 var throttlingToolbar1 = new UI.Toolbar('', throttlingPane.element); | 281 var networkThrottlingToolbar = new UI.Toolbar('', throttlingPane.element); |
| 285 throttlingToolbar1.appendText(Common.UIString('Network:')); | 282 networkThrottlingToolbar.appendText(Common.UIString('Network:')); |
| 286 throttlingToolbar1.appendToolbarItem(this._createNetworkConditionsSelect()); | 283 this._networkThrottlingRefForTest = this._createNetworkConditionsSelect(); |
|
dgozman
2017/06/28 22:33:09
Just call it this._networkThrottlingSelect
chenwilliam
2017/06/29 20:34:02
Done.
| |
| 287 var throttlingToolbar2 = new UI.Toolbar('', throttlingPane.element); | 284 networkThrottlingToolbar.appendToolbarItem(this._networkThrottlingRefForTest ); |
| 288 throttlingToolbar2.appendText(Common.UIString('CPU:')); | 285 |
| 289 throttlingToolbar2.appendToolbarItem(this._cpuThrottlingManager.createContro l()); | 286 var cpuThrottlingToolbar = new UI.Toolbar('', throttlingPane.element); |
| 287 cpuThrottlingToolbar.appendText(Common.UIString('CPU:')); | |
| 288 this._cpuThrottlingRefForTest = MobileThrottling.cpuThrottlingManager.create Control(); | |
|
dgozman
2017/06/28 22:33:09
If you create control through a manager, you shoul
chenwilliam
2017/06/29 20:34:02
Done.
| |
| 289 cpuThrottlingToolbar.appendToolbarItem(this._cpuThrottlingRefForTest); | |
| 290 | 290 |
| 291 this._showSettingsPaneSetting.addChangeListener(this._updateSettingsPaneVisi bility.bind(this)); | 291 this._showSettingsPaneSetting.addChangeListener(this._updateSettingsPaneVisi bility.bind(this)); |
| 292 this._updateSettingsPaneVisibility(); | 292 this._updateSettingsPaneVisibility(); |
| 293 } | 293 } |
| 294 | 294 |
| 295 /** | 295 /** |
| 296 * @param {!Common.Event} event | 296 * @param {!Common.Event} event |
| 297 */ | 297 */ |
| 298 _appendExtensionsToToolbar(event) { | 298 _appendExtensionsToToolbar(event) { |
| 299 var provider = /** @type {!Extensions.ExtensionTraceProvider} */ (event.data ); | 299 var provider = /** @type {!Extensions.ExtensionTraceProvider} */ (event.data ); |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 316 } | 316 } |
| 317 return setting; | 317 return setting; |
| 318 } | 318 } |
| 319 | 319 |
| 320 /** | 320 /** |
| 321 * @return {!UI.ToolbarComboBox} | 321 * @return {!UI.ToolbarComboBox} |
| 322 */ | 322 */ |
| 323 _createNetworkConditionsSelect() { | 323 _createNetworkConditionsSelect() { |
| 324 var toolbarItem = new UI.ToolbarComboBox(null); | 324 var toolbarItem = new UI.ToolbarComboBox(null); |
| 325 toolbarItem.setMaxWidth(140); | 325 toolbarItem.setMaxWidth(140); |
| 326 MobileThrottling.NetworkConditionsSelector.decorateSelect(toolbarItem.select Element()); | 326 MobileThrottling.NetworkThrottlingSelector.decorateSelect(toolbarItem.select Element()); |
| 327 return toolbarItem; | 327 return toolbarItem; |
| 328 } | 328 } |
| 329 | 329 |
| 330 | |
| 330 _prepareToLoadTimeline() { | 331 _prepareToLoadTimeline() { |
| 331 console.assert(this._state === Timeline.TimelinePanel.State.Idle); | 332 console.assert(this._state === Timeline.TimelinePanel.State.Idle); |
| 332 this._setState(Timeline.TimelinePanel.State.Loading); | 333 this._setState(Timeline.TimelinePanel.State.Loading); |
| 333 this._pendingPerformanceModel = new Timeline.PerformanceModel(); | 334 this._pendingPerformanceModel = new Timeline.PerformanceModel(); |
| 334 } | 335 } |
| 335 | 336 |
| 336 _createFileSelector() { | 337 _createFileSelector() { |
| 337 if (this._fileSelectorElement) | 338 if (this._fileSelectorElement) |
| 338 this._fileSelectorElement.remove(); | 339 this._fileSelectorElement.remove(); |
| 339 this._fileSelectorElement = UI.createFileSelectorElement(this._loadFromFile. bind(this)); | 340 this._fileSelectorElement = UI.createFileSelectorElement(this._loadFromFile. bind(this)); |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 491 | 492 |
| 492 _updateSettingsPaneVisibility() { | 493 _updateSettingsPaneVisibility() { |
| 493 if (this._showSettingsPaneSetting.get()) | 494 if (this._showSettingsPaneSetting.get()) |
| 494 this._settingsPane.showWidget(); | 495 this._settingsPane.showWidget(); |
| 495 else | 496 else |
| 496 this._settingsPane.hideWidget(); | 497 this._settingsPane.hideWidget(); |
| 497 } | 498 } |
| 498 | 499 |
| 499 _updateShowSettingsToolbarButton() { | 500 _updateShowSettingsToolbarButton() { |
| 500 var messages = []; | 501 var messages = []; |
| 501 if (this._cpuThrottlingManager.rate() !== 1) | 502 if (MobileThrottling.cpuThrottlingRateSetting().get() !== 1) |
|
dgozman
2017/06/28 22:33:09
MobileThrottling.cpuThrottlingManager.rate()
chenwilliam
2017/06/29 20:34:02
Done.
| |
| 502 messages.push(Common.UIString('- CPU throttling is enabled')); | 503 messages.push(Common.UIString('- CPU throttling is enabled')); |
| 503 if (SDK.multitargetNetworkManager.isThrottling()) | 504 if (SDK.multitargetNetworkManager.isThrottling()) |
| 504 messages.push(Common.UIString('- Network throttling is enabled')); | 505 messages.push(Common.UIString('- Network throttling is enabled')); |
| 505 if (this._captureLayersAndPicturesSetting.get()) | 506 if (this._captureLayersAndPicturesSetting.get()) |
| 506 messages.push(Common.UIString('- Significant overhead due to paint instrum entation')); | 507 messages.push(Common.UIString('- Significant overhead due to paint instrum entation')); |
| 507 if (this._disableCaptureJSProfileSetting.get()) | 508 if (this._disableCaptureJSProfileSetting.get()) |
| 508 messages.push(Common.UIString('- JavaScript sampling is disabled')); | 509 messages.push(Common.UIString('- JavaScript sampling is disabled')); |
| 509 | 510 |
| 510 this._showSettingsPaneButton.setDefaultWithRedColor(messages.length); | 511 this._showSettingsPaneButton.setDefaultWithRedColor(messages.length); |
| 511 this._showSettingsPaneButton.setToggleWithRedColor(messages.length); | 512 this._showSettingsPaneButton.setToggleWithRedColor(messages.length); |
| (...skipping 859 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1371 return true; | 1372 return true; |
| 1372 case 'timeline.show-history': | 1373 case 'timeline.show-history': |
| 1373 panel._showHistory(); | 1374 panel._showHistory(); |
| 1374 return true; | 1375 return true; |
| 1375 } | 1376 } |
| 1376 return false; | 1377 return false; |
| 1377 } | 1378 } |
| 1378 }; | 1379 }; |
| 1379 | 1380 |
| 1380 Timeline.TimelinePanel._traceProviderSettingSymbol = Symbol('traceProviderSettin g'); | 1381 Timeline.TimelinePanel._traceProviderSettingSymbol = Symbol('traceProviderSettin g'); |
| OLD | NEW |