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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 68 this._frameModel = | 68 this._frameModel = |
| 69 new TimelineModel.TimelineFrameModel(event => Timeline.TimelineUIUtils.e ventStyle(event).category.name); | 69 new TimelineModel.TimelineFrameModel(event => Timeline.TimelineUIUtils.e ventStyle(event).category.name); |
| 70 this._filmStripModel = new Components.FilmStripModel(this._tracingModel); | 70 this._filmStripModel = new Components.FilmStripModel(this._tracingModel); |
| 71 this._irModel = new TimelineModel.TimelineIRModel(); | 71 this._irModel = new TimelineModel.TimelineIRModel(); |
| 72 /** @type {!Array<!{title: string, model: !SDK.TracingModel}>} */ | 72 /** @type {!Array<!{title: string, model: !SDK.TracingModel}>} */ |
| 73 this._extensionTracingModels = []; | 73 this._extensionTracingModels = []; |
| 74 this._cpuThrottlingManager = new Timeline.CPUThrottlingManager(); | 74 this._cpuThrottlingManager = new Timeline.CPUThrottlingManager(); |
| 75 | 75 |
| 76 /** @type {!Array<!Timeline.TimelineModeView>} */ | 76 /** @type {!Array<!Timeline.TimelineModeView>} */ |
| 77 this._currentViews = []; | 77 this._currentViews = []; |
| 78 | |
| 79 this._captureNetworkSetting = Common.settings.createSetting('timelineCapture Network', false); | 78 this._captureNetworkSetting = Common.settings.createSetting('timelineCapture Network', false); |
| 80 this._captureJSProfileSetting = Common.settings.createSetting('timelineEnabl eJSSampling', true); | 79 this._captureJSProfileSetting = Common.settings.createSetting('timelineEnabl eJSSampling', true); |
| 81 this._captureMemorySetting = Common.settings.createSetting('timelineCaptureM emory', false); | 80 this._captureMemorySetting = Common.settings.createSetting('timelineCaptureM emory', false); |
| 82 this._captureLayersAndPicturesSetting = Common.settings.createSetting('timel ineCaptureLayersAndPictures', false); | 81 this._captureLayersAndPicturesSetting = Common.settings.createSetting('timel ineCaptureLayersAndPictures', false); |
| 83 this._captureFilmStripSetting = Common.settings.createSetting('timelineCaptu reFilmStrip', false); | 82 this._captureFilmStripSetting = Common.settings.createSetting('timelineCaptu reFilmStrip', false); |
| 84 | 83 |
| 85 this._showScreenshotsSetting = Common.settings.createLocalSetting('timelineS howScreenshots', false); | 84 this._showScreenshotsSetting = Common.settings.createLocalSetting('timelineS howScreenshots', false); |
| 86 this._showScreenshotsSetting.addChangeListener(this._onModeChanged, this); | 85 this._showScreenshotsSetting.addChangeListener(this._onModeChanged, this); |
| 87 this._showMemorySetting = Common.settings.createLocalSetting('timelineShowMe mory', false); | 86 this._showMemorySetting = Common.settings.createLocalSetting('timelineShowMe mory', false); |
| 88 this._showMemorySetting.addChangeListener(this._onModeChanged, this); | 87 this._showMemorySetting.addChangeListener(this._onModeChanged, this); |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 115 this._searchableView = new UI.SearchableView(this); | 114 this._searchableView = new UI.SearchableView(this); |
| 116 this._searchableView.setMinimumSize(0, 100); | 115 this._searchableView.setMinimumSize(0, 100); |
| 117 this._searchableView.element.classList.add('searchable-view'); | 116 this._searchableView.element.classList.add('searchable-view'); |
| 118 this._detailsSplitWidget.setMainWidget(this._searchableView); | 117 this._detailsSplitWidget.setMainWidget(this._searchableView); |
| 119 | 118 |
| 120 this._stackView = new UI.StackView(false); | 119 this._stackView = new UI.StackView(false); |
| 121 this._stackView.element.classList.add('timeline-view-stack'); | 120 this._stackView.element.classList.add('timeline-view-stack'); |
| 122 | 121 |
| 123 this._stackView.show(this._searchableView.element); | 122 this._stackView.show(this._searchableView.element); |
| 124 this._onModeChanged(); | 123 this._onModeChanged(); |
| 124 | |
| 125 this._configureThrottlingSetting = Common.settings.createSetting('timelineCo nfigureThrottling', false); | |
|
caseq
2016/12/21 00:35:28
This does not have to be a member.
| |
| 126 this._configureThrottlingButton = new UI.ToolbarSettingToggle( | |
| 127 this._configureThrottlingSetting, 'largeicon-settings-gear', Common.UISt ring('Configure throttling')); | |
| 128 SDK.multitargetNetworkManager.addEventListener( | |
| 129 SDK.MultitargetNetworkManager.Events.ConditionsChanged, this._updateConf igureThrottlingButton.bind(this)); | |
| 130 this._throttlingToolbar = new UI.Toolbar('', this.element); | |
| 131 this._cpuThrottlingCombobox = new UI.ToolbarComboBox(this._onCPUThrottlingCh anged.bind(this)); | |
| 132 this._throttlingToolbar.appendText(Common.UIString('Network:')); | |
| 133 this._throttlingToolbar.appendToolbarItem(this._createNetworkConditionsSelec t()); | |
| 134 this._throttlingToolbar.appendSeparator(); | |
| 135 this._throttlingToolbar.appendText(Common.UIString('CPU:')); | |
| 136 this._throttlingToolbar.appendToolbarItem(this._cpuThrottlingCombobox); | |
| 137 this._throttlingToolbar.appendToolbarItem(new UI.ToolbarSeparator(true)); | |
| 138 var hideToolbarItem = new UI.ToolbarButton(Common.UIString('Disable throttli ng'), 'largeicon-delete'); | |
|
alph
2016/12/21 00:37:11
Does it really disable throttling?
| |
| 139 hideToolbarItem.addEventListener(UI.ToolbarButton.Events.Click, () => this._ configureThrottlingSetting.set(false)); | |
| 140 this._throttlingToolbar.appendToolbarItem(hideToolbarItem); | |
| 141 this._populateCPUThrottingCombobox(); | |
| 142 this._configureThrottlingSetting.addChangeListener(this._updateThrottlingToo lbarVisibility.bind(this)); | |
|
caseq
2016/12/21 00:35:28
nit: move up to where the setting is created.
| |
| 143 this._updateThrottlingToolbarVisibility(); | |
| 144 | |
| 125 this._recreateToolbarItems(); | 145 this._recreateToolbarItems(); |
| 126 | 146 |
| 127 Extensions.extensionServer.addEventListener( | 147 Extensions.extensionServer.addEventListener( |
| 128 Extensions.ExtensionServer.Events.TraceProviderAdded, this._recreateTool barItems, this); | 148 Extensions.ExtensionServer.Events.TraceProviderAdded, this._recreateTool barItems, this); |
| 129 | 149 |
| 130 this._captureNetworkSetting.addChangeListener(this._onNetworkChanged, this); | 150 this._captureNetworkSetting.addChangeListener(this._onNetworkChanged, this); |
| 131 this._captureMemorySetting.addChangeListener(this._onModeChanged, this); | 151 this._captureMemorySetting.addChangeListener(this._onModeChanged, this); |
| 132 this._captureFilmStripSetting.addChangeListener(this._onModeChanged, this); | 152 this._captureFilmStripSetting.addChangeListener(this._onModeChanged, this); |
| 133 | 153 |
| 134 this._detailsSplitWidget.show(this._timelinePane.element); | 154 this._detailsSplitWidget.show(this._timelinePane.element); |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 283 return checkboxItem; | 303 return checkboxItem; |
| 284 } | 304 } |
| 285 | 305 |
| 286 _recreateToolbarItems() { | 306 _recreateToolbarItems() { |
| 287 this._panelToolbar.removeToolbarItems(); | 307 this._panelToolbar.removeToolbarItems(); |
| 288 | 308 |
| 289 // Record | 309 // Record |
| 290 const newButton = new UI.ToolbarButton(Common.UIString('New recording'), 'la rgeicon-add', Common.UIString('New')); | 310 const newButton = new UI.ToolbarButton(Common.UIString('New recording'), 'la rgeicon-add', Common.UIString('New')); |
| 291 newButton.addEventListener(UI.ToolbarButton.Events.Click, this._clear, this) ; | 311 newButton.addEventListener(UI.ToolbarButton.Events.Click, this._clear, this) ; |
| 292 this._panelToolbar.appendToolbarItem(newButton); | 312 this._panelToolbar.appendToolbarItem(newButton); |
| 313 this._panelToolbar.appendSeparator(); | |
| 293 this._panelToolbar.appendToolbarItem(UI.Toolbar.createActionButton(this._tog gleRecordAction)); | 314 this._panelToolbar.appendToolbarItem(UI.Toolbar.createActionButton(this._tog gleRecordAction)); |
| 294 this._panelToolbar.appendToolbarItem(UI.Toolbar.createActionButtonForId('mai n.reload')); | 315 this._panelToolbar.appendToolbarItem(UI.Toolbar.createActionButtonForId('mai n.reload')); |
| 295 | |
| 296 this._panelToolbar.appendSeparator(); | 316 this._panelToolbar.appendSeparator(); |
| 317 this._panelToolbar.appendToolbarItem(this._configureThrottlingButton); | |
| 318 this._panelToolbar.appendToolbarItem(UI.Toolbar.createActionButtonForId('com ponents.collect-garbage')); | |
| 297 | 319 |
| 298 // Checkboxes | 320 // Checkboxes |
| 299 if (!this._model.isEmpty()) { | 321 if (!this._model.isEmpty()) { |
| 322 this._panelToolbar.appendSeparator(); | |
| 323 this._panelToolbar.appendText(Common.UIString('Network:')); | |
|
caseq
2016/12/21 00:35:28
Why do we add Network label before memory checkbox
| |
| 300 this._panelToolbar.appendToolbarItem(this._createSettingCheckbox( | 324 this._panelToolbar.appendToolbarItem(this._createSettingCheckbox( |
| 301 Common.UIString('Memory'), this._showMemorySetting, Common.UIString('S how memory timeline.'))); | 325 Common.UIString('Memory'), this._showMemorySetting, Common.UIString('S how memory timeline.'))); |
| 302 if (this._filmStripModel.frames().length) { | 326 if (this._filmStripModel.frames().length) { |
| 303 this._showScreenshotsSetting.set(true); | 327 this._showScreenshotsSetting.set(true); |
| 304 this._panelToolbar.appendToolbarItem(this._createSettingCheckbox( | 328 this._panelToolbar.appendToolbarItem(this._createSettingCheckbox( |
| 305 Common.UIString('Screenshots'), this._showScreenshotsSetting, | 329 Common.UIString('Screenshots'), this._showScreenshotsSetting, |
| 306 Common.UIString('Show captured screenshots.'))); | 330 Common.UIString('Show captured screenshots.'))); |
| 307 } | 331 } |
| 308 } | 332 } |
| 309 | 333 |
| 310 const traceProviders = Extensions.extensionServer.traceProviders(); | 334 const traceProviders = Extensions.extensionServer.traceProviders(); |
| 311 if (traceProviders.length) { | 335 if (traceProviders.length) { |
| 312 this._panelToolbar.appendSeparator(); | 336 this._panelToolbar.appendSeparator(); |
| 313 for (let provider of traceProviders) { | 337 for (let provider of traceProviders) { |
| 314 const setting = Timeline.TimelinePanel._settingForTraceProvider(provider ); | 338 const setting = Timeline.TimelinePanel._settingForTraceProvider(provider ); |
| 315 const checkbox = this._createSettingCheckbox(provider.shortDisplayName() , setting, provider.longDisplayName()); | 339 const checkbox = this._createSettingCheckbox(provider.shortDisplayName() , setting, provider.longDisplayName()); |
| 316 this._panelToolbar.appendToolbarItem(checkbox); | 340 this._panelToolbar.appendToolbarItem(checkbox); |
| 317 } | 341 } |
| 318 } | 342 } |
| 319 | 343 |
| 320 this._panelToolbar.appendSeparator(); | |
| 321 this._cpuThrottlingCombobox = new UI.ToolbarComboBox(this._onCPUThrottlingCh anged.bind(this)); | |
| 322 this._panelToolbar.appendToolbarItem(this._createNetworkConditionsSelect()); | |
| 323 this._panelToolbar.appendToolbarItem(this._cpuThrottlingCombobox); | |
| 324 this._populateCPUThrottingCombobox(); | |
| 325 | |
| 326 this._panelToolbar.appendSeparator(); | |
| 327 this._panelToolbar.appendToolbarItem(UI.Toolbar.createActionButtonForId('com ponents.collect-garbage')); | |
| 328 | |
| 329 this._updateTimelineControls(); | 344 this._updateTimelineControls(); |
| 330 } | 345 } |
| 331 | 346 |
| 332 /** | 347 /** |
| 333 * @param {!Extensions.ExtensionTraceProvider} traceProvider | 348 * @param {!Extensions.ExtensionTraceProvider} traceProvider |
| 334 * @return {!Common.Setting<boolean>} | 349 * @return {!Common.Setting<boolean>} |
| 335 */ | 350 */ |
| 336 static _settingForTraceProvider(traceProvider) { | 351 static _settingForTraceProvider(traceProvider) { |
| 337 var setting = traceProvider[Timeline.TimelinePanel._traceProviderSettingSymb ol]; | 352 var setting = traceProvider[Timeline.TimelinePanel._traceProviderSettingSymb ol]; |
| 338 if (!setting) { | 353 if (!setting) { |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 363 * @param {number} value | 378 * @param {number} value |
| 364 */ | 379 */ |
| 365 function addOption(name, value) { | 380 function addOption(name, value) { |
| 366 var option = cpuThrottlingCombobox.createOption(name, '', String(value)); | 381 var option = cpuThrottlingCombobox.createOption(name, '', String(value)); |
| 367 cpuThrottlingCombobox.addOption(option); | 382 cpuThrottlingCombobox.addOption(option); |
| 368 if (hasSelection || (value && value !== currentRate)) | 383 if (hasSelection || (value && value !== currentRate)) |
| 369 return; | 384 return; |
| 370 cpuThrottlingCombobox.select(option); | 385 cpuThrottlingCombobox.select(option); |
| 371 hasSelection = true; | 386 hasSelection = true; |
| 372 } | 387 } |
| 373 addOption(Common.UIString('No CPU throttling'), 1); | 388 addOption(Common.UIString('No throttling'), 1); |
| 374 for (const rate of [2, 5, 10, 20]) | 389 for (const rate of [2, 5, 10, 20]) |
| 375 addOption(Common.UIString('%d\xD7 slowdown', rate), rate); | 390 addOption(Common.UIString('%d\xD7 slowdown', rate), rate); |
| 376 } | 391 } |
| 377 | 392 |
| 378 _prepareToLoadTimeline() { | 393 _prepareToLoadTimeline() { |
| 379 console.assert(this._state === Timeline.TimelinePanel.State.Idle); | 394 console.assert(this._state === Timeline.TimelinePanel.State.Idle); |
| 380 this._setState(Timeline.TimelinePanel.State.Loading); | 395 this._setState(Timeline.TimelinePanel.State.Loading); |
| 381 } | 396 } |
| 382 | 397 |
| 383 _createFileSelector() { | 398 _createFileSelector() { |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 494 _onNetworkChanged() { | 509 _onNetworkChanged() { |
| 495 if (this._flameChart) | 510 if (this._flameChart) |
| 496 this._flameChart.enableNetworkPane(this._captureNetworkSetting.get(), true ); | 511 this._flameChart.enableNetworkPane(this._captureNetworkSetting.get(), true ); |
| 497 } | 512 } |
| 498 | 513 |
| 499 _onCPUThrottlingChanged() { | 514 _onCPUThrottlingChanged() { |
| 500 if (!this._cpuThrottlingManager) | 515 if (!this._cpuThrottlingManager) |
| 501 return; | 516 return; |
| 502 var text = this._cpuThrottlingCombobox.selectedOption().value; | 517 var text = this._cpuThrottlingCombobox.selectedOption().value; |
| 503 this._cpuThrottlingManager.setRate(Number.parseFloat(text)); | 518 this._cpuThrottlingManager.setRate(Number.parseFloat(text)); |
| 519 this._updateConfigureThrottlingButton(); | |
| 520 } | |
| 521 | |
| 522 _updateThrottlingToolbarVisibility() { | |
| 523 this._throttlingToolbar.element.classList.toggle('hidden', !this._configureT hrottlingSetting.get()); | |
| 524 } | |
| 525 | |
| 526 _updateConfigureThrottlingButton() { | |
| 527 var makeRed = this._cpuThrottlingManager.rate() !== 1 || SDK.multitargetNetw orkManager.isThrottling(); | |
| 528 this._configureThrottlingButton.setDefaultWithRedColor(makeRed); | |
| 529 this._configureThrottlingButton.setToggleWithRedColor(makeRed); | |
| 504 } | 530 } |
| 505 | 531 |
| 506 /** | 532 /** |
| 507 * @param {boolean} enabled | 533 * @param {boolean} enabled |
| 508 */ | 534 */ |
| 509 _setUIControlsEnabled(enabled) { | 535 _setUIControlsEnabled(enabled) { |
| 510 this._recordingOptionUIControls.forEach(control => control.setEnabled(enable d)); | 536 this._recordingOptionUIControls.forEach(control => control.setEnabled(enable d)); |
| 511 } | 537 } |
| 512 | 538 |
| 513 /** | 539 /** |
| (...skipping 1400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1914 } | 1940 } |
| 1915 | 1941 |
| 1916 /** | 1942 /** |
| 1917 * @override | 1943 * @override |
| 1918 * @param {!SDK.Target} target | 1944 * @param {!SDK.Target} target |
| 1919 */ | 1945 */ |
| 1920 targetRemoved(target) { | 1946 targetRemoved(target) { |
| 1921 this._targets.remove(target, true); | 1947 this._targets.remove(target, true); |
| 1922 } | 1948 } |
| 1923 }; | 1949 }; |
| OLD | NEW |