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 5506797c82a18e1a4e4064d07616a2ee2f5412b5..0c3010859e10694e447a74d06da2fa1cdc764753 100644 |
--- a/third_party/WebKit/Source/devtools/front_end/timeline/TimelinePanel.js |
+++ b/third_party/WebKit/Source/devtools/front_end/timeline/TimelinePanel.js |
@@ -406,24 +406,52 @@ WebInspector.TimelinePanel.prototype = { |
if (Runtime.experiments.isEnabled("cpuThrottling")) { |
this._panelToolbar.appendSeparator(); |
- this._cpuThrottlingCombobox = new WebInspector.ToolbarComboBox(this._onCPUThrottlingChanged.bind(this)); |
- /** |
- * @param {string} name |
- * @param {number} value |
- * @this {WebInspector.TimelinePanel} |
- */ |
- function addGroupingOption(name, value) |
- { |
- var option = this._cpuThrottlingCombobox.createOption(name, "", String(value)); |
- this._cpuThrottlingCombobox.addOption(option); |
- if (value === this._cpuThrottlingManager.rate()) |
- this._cpuThrottlingCombobox.select(option); |
+ this._panelToolbar.appendToolbarItem(this._createCPUThrottlingControl()); |
+ } |
+ }, |
+ |
+ /** |
+ * @return {!WebInspector.ToolbarItem} |
+ */ |
+ _createCPUThrottlingControl: function() |
+ { |
+ var cpuThrottlingManager = this._cpuThrottlingManager; |
+ var cpuThrottlingCombobox = new WebInspector.ToolbarComboBox(this._onCPUThrottlingChanged.bind(this)); |
+ this._cpuThrottlingCombobox = cpuThrottlingCombobox; |
+ /** |
+ * @param {string} name |
+ * @param {number} value |
+ */ |
+ function addGroupingOption(name, value) |
+ { |
+ var option = cpuThrottlingCombobox.createOption(name, "", String(value)); |
+ cpuThrottlingCombobox.addOption(option); |
+ return option; |
+ } |
+ function addSeparator() |
+ { |
+ addGroupingOption("", 0).disabled = true; |
+ } |
+ |
+ cpuThrottlingCombobox.select(addGroupingOption(WebInspector.UIString("No CPU throttling"), 1)); |
+ addSeparator(); |
+ |
+ var hostOctaneScore = WebInspector.settings.createSetting("hostOctaneScore", 0).get(); |
+ if (hostOctaneScore) { |
+ var emulatedDevicesList = WebInspector.EmulatedDevicesList.instance(); |
+ var devices = [].concat(emulatedDevicesList.standard(), emulatedDevicesList.custom()); |
+ for (var device of devices) { |
+ if (!device.octaneScore || device.octaneScore > hostOctaneScore) |
+ continue; |
+ var rate = hostOctaneScore / device.octaneScore; |
+ addGroupingOption(WebInspector.UIString("%s\u2003(%.1fx slowdown)", device.title, rate), rate); |
} |
- addGroupingOption.call(this, WebInspector.UIString("No CPU throttling"), 1); |
- for (var rate of [1.2, 1.5, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 15, 20, 30, 50]) |
- addGroupingOption.call(this, WebInspector.UIString("%fx slowdown", rate), rate); |
- this._panelToolbar.appendToolbarItem(this._cpuThrottlingCombobox); |
+ addSeparator(); |
} |
+ |
+ [1.2, 1.5, 2, 3, 4, 5, 8, 10, 15, 20, 30, 50].forEach(rate => addGroupingOption(WebInspector.UIString("%fx slowdown", rate), rate)); |
+ |
+ return cpuThrottlingCombobox; |
}, |
_prepareToLoadTimeline: function() |