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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * Copyright (C) 2012 Intel Inc. All rights reserved. 3 * Copyright (C) 2012 Intel Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 * @return {!WebInspector.TimelineFrameModel} 225 * @return {!WebInspector.TimelineFrameModel}
226 */ 226 */
227 _frameModel: function() 227 _frameModel: function()
228 { 228 {
229 if (!this._lazyFrameModel) 229 if (!this._lazyFrameModel)
230 this._lazyFrameModel = new WebInspector.TimelineFrameModel(this._mod el); 230 this._lazyFrameModel = new WebInspector.TimelineFrameModel(this._mod el);
231 return this._lazyFrameModel; 231 return this._lazyFrameModel;
232 }, 232 },
233 233
234 /** 234 /**
235 * @return {!WebInspector.TimelinePanel.Mode}
236 */
237 _availableModes: function()
238 {
239 if (this._modes)
240 return this._modes;
241
242 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.
243 if (!WebInspector.experimentsSettings.timelineFlameChart.isEnabled())
244 delete this._modes.FlameChart;
245
246 if (!Capabilities.canProfilePower)
247 delete this._modes.Power;
248
249 return this._modes;
250 },
251
252 /**
235 * @return {!WebInspector.TimelineView} 253 * @return {!WebInspector.TimelineView}
236 */ 254 */
237 _timelineView: function() 255 _timelineView: function()
238 { 256 {
239 if (!this._lazyTimelineView) 257 if (!this._lazyTimelineView)
240 this._lazyTimelineView = new WebInspector.TimelineView(this, this._m odel); 258 this._lazyTimelineView = new WebInspector.TimelineView(this, this._m odel);
241 return this._lazyTimelineView; 259 return this._lazyTimelineView;
242 }, 260 },
243 261
244 /** 262 /**
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 { 305 {
288 this._viewsMap = {}; 306 this._viewsMap = {};
289 307
290 var topPaneSidebarElement = this._topPane.sidebarElement(); 308 var topPaneSidebarElement = this._topPane.sidebarElement();
291 topPaneSidebarElement.id = "timeline-overview-sidebar"; 309 topPaneSidebarElement.id = "timeline-overview-sidebar";
292 310
293 var overviewTreeElement = topPaneSidebarElement.createChild("ol", "sideb ar-tree vbox"); 311 var overviewTreeElement = topPaneSidebarElement.createChild("ol", "sideb ar-tree vbox");
294 var topPaneSidebarTree = new TreeOutline(overviewTreeElement); 312 var topPaneSidebarTree = new TreeOutline(overviewTreeElement);
295 313
296 this._overviewItems = {}; 314 this._overviewItems = {};
297 for (var mode in WebInspector.TimelinePanel.Mode) { 315 for (var mode in this._availableModes()) {
298 if (mode === WebInspector.TimelinePanel.Mode.FlameChart && !WebInspe ctor.experimentsSettings.timelineFlameChart.isEnabled() ||
299 mode === WebInspector.TimelinePanel.Mode.Power && !Capabilities. canProfilePower)
300 continue;
301 this._overviewItems[mode] = new WebInspector.SidebarTreeElement("tim eline-overview-sidebar-" + mode.toLowerCase(), WebInspector.UIString(mode)); 316 this._overviewItems[mode] = new WebInspector.SidebarTreeElement("tim eline-overview-sidebar-" + mode.toLowerCase(), WebInspector.UIString(mode));
302 var item = this._overviewItems[mode]; 317 var item = this._overviewItems[mode];
303 item.onselect = this._onModeChanged.bind(this, mode); 318 item.onselect = this._onModeChanged.bind(this, mode);
304 topPaneSidebarTree.appendChild(item); 319 topPaneSidebarTree.appendChild(item);
305 } 320 }
306 }, 321 },
307 322
308 _createStatusBarItems: function() 323 _createStatusBarItems: function()
309 { 324 {
310 var panelStatusBarElement = this.element.createChild("div", "panel-statu s-bar"); 325 var panelStatusBarElement = this.element.createChild("div", "panel-statu s-bar");
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
551 this._updateSelectionDetails(); 566 this._updateSelectionDetails();
552 }, 567 },
553 568
554 /** 569 /**
555 * @param {boolean} userInitiated 570 * @param {boolean} userInitiated
556 */ 571 */
557 _startRecording: function(userInitiated) 572 _startRecording: function(userInitiated)
558 { 573 {
559 this._userInitiatedRecording = userInitiated; 574 this._userInitiatedRecording = userInitiated;
560 this._model.startRecording(); 575 this._model.startRecording();
561 for (var mode in WebInspector.TimelinePanel.Mode) 576 for (var mode in this._availableModes())
562 this._viewsForMode(mode).overviewView.timelineStarted(); 577 this._viewsForMode(mode).overviewView.timelineStarted();
563 578
564 if (userInitiated) 579 if (userInitiated)
565 WebInspector.userMetrics.TimelineStarted.record(); 580 WebInspector.userMetrics.TimelineStarted.record();
566 }, 581 },
567 582
568 _stopRecording: function() 583 _stopRecording: function()
569 { 584 {
570 this._userInitiatedRecording = false; 585 this._userInitiatedRecording = false;
571 this._model.stopRecording(); 586 this._model.stopRecording();
572 for (var mode in WebInspector.TimelinePanel.Mode) 587 for (var mode in this._availableModes())
Pan 2014/03/28 09:16:21 w/o this change, the hidden overviews(FlameChart a
573 this._viewsForMode(mode).overviewView.timelineStopped(); 588 this._viewsForMode(mode).overviewView.timelineStopped();
574 }, 589 },
575 590
576 /** 591 /**
577 * @return {boolean} 592 * @return {boolean}
578 */ 593 */
579 _toggleTimelineButtonClicked: function() 594 _toggleTimelineButtonClicked: function()
580 { 595 {
581 if (this._operationInProgress) 596 if (this._operationInProgress)
582 return true; 597 return true;
(...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after
1147 * @param {!WebInspector.TimelineModel.Record} record 1162 * @param {!WebInspector.TimelineModel.Record} record
1148 * @return {boolean} 1163 * @return {boolean}
1149 */ 1164 */
1150 accept: function(record) 1165 accept: function(record)
1151 { 1166 {
1152 return !this._hiddenRecords[record.type]; 1167 return !this._hiddenRecords[record.type];
1153 }, 1168 },
1154 1169
1155 __proto__: WebInspector.TimelineModel.Filter.prototype 1170 __proto__: WebInspector.TimelineModel.Filter.prototype
1156 } 1171 }
OLDNEW
« 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