| 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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 this._searchableView = new UI.SearchableView(this); | 113 this._searchableView = new UI.SearchableView(this); |
| 114 this._searchableView.setMinimumSize(0, 100); | 114 this._searchableView.setMinimumSize(0, 100); |
| 115 this._searchableView.element.classList.add('searchable-view'); | 115 this._searchableView.element.classList.add('searchable-view'); |
| 116 this._detailsSplitWidget.setMainWidget(this._searchableView); | 116 this._detailsSplitWidget.setMainWidget(this._searchableView); |
| 117 | 117 |
| 118 this._stackView = new UI.StackView(false); | 118 this._stackView = new UI.StackView(false); |
| 119 this._stackView.element.classList.add('timeline-view-stack'); | 119 this._stackView.element.classList.add('timeline-view-stack'); |
| 120 | 120 |
| 121 this._stackView.show(this._searchableView.element); | 121 this._stackView.show(this._searchableView.element); |
| 122 this._onModeChanged(); | 122 this._onModeChanged(); |
| 123 |
| 124 this._configureThrottlingSetting = Common.settings.createSetting('timelineCo
nfigureThrottling', false); |
| 125 this._configureThrottlingButton = new UI.ToolbarSettingToggle( |
| 126 this._configureThrottlingSetting, 'largeicon-settings-gear', Common.UISt
ring('Configure throttling')); |
| 127 SDK.multitargetNetworkManager.addEventListener( |
| 128 SDK.MultitargetNetworkManager.Events.ConditionsChanged, this._updateConf
igureThrottlingButton.bind(this)); |
| 129 this._throttlingToolbar = new UI.Toolbar('', this.element); |
| 130 this._cpuThrottlingCombobox = new UI.ToolbarComboBox(this._onCPUThrottlingCh
anged.bind(this)); |
| 131 this._throttlingToolbar.appendText(Common.UIString('Network:')); |
| 132 this._throttlingToolbar.appendToolbarItem(this._createNetworkConditionsSelec
t()); |
| 133 this._throttlingToolbar.appendSeparator(); |
| 134 this._throttlingToolbar.appendText(Common.UIString('CPU:')); |
| 135 this._throttlingToolbar.appendToolbarItem(this._cpuThrottlingCombobox); |
| 136 this._throttlingToolbar.appendToolbarItem(new UI.ToolbarSeparator(true)); |
| 137 var hideToolbarItem = new UI.ToolbarButton(Common.UIString('Close'), 'largei
con-delete'); |
| 138 hideToolbarItem.addEventListener(UI.ToolbarButton.Events.Click, () => this._
configureThrottlingSetting.set(false)); |
| 139 this._throttlingToolbar.appendToolbarItem(hideToolbarItem); |
| 140 this._populateCPUThrottingCombobox(); |
| 141 this._configureThrottlingSetting.addChangeListener(this._updateThrottlingToo
lbarVisibility.bind(this)); |
| 142 this._updateThrottlingToolbarVisibility(); |
| 143 |
| 144 this._showLandingPage(); |
| 123 this._recreateToolbarItems(); | 145 this._recreateToolbarItems(); |
| 124 | 146 |
| 125 Extensions.extensionServer.addEventListener( | 147 Extensions.extensionServer.addEventListener( |
| 126 Extensions.ExtensionServer.Events.TraceProviderAdded, this._recreateTool
barItems, this); | 148 Extensions.ExtensionServer.Events.TraceProviderAdded, this._recreateTool
barItems, this); |
| 127 | 149 |
| 128 this._captureFilmStripSetting.addChangeListener(this._onModeChanged, this); | 150 this._captureFilmStripSetting.addChangeListener(this._onModeChanged, this); |
| 129 | 151 |
| 130 this._detailsSplitWidget.show(this._timelinePane.element); | 152 this._detailsSplitWidget.show(this._timelinePane.element); |
| 131 this._detailsSplitWidget.hideSidebar(); | 153 this._detailsSplitWidget.hideSidebar(); |
| 132 SDK.targetManager.addEventListener(SDK.TargetManager.Events.SuspendStateChan
ged, this._onSuspendStateChanged, this); | 154 SDK.targetManager.addEventListener(SDK.TargetManager.Events.SuspendStateChan
ged, this._onSuspendStateChanged, this); |
| 133 this._showLandingPage(); | |
| 134 | 155 |
| 135 /** @type {!SDK.TracingModel.Event}|undefined */ | 156 /** @type {!SDK.TracingModel.Event}|undefined */ |
| 136 this._selectedSearchResult; | 157 this._selectedSearchResult; |
| 137 /** @type {!Array<!SDK.TracingModel.Event>}|undefined */ | 158 /** @type {!Array<!SDK.TracingModel.Event>}|undefined */ |
| 138 this._searchResults; | 159 this._searchResults; |
| 139 /** @type {?symbol} */ | 160 /** @type {?symbol} */ |
| 140 this._sessionGeneration = null; | 161 this._sessionGeneration = null; |
| 141 /** @type {number} */ | 162 /** @type {number} */ |
| 142 this._recordingStartTime = 0; | 163 this._recordingStartTime = 0; |
| 143 } | 164 } |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 const checkboxItem = new UI.ToolbarCheckbox(name, tooltip, setting); | 298 const checkboxItem = new UI.ToolbarCheckbox(name, tooltip, setting); |
| 278 this._recordingOptionUIControls.push(checkboxItem); | 299 this._recordingOptionUIControls.push(checkboxItem); |
| 279 return checkboxItem; | 300 return checkboxItem; |
| 280 } | 301 } |
| 281 | 302 |
| 282 _recreateToolbarItems() { | 303 _recreateToolbarItems() { |
| 283 this._panelToolbar.removeToolbarItems(); | 304 this._panelToolbar.removeToolbarItems(); |
| 284 | 305 |
| 285 // Record | 306 // Record |
| 286 const newButton = new UI.ToolbarButton(Common.UIString('New recording'), 'la
rgeicon-add', Common.UIString('New')); | 307 const newButton = new UI.ToolbarButton(Common.UIString('New recording'), 'la
rgeicon-add', Common.UIString('New')); |
| 308 newButton.setEnabled(!this._landingPage); |
| 287 newButton.addEventListener(UI.ToolbarButton.Events.Click, this._clear, this)
; | 309 newButton.addEventListener(UI.ToolbarButton.Events.Click, this._clear, this)
; |
| 288 this._panelToolbar.appendToolbarItem(newButton); | 310 this._panelToolbar.appendToolbarItem(newButton); |
| 311 this._panelToolbar.appendSeparator(); |
| 289 this._panelToolbar.appendToolbarItem(UI.Toolbar.createActionButton(this._tog
gleRecordAction)); | 312 this._panelToolbar.appendToolbarItem(UI.Toolbar.createActionButton(this._tog
gleRecordAction)); |
| 290 this._panelToolbar.appendToolbarItem(UI.Toolbar.createActionButtonForId('mai
n.reload')); | 313 this._panelToolbar.appendToolbarItem(UI.Toolbar.createActionButtonForId('mai
n.reload')); |
| 291 | |
| 292 this._panelToolbar.appendSeparator(); | 314 this._panelToolbar.appendSeparator(); |
| 315 this._panelToolbar.appendToolbarItem(this._configureThrottlingButton); |
| 316 this._panelToolbar.appendToolbarItem(UI.Toolbar.createActionButtonForId('com
ponents.collect-garbage')); |
| 293 | 317 |
| 294 // Checkboxes | 318 // Checkboxes |
| 295 if (!this._model.isEmpty()) { | 319 if (!this._model.isEmpty()) { |
| 320 this._panelToolbar.appendSeparator(); |
| 321 this._panelToolbar.appendText(Common.UIString('View:')); |
| 296 this._panelToolbar.appendToolbarItem(this._createSettingCheckbox( | 322 this._panelToolbar.appendToolbarItem(this._createSettingCheckbox( |
| 297 Common.UIString('Memory'), this._showMemorySetting, Common.UIString('S
how memory timeline.'))); | 323 Common.UIString('Memory'), this._showMemorySetting, Common.UIString('S
how memory timeline.'))); |
| 298 if (this._filmStripModel.frames().length) { | 324 if (this._filmStripModel.frames().length) { |
| 299 this._showScreenshotsSetting.set(true); | 325 this._showScreenshotsSetting.set(true); |
| 300 this._panelToolbar.appendToolbarItem(this._createSettingCheckbox( | 326 this._panelToolbar.appendToolbarItem(this._createSettingCheckbox( |
| 301 Common.UIString('Screenshots'), this._showScreenshotsSetting, | 327 Common.UIString('Screenshots'), this._showScreenshotsSetting, |
| 302 Common.UIString('Show captured screenshots.'))); | 328 Common.UIString('Show captured screenshots.'))); |
| 303 } | 329 } |
| 304 } | 330 } |
| 305 | 331 |
| 306 const traceProviders = Extensions.extensionServer.traceProviders(); | 332 const traceProviders = Extensions.extensionServer.traceProviders(); |
| 307 if (traceProviders.length) { | 333 if (traceProviders.length) { |
| 308 this._panelToolbar.appendSeparator(); | 334 this._panelToolbar.appendSeparator(); |
| 309 for (let provider of traceProviders) { | 335 for (let provider of traceProviders) { |
| 310 const setting = Timeline.TimelinePanel._settingForTraceProvider(provider
); | 336 const setting = Timeline.TimelinePanel._settingForTraceProvider(provider
); |
| 311 const checkbox = this._createSettingCheckbox(provider.shortDisplayName()
, setting, provider.longDisplayName()); | 337 const checkbox = this._createSettingCheckbox(provider.shortDisplayName()
, setting, provider.longDisplayName()); |
| 312 this._panelToolbar.appendToolbarItem(checkbox); | 338 this._panelToolbar.appendToolbarItem(checkbox); |
| 313 } | 339 } |
| 314 } | 340 } |
| 315 | 341 |
| 316 this._panelToolbar.appendSeparator(); | |
| 317 this._cpuThrottlingCombobox = new UI.ToolbarComboBox(this._onCPUThrottlingCh
anged.bind(this)); | |
| 318 this._panelToolbar.appendToolbarItem(this._createNetworkConditionsSelect()); | |
| 319 this._panelToolbar.appendToolbarItem(this._cpuThrottlingCombobox); | |
| 320 this._populateCPUThrottingCombobox(); | |
| 321 | |
| 322 this._panelToolbar.appendSeparator(); | |
| 323 this._panelToolbar.appendToolbarItem(UI.Toolbar.createActionButtonForId('com
ponents.collect-garbage')); | |
| 324 | |
| 325 this._updateTimelineControls(); | 342 this._updateTimelineControls(); |
| 326 } | 343 } |
| 327 | 344 |
| 328 /** | 345 /** |
| 329 * @param {!Extensions.ExtensionTraceProvider} traceProvider | 346 * @param {!Extensions.ExtensionTraceProvider} traceProvider |
| 330 * @return {!Common.Setting<boolean>} | 347 * @return {!Common.Setting<boolean>} |
| 331 */ | 348 */ |
| 332 static _settingForTraceProvider(traceProvider) { | 349 static _settingForTraceProvider(traceProvider) { |
| 333 var setting = traceProvider[Timeline.TimelinePanel._traceProviderSettingSymb
ol]; | 350 var setting = traceProvider[Timeline.TimelinePanel._traceProviderSettingSymb
ol]; |
| 334 if (!setting) { | 351 if (!setting) { |
| (...skipping 24 matching lines...) Expand all Loading... |
| 359 * @param {number} value | 376 * @param {number} value |
| 360 */ | 377 */ |
| 361 function addOption(name, value) { | 378 function addOption(name, value) { |
| 362 var option = cpuThrottlingCombobox.createOption(name, '', String(value)); | 379 var option = cpuThrottlingCombobox.createOption(name, '', String(value)); |
| 363 cpuThrottlingCombobox.addOption(option); | 380 cpuThrottlingCombobox.addOption(option); |
| 364 if (hasSelection || (value && value !== currentRate)) | 381 if (hasSelection || (value && value !== currentRate)) |
| 365 return; | 382 return; |
| 366 cpuThrottlingCombobox.select(option); | 383 cpuThrottlingCombobox.select(option); |
| 367 hasSelection = true; | 384 hasSelection = true; |
| 368 } | 385 } |
| 369 addOption(Common.UIString('No CPU throttling'), 1); | 386 addOption(Common.UIString('No throttling'), 1); |
| 370 for (const rate of [2, 5, 10, 20]) | 387 for (const rate of [2, 5, 10, 20]) |
| 371 addOption(Common.UIString('%d\xD7 slowdown', rate), rate); | 388 addOption(Common.UIString('%d\xD7 slowdown', rate), rate); |
| 372 } | 389 } |
| 373 | 390 |
| 374 _prepareToLoadTimeline() { | 391 _prepareToLoadTimeline() { |
| 375 console.assert(this._state === Timeline.TimelinePanel.State.Idle); | 392 console.assert(this._state === Timeline.TimelinePanel.State.Idle); |
| 376 this._setState(Timeline.TimelinePanel.State.Loading); | 393 this._setState(Timeline.TimelinePanel.State.Loading); |
| 377 } | 394 } |
| 378 | 395 |
| 379 _createFileSelector() { | 396 _createFileSelector() { |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 483 | 500 |
| 484 this.doResize(); | 501 this.doResize(); |
| 485 this.select(null); | 502 this.select(null); |
| 486 } | 503 } |
| 487 | 504 |
| 488 _onCPUThrottlingChanged() { | 505 _onCPUThrottlingChanged() { |
| 489 if (!this._cpuThrottlingManager) | 506 if (!this._cpuThrottlingManager) |
| 490 return; | 507 return; |
| 491 var text = this._cpuThrottlingCombobox.selectedOption().value; | 508 var text = this._cpuThrottlingCombobox.selectedOption().value; |
| 492 this._cpuThrottlingManager.setRate(Number.parseFloat(text)); | 509 this._cpuThrottlingManager.setRate(Number.parseFloat(text)); |
| 510 this._updateConfigureThrottlingButton(); |
| 511 } |
| 512 |
| 513 _updateThrottlingToolbarVisibility() { |
| 514 this._throttlingToolbar.element.classList.toggle('hidden', !this._configureT
hrottlingSetting.get()); |
| 515 } |
| 516 |
| 517 _updateConfigureThrottlingButton() { |
| 518 var makeRed = this._cpuThrottlingManager.rate() !== 1 || SDK.multitargetNetw
orkManager.isThrottling(); |
| 519 this._configureThrottlingButton.setDefaultWithRedColor(makeRed); |
| 520 this._configureThrottlingButton.setToggleWithRedColor(makeRed); |
| 493 } | 521 } |
| 494 | 522 |
| 495 /** | 523 /** |
| 496 * @param {boolean} enabled | 524 * @param {boolean} enabled |
| 497 */ | 525 */ |
| 498 _setUIControlsEnabled(enabled) { | 526 _setUIControlsEnabled(enabled) { |
| 499 this._recordingOptionUIControls.forEach(control => control.setEnabled(enable
d)); | 527 this._recordingOptionUIControls.forEach(control => control.setEnabled(enable
d)); |
| 500 } | 528 } |
| 501 | 529 |
| 502 /** | 530 /** |
| (...skipping 1398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1901 } | 1929 } |
| 1902 | 1930 |
| 1903 /** | 1931 /** |
| 1904 * @override | 1932 * @override |
| 1905 * @param {!SDK.Target} target | 1933 * @param {!SDK.Target} target |
| 1906 */ | 1934 */ |
| 1907 targetRemoved(target) { | 1935 targetRemoved(target) { |
| 1908 this._targets.remove(target, true); | 1936 this._targets.remove(target, true); |
| 1909 } | 1937 } |
| 1910 }; | 1938 }; |
| OLD | NEW |