| 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 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 _recreateToolbarItems() { | 275 _recreateToolbarItems() { |
| 276 this._panelToolbar.removeToolbarItems(); | 276 this._panelToolbar.removeToolbarItems(); |
| 277 | 277 |
| 278 var perspectiveSetting = | 278 var perspectiveSetting = |
| 279 Common.settings.createSetting('timelinePerspective', Timeline.TimelinePa
nel.Perspectives.Load); | 279 Common.settings.createSetting('timelinePerspective', Timeline.TimelinePa
nel.Perspectives.Load); |
| 280 | 280 |
| 281 // Record | 281 // Record |
| 282 if (Runtime.experiments.isEnabled('timelineRecordingPerspectives') && | 282 if (Runtime.experiments.isEnabled('timelineRecordingPerspectives') && |
| 283 perspectiveSetting.get() === Timeline.TimelinePanel.Perspectives.Load) { | 283 perspectiveSetting.get() === Timeline.TimelinePanel.Perspectives.Load) { |
| 284 this._reloadButton = new UI.ToolbarButton(Common.UIString('Record & Reload
'), 'largeicon-refresh'); | 284 this._reloadButton = new UI.ToolbarButton(Common.UIString('Record & Reload
'), 'largeicon-refresh'); |
| 285 this._reloadButton.addEventListener(UI.ToolbarButton.Events.Click, () => S
DK.targetManager.reloadPage()); | 285 this._reloadButton.addEventListener('click', () => SDK.targetManager.reloa
dPage()); |
| 286 this._panelToolbar.appendToolbarItem(this._reloadButton); | 286 this._panelToolbar.appendToolbarItem(this._reloadButton); |
| 287 } else { | 287 } else { |
| 288 this._panelToolbar.appendToolbarItem(UI.Toolbar.createActionButton(this._t
oggleRecordAction)); | 288 this._panelToolbar.appendToolbarItem(UI.Toolbar.createActionButton(this._t
oggleRecordAction)); |
| 289 } | 289 } |
| 290 | 290 |
| 291 // Clear | 291 // Clear |
| 292 var clearButton = new UI.ToolbarButton(Common.UIString('Clear recording'), '
largeicon-clear'); | 292 var clearButton = new UI.ToolbarButton(Common.UIString('Clear recording'), '
largeicon-clear'); |
| 293 clearButton.addEventListener(UI.ToolbarButton.Events.Click, this._clear, thi
s); | 293 clearButton.addEventListener('click', this._clear, this); |
| 294 this._panelToolbar.appendToolbarItem(clearButton); | 294 this._panelToolbar.appendToolbarItem(clearButton); |
| 295 | 295 |
| 296 this._panelToolbar.appendSeparator(); | 296 this._panelToolbar.appendSeparator(); |
| 297 | 297 |
| 298 // Combo | 298 // Combo |
| 299 if (Runtime.experiments.isEnabled('timelineRecordingPerspectives')) { | 299 if (Runtime.experiments.isEnabled('timelineRecordingPerspectives')) { |
| 300 /** | 300 /** |
| 301 * @this {!Timeline.TimelinePanel} | 301 * @this {!Timeline.TimelinePanel} |
| 302 */ | 302 */ |
| 303 function onPerspectiveChanged() { | 303 function onPerspectiveChanged() { |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 378 this._panelToolbar.appendToolbarItem(screenshotCheckbox); | 378 this._panelToolbar.appendToolbarItem(screenshotCheckbox); |
| 379 } | 379 } |
| 380 | 380 |
| 381 if (Runtime.experiments.isEnabled('timelineRuleUsageRecording')) { | 381 if (Runtime.experiments.isEnabled('timelineRuleUsageRecording')) { |
| 382 this._panelToolbar.appendToolbarItem(this._createSettingCheckbox( | 382 this._panelToolbar.appendToolbarItem(this._createSettingCheckbox( |
| 383 Common.UIString('CSS coverage'), this._markUnusedCSS, Common.UIString(
'Mark unused CSS in souces.'))); | 383 Common.UIString('CSS coverage'), this._markUnusedCSS, Common.UIString(
'Mark unused CSS in souces.'))); |
| 384 } | 384 } |
| 385 | 385 |
| 386 this._panelToolbar.appendSeparator(); | 386 this._panelToolbar.appendSeparator(); |
| 387 var garbageCollectButton = new UI.ToolbarButton(Common.UIString('Collect gar
bage'), 'largeicon-trash-bin'); | 387 var garbageCollectButton = new UI.ToolbarButton(Common.UIString('Collect gar
bage'), 'largeicon-trash-bin'); |
| 388 garbageCollectButton.addEventListener(UI.ToolbarButton.Events.Click, this._g
arbageCollectButtonClicked, this); | 388 garbageCollectButton.addEventListener('click', this._garbageCollectButtonCli
cked, this); |
| 389 this._panelToolbar.appendToolbarItem(garbageCollectButton); | 389 this._panelToolbar.appendToolbarItem(garbageCollectButton); |
| 390 | 390 |
| 391 this._panelToolbar.appendSeparator(); | 391 this._panelToolbar.appendSeparator(); |
| 392 this._cpuThrottlingCombobox = new UI.ToolbarComboBox(this._onCPUThrottlingCh
anged.bind(this)); | 392 this._cpuThrottlingCombobox = new UI.ToolbarComboBox(this._onCPUThrottlingCh
anged.bind(this)); |
| 393 this._panelToolbar.appendToolbarItem(this._createNetworkConditionsSelect()); | 393 this._panelToolbar.appendToolbarItem(this._createNetworkConditionsSelect()); |
| 394 this._panelToolbar.appendToolbarItem(this._cpuThrottlingCombobox); | 394 this._panelToolbar.appendToolbarItem(this._cpuThrottlingCombobox); |
| 395 this._populateCPUThrottingCombobox(); | 395 this._populateCPUThrottingCombobox(); |
| 396 this._updateTimelineControls(); | 396 this._updateTimelineControls(); |
| 397 } | 397 } |
| 398 | 398 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 417 */ | 417 */ |
| 418 function addGroupingOption(name, value) { | 418 function addGroupingOption(name, value) { |
| 419 var option = cpuThrottlingCombobox.createOption(name, '', String(value)); | 419 var option = cpuThrottlingCombobox.createOption(name, '', String(value)); |
| 420 cpuThrottlingCombobox.addOption(option); | 420 cpuThrottlingCombobox.addOption(option); |
| 421 if (hasSelection || (value && value !== currentRate)) | 421 if (hasSelection || (value && value !== currentRate)) |
| 422 return; | 422 return; |
| 423 cpuThrottlingCombobox.select(option); | 423 cpuThrottlingCombobox.select(option); |
| 424 hasSelection = true; | 424 hasSelection = true; |
| 425 } | 425 } |
| 426 var predefinedRates = new Map([ | 426 var predefinedRates = new Map([ |
| 427 [1, Common.UIString('No CPU throttling')], [2, Common.UIString('2\xD7 slow
down')], | 427 [1, Common.UIString('No CPU throttling')], |
| 428 [5, Common.UIString('5\xD7 slowdown')], [10, Common.UIString('10\xD7 slowd
own')], | 428 [2, Common.UIString('2\xD7 slowdown')], |
| 429 [5, Common.UIString('5\xD7 slowdown')], |
| 430 [10, Common.UIString('10\xD7 slowdown')], |
| 429 [20, Common.UIString('20\xD7 slowdown')] | 431 [20, Common.UIString('20\xD7 slowdown')] |
| 430 ]); | 432 ]); |
| 431 for (var rate of predefinedRates) | 433 for (var rate of predefinedRates) |
| 432 addGroupingOption(rate[1], rate[0]); | 434 addGroupingOption(rate[1], rate[0]); |
| 433 } | 435 } |
| 434 | 436 |
| 435 _prepareToLoadTimeline() { | 437 _prepareToLoadTimeline() { |
| 436 console.assert(this._state === Timeline.TimelinePanel.State.Idle); | 438 console.assert(this._state === Timeline.TimelinePanel.State.Idle); |
| 437 this._setState(Timeline.TimelinePanel.State.Loading); | 439 this._setState(Timeline.TimelinePanel.State.Loading); |
| 438 } | 440 } |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 630 this._dropTarget.setEnabled(this._state === state.Idle); | 632 this._dropTarget.setEnabled(this._state === state.Idle); |
| 631 } | 633 } |
| 632 | 634 |
| 633 _toggleRecording() { | 635 _toggleRecording() { |
| 634 if (this._state === Timeline.TimelinePanel.State.Idle) | 636 if (this._state === Timeline.TimelinePanel.State.Idle) |
| 635 this._startRecording(true); | 637 this._startRecording(true); |
| 636 else if (this._state === Timeline.TimelinePanel.State.Recording) | 638 else if (this._state === Timeline.TimelinePanel.State.Recording) |
| 637 this._stopRecording(); | 639 this._stopRecording(); |
| 638 } | 640 } |
| 639 | 641 |
| 640 /** | 642 _garbageCollectButtonClicked() { |
| 641 * @param {!Common.Event} event | |
| 642 */ | |
| 643 _garbageCollectButtonClicked(event) { | |
| 644 var targets = SDK.targetManager.targets(); | 643 var targets = SDK.targetManager.targets(); |
| 645 for (var i = 0; i < targets.length; ++i) | 644 for (var i = 0; i < targets.length; ++i) |
| 646 targets[i].heapProfilerAgent().collectGarbage(); | 645 targets[i].heapProfilerAgent().collectGarbage(); |
| 647 } | 646 } |
| 648 | 647 |
| 649 _clear() { | 648 _clear() { |
| 650 if (Runtime.experiments.isEnabled('timelineRuleUsageRecording') && this._mar
kUnusedCSS.get()) | 649 if (Runtime.experiments.isEnabled('timelineRuleUsageRecording') && this._mar
kUnusedCSS.get()) |
| 651 Components.CoverageProfile.instance().reset(); | 650 Components.CoverageProfile.instance().reset(); |
| 652 | 651 |
| 653 Components.LineLevelProfile.instance().reset(); | 652 Components.LineLevelProfile.instance().reset(); |
| (...skipping 1304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1958 } | 1957 } |
| 1959 | 1958 |
| 1960 /** | 1959 /** |
| 1961 * @override | 1960 * @override |
| 1962 * @param {!SDK.Target} target | 1961 * @param {!SDK.Target} target |
| 1963 */ | 1962 */ |
| 1964 targetRemoved(target) { | 1963 targetRemoved(target) { |
| 1965 this._targets.remove(target, true); | 1964 this._targets.remove(target, true); |
| 1966 } | 1965 } |
| 1967 }; | 1966 }; |
| OLD | NEW |