Commit 741d84a5 authored by pfeldman's avatar pfeldman Committed by Commit bot

DevTools: move the GC button into the memory panel.

Review-Url: https://codereview.chromium.org/2560353002
Cr-Commit-Position: refs/heads/master@{#437736}
parent aca5d577
......@@ -431,6 +431,9 @@ Profiler.ProfilesPanel = class extends UI.PanelWithSidebar {
this.clearResultsButton = new UI.ToolbarButton(Common.UIString('Clear all profiles'), 'largeicon-clear');
this.clearResultsButton.addEventListener('click', this._reset, this);
toolbar.appendToolbarItem(this.clearResultsButton);
toolbar.appendSeparator();
toolbar.appendToolbarItem(
/** @type {!UI.ToolbarItem} */ (UI.Toolbar.createActionButtonForId('profiler.collect-garbage')));
this._profileTypeToolbar = new UI.Toolbar('', this._toolbarElement);
this._profileViewToolbar = new UI.Toolbar('', this._toolbarElement);
......@@ -1260,3 +1263,21 @@ Profiler.ProfilesPanel.RecordActionDelegate = class {
return true;
}
};
/**
* @implements {UI.ActionDelegate}
* @unrestricted
*/
Profiler.ProfilesPanel.GCActionDelegate = class {
/**
* @override
* @param {!UI.Context} context
* @param {string} actionId
* @return {boolean}
*/
handleAction(context, actionId) {
for (var target of SDK.targetManager.targets())
target.heapProfilerAgent().collectGarbage();
return true;
}
};
......@@ -65,6 +65,13 @@
"shortcut": "Meta+E"
}
]
},
{
"type": "@UI.ActionDelegate",
"actionId": "profiler.collect-garbage",
"title": "Collect garbage",
"iconClass": "largeicon-trash-bin",
"className": "Profiler.ProfilesPanel.GCActionDelegate"
}
],
"dependencies": [
......
......@@ -383,11 +383,6 @@ Timeline.TimelinePanel = class extends UI.Panel {
Common.UIString('CSS coverage'), this._markUnusedCSS, Common.UIString('Mark unused CSS in souces.')));
}
this._panelToolbar.appendSeparator();
var garbageCollectButton = new UI.ToolbarButton(Common.UIString('Collect garbage'), 'largeicon-trash-bin');
garbageCollectButton.addEventListener('click', this._garbageCollectButtonClicked, this);
this._panelToolbar.appendToolbarItem(garbageCollectButton);
this._panelToolbar.appendSeparator();
this._cpuThrottlingCombobox = new UI.ToolbarComboBox(this._onCPUThrottlingChanged.bind(this));
this._panelToolbar.appendToolbarItem(this._createNetworkConditionsSelect());
......@@ -424,10 +419,8 @@ Timeline.TimelinePanel = class extends UI.Panel {
hasSelection = true;
}
var predefinedRates = new Map([
[1, Common.UIString('No CPU throttling')],
[2, Common.UIString('2\xD7 slowdown')],
[5, Common.UIString('5\xD7 slowdown')],
[10, Common.UIString('10\xD7 slowdown')],
[1, Common.UIString('No CPU throttling')], [2, Common.UIString('2\xD7 slowdown')],
[5, Common.UIString('5\xD7 slowdown')], [10, Common.UIString('10\xD7 slowdown')],
[20, Common.UIString('20\xD7 slowdown')]
]);
for (var rate of predefinedRates)
......@@ -639,12 +632,6 @@ Timeline.TimelinePanel = class extends UI.Panel {
this._stopRecording();
}
_garbageCollectButtonClicked() {
var targets = SDK.targetManager.targets();
for (var i = 0; i < targets.length; ++i)
targets[i].heapProfilerAgent().collectGarbage();
}
_clear() {
if (Runtime.experiments.isEnabled('timelineRuleUsageRecording') && this._markUnusedCSS.get())
Components.CoverageProfile.instance().reset();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment