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

Unified Diff: Source/devtools/front_end/TimelinePanel.js

Issue 214443003: DevTools: Start/Stop timeline overview recording for available mode (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebase Created 6 years, 9 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/devtools/front_end/TimelinePanel.js
diff --git a/Source/devtools/front_end/TimelinePanel.js b/Source/devtools/front_end/TimelinePanel.js
index 1f6457db3eb8691756510c60dc493542ea1b4fdc..f71048d0bf32da18f2f61d26854579ad3ac22697 100644
--- a/Source/devtools/front_end/TimelinePanel.js
+++ b/Source/devtools/front_end/TimelinePanel.js
@@ -232,6 +232,24 @@ WebInspector.TimelinePanel.prototype = {
},
/**
+ * @return {!WebInspector.TimelinePanel.Mode}
+ */
+ _availableModes: function()
+ {
+ if (this._modes)
+ return this._modes;
+
+ this._modes = JSON.parse(JSON.stringify(WebInspector.TimelinePanel.Mode));
pfeldman 2014/03/28 09:46:35 It is better to add modes we want in the construct
Pan 2014/03/28 13:01:09 thanks, done.
+ if (!WebInspector.experimentsSettings.timelineFlameChart.isEnabled())
+ delete this._modes.FlameChart;
+
+ if (!Capabilities.canProfilePower)
+ delete this._modes.Power;
+
+ return this._modes;
+ },
+
+ /**
* @return {!WebInspector.TimelineView}
*/
_timelineView: function()
@@ -294,10 +312,7 @@ WebInspector.TimelinePanel.prototype = {
var topPaneSidebarTree = new TreeOutline(overviewTreeElement);
this._overviewItems = {};
- for (var mode in WebInspector.TimelinePanel.Mode) {
- if (mode === WebInspector.TimelinePanel.Mode.FlameChart && !WebInspector.experimentsSettings.timelineFlameChart.isEnabled() ||
- mode === WebInspector.TimelinePanel.Mode.Power && !Capabilities.canProfilePower)
- continue;
+ for (var mode in this._availableModes()) {
this._overviewItems[mode] = new WebInspector.SidebarTreeElement("timeline-overview-sidebar-" + mode.toLowerCase(), WebInspector.UIString(mode));
var item = this._overviewItems[mode];
item.onselect = this._onModeChanged.bind(this, mode);
@@ -558,7 +573,7 @@ WebInspector.TimelinePanel.prototype = {
{
this._userInitiatedRecording = userInitiated;
this._model.startRecording();
- for (var mode in WebInspector.TimelinePanel.Mode)
+ for (var mode in this._availableModes())
this._viewsForMode(mode).overviewView.timelineStarted();
if (userInitiated)
@@ -569,7 +584,7 @@ WebInspector.TimelinePanel.prototype = {
{
this._userInitiatedRecording = false;
this._model.stopRecording();
- for (var mode in WebInspector.TimelinePanel.Mode)
+ for (var mode in this._availableModes())
Pan 2014/03/28 09:16:21 w/o this change, the hidden overviews(FlameChart a
this._viewsForMode(mode).overviewView.timelineStopped();
},
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698