Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(583)

Unified Diff: third_party/WebKit/Source/devtools/front_end/timeline/TimelinePanel.js

Issue 2938503002: DevTools: unify Network & CPU throttling (Closed)
Patch Set: fmt Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/devtools/front_end/timeline/TimelinePanel.js
diff --git a/third_party/WebKit/Source/devtools/front_end/timeline/TimelinePanel.js b/third_party/WebKit/Source/devtools/front_end/timeline/TimelinePanel.js
index 9649e8f5cf8be1bb014d5ec12bbbcfe0b3bcb1b3..d83262d9f58234b9456ffea8c9867ad01ef41d23 100644
--- a/third_party/WebKit/Source/devtools/front_end/timeline/TimelinePanel.js
+++ b/third_party/WebKit/Source/devtools/front_end/timeline/TimelinePanel.js
@@ -77,8 +77,6 @@ Timeline.TimelinePanel = class extends UI.Panel {
/** @type {?Timeline.PerformanceModel} */
this._pendingPerformanceModel = null;
- this._cpuThrottlingManager = new MobileThrottling.CPUThrottlingManager();
-
this._viewModeSetting =
Common.settings.createSetting('timelineViewMode', Timeline.TimelinePanel.ViewMode.FlameChart);
@@ -257,8 +255,6 @@ Timeline.TimelinePanel = class extends UI.Panel {
this._showSettingsPaneSetting, 'largeicon-settings-gear', Common.UIString('Capture settings'));
SDK.multitargetNetworkManager.addEventListener(
SDK.MultitargetNetworkManager.Events.ConditionsChanged, this._updateShowSettingsToolbarButton, this);
- this._cpuThrottlingManager.addEventListener(
- MobileThrottling.CPUThrottlingManager.Events.RateChanged, this._updateShowSettingsToolbarButton, this);
this._disableCaptureJSProfileSetting.addChangeListener(this._updateShowSettingsToolbarButton, this);
this._captureLayersAndPicturesSetting.addChangeListener(this._updateShowSettingsToolbarButton, this);
@@ -280,12 +276,11 @@ Timeline.TimelinePanel = class extends UI.Panel {
throttlingPane.element.classList.add('flex-auto');
throttlingPane.show(this._settingsPane.element);
- var throttlingToolbar1 = new UI.Toolbar('', throttlingPane.element);
- throttlingToolbar1.appendText(Common.UIString('Network:'));
- throttlingToolbar1.appendToolbarItem(this._createNetworkConditionsSelect());
- var throttlingToolbar2 = new UI.Toolbar('', throttlingPane.element);
- throttlingToolbar2.appendText(Common.UIString('CPU:'));
- throttlingToolbar2.appendToolbarItem(this._cpuThrottlingManager.createControl());
+ var throttlingToolbar = new UI.Toolbar('', throttlingPane.element);
+ throttlingToolbar.appendText(Common.UIString('Throttling:'));
+ throttlingToolbar.appendToolbarItem(this._createThrottlingSelect());
+ this._throttlingSelector.addEventListener(
+ MobileThrottling.Events.CPURateChanged, this._updateShowSettingsToolbarButton, this);
dgozman 2017/06/13 01:47:08 You actually want to update not only on cpu thrott
chenwilliam 2017/06/13 21:54:52 So I'm tracking the network throttling changes in
dgozman 2017/06/13 23:18:39 Let's have a single event and update only once. If
this._showSettingsPaneSetting.addChangeListener(this._updateSettingsPaneVisibility.bind(this));
this._updateSettingsPaneVisibility();
@@ -319,10 +314,10 @@ Timeline.TimelinePanel = class extends UI.Panel {
/**
* @return {!UI.ToolbarComboBox}
*/
- _createNetworkConditionsSelect() {
+ _createThrottlingSelect() {
dgozman 2017/06/13 01:47:09 Inline it.
chenwilliam 2017/06/13 21:54:52 Done.
var toolbarItem = new UI.ToolbarComboBox(null);
- toolbarItem.setMaxWidth(140);
- MobileThrottling.NetworkConditionsSelector.decorateSelect(toolbarItem.selectElement());
+ toolbarItem.setMaxWidth(160);
+ this._throttlingSelector = MobileThrottling.ThrottlingSelector.decorateSelect(toolbarItem.selectElement());
return toolbarItem;
}
@@ -498,7 +493,7 @@ Timeline.TimelinePanel = class extends UI.Panel {
_updateShowSettingsToolbarButton() {
var messages = [];
- if (this._cpuThrottlingManager.rate() !== 1)
+ if (this._throttlingSelector.cpuThrottlingRate() !== 1)
messages.push(Common.UIString('- CPU throttling is enabled'));
if (SDK.multitargetNetworkManager.isThrottling())
messages.push(Common.UIString('- Network throttling is enabled'));

Powered by Google App Engine
This is Rietveld 408576698