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

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

Issue 2938503002: DevTools: unify Network & CPU throttling (Closed)
Patch Set: rebaseline 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 ab052efc448728642903b0905706e847ee3a6266..7a0a3745ac32a688701b9e244641aeb561052ad8 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);
@@ -258,8 +256,7 @@ 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);
+ MobileThrottling.cpuThrottlingRateSetting().addChangeListener(this._updateShowSettingsToolbarButton, this);
this._disableCaptureJSProfileSetting.addChangeListener(this._updateShowSettingsToolbarButton, this);
this._captureLayersAndPicturesSetting.addChangeListener(this._updateShowSettingsToolbarButton, this);
@@ -281,12 +278,15 @@ 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 networkThrottlingToolbar = new UI.Toolbar('', throttlingPane.element);
+ networkThrottlingToolbar.appendText(Common.UIString('Network:'));
+ this._networkThrottlingRefForTest = this._createNetworkConditionsSelect();
dgozman 2017/06/28 22:33:09 Just call it this._networkThrottlingSelect
chenwilliam 2017/06/29 20:34:02 Done.
+ networkThrottlingToolbar.appendToolbarItem(this._networkThrottlingRefForTest);
+
+ var cpuThrottlingToolbar = new UI.Toolbar('', throttlingPane.element);
+ cpuThrottlingToolbar.appendText(Common.UIString('CPU:'));
+ this._cpuThrottlingRefForTest = MobileThrottling.cpuThrottlingManager.createControl();
dgozman 2017/06/28 22:33:09 If you create control through a manager, you shoul
chenwilliam 2017/06/29 20:34:02 Done.
+ cpuThrottlingToolbar.appendToolbarItem(this._cpuThrottlingRefForTest);
this._showSettingsPaneSetting.addChangeListener(this._updateSettingsPaneVisibility.bind(this));
this._updateSettingsPaneVisibility();
@@ -323,10 +323,11 @@ Timeline.TimelinePanel = class extends UI.Panel {
_createNetworkConditionsSelect() {
var toolbarItem = new UI.ToolbarComboBox(null);
toolbarItem.setMaxWidth(140);
- MobileThrottling.NetworkConditionsSelector.decorateSelect(toolbarItem.selectElement());
+ MobileThrottling.NetworkThrottlingSelector.decorateSelect(toolbarItem.selectElement());
return toolbarItem;
}
+
_prepareToLoadTimeline() {
console.assert(this._state === Timeline.TimelinePanel.State.Idle);
this._setState(Timeline.TimelinePanel.State.Loading);
@@ -498,7 +499,7 @@ Timeline.TimelinePanel = class extends UI.Panel {
_updateShowSettingsToolbarButton() {
var messages = [];
- if (this._cpuThrottlingManager.rate() !== 1)
+ if (MobileThrottling.cpuThrottlingRateSetting().get() !== 1)
dgozman 2017/06/28 22:33:09 MobileThrottling.cpuThrottlingManager.rate()
chenwilliam 2017/06/29 20:34:02 Done.
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