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

Side by Side Diff: Source/devtools/front_end/TimelinePanel.js

Issue 104523002: [DevTools] Add power profiler and power overview in timeline panel. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 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
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 21 matching lines...) Expand all
32 importScript("MemoryStatistics.js"); 32 importScript("MemoryStatistics.js");
33 importScript("CountersGraph.js"); 33 importScript("CountersGraph.js");
34 importScript("PieChart.js"); 34 importScript("PieChart.js");
35 importScript("TimelineModel.js"); 35 importScript("TimelineModel.js");
36 importScript("TimelineOverviewPane.js"); 36 importScript("TimelineOverviewPane.js");
37 importScript("TimelinePresentationModel.js"); 37 importScript("TimelinePresentationModel.js");
38 importScript("TimelineFrameModel.js"); 38 importScript("TimelineFrameModel.js");
39 importScript("TimelineEventOverview.js"); 39 importScript("TimelineEventOverview.js");
40 importScript("TimelineFrameOverview.js"); 40 importScript("TimelineFrameOverview.js");
41 importScript("TimelineMemoryOverview.js"); 41 importScript("TimelineMemoryOverview.js");
42 importScript("TimelinePowerOverview.js");
42 importScript("TimelineFlameChart.js"); 43 importScript("TimelineFlameChart.js");
43 importScript("TimelineUIUtils.js"); 44 importScript("TimelineUIUtils.js");
44 importScript("TimelineView.js"); 45 importScript("TimelineView.js");
45 46
46 /** 47 /**
47 * @constructor 48 * @constructor
48 * @extends {WebInspector.Panel} 49 * @extends {WebInspector.Panel}
49 * @implements {WebInspector.TimelineModeViewDelegate} 50 * @implements {WebInspector.TimelineModeViewDelegate}
50 * @implements {WebInspector.Searchable} 51 * @implements {WebInspector.Searchable}
51 */ 52 */
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 this._dockSideChanged(); 124 this._dockSideChanged();
124 125
125 this._selectPresentationMode(this._presentationModeSetting.get()); 126 this._selectPresentationMode(this._presentationModeSetting.get());
126 this._detailsSplitView.show(this.element); 127 this._detailsSplitView.show(this.element);
127 } 128 }
128 129
129 WebInspector.TimelinePanel.Mode = { 130 WebInspector.TimelinePanel.Mode = {
130 Events: "Events", 131 Events: "Events",
131 Frames: "Frames", 132 Frames: "Frames",
132 Memory: "Memory", 133 Memory: "Memory",
133 FlameChart: "FlameChart" 134 FlameChart: "FlameChart",
135 Power: "Power"
134 }; 136 };
135 137
136 // Define row and header height, should be in sync with styles for timeline grap hs. 138 // Define row and header height, should be in sync with styles for timeline grap hs.
137 WebInspector.TimelinePanel.rowHeight = 18; 139 WebInspector.TimelinePanel.rowHeight = 18;
138 WebInspector.TimelinePanel.headerHeight = 20; 140 WebInspector.TimelinePanel.headerHeight = 20;
139 141
140 WebInspector.TimelinePanel.durationFilterPresetsMs = [0, 1, 15]; 142 WebInspector.TimelinePanel.durationFilterPresetsMs = [0, 1, 15];
141 143
142 WebInspector.TimelinePanel.prototype = { 144 WebInspector.TimelinePanel.prototype = {
143 wasShown: function() 145 wasShown: function()
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 break; 264 break;
263 case WebInspector.TimelinePanel.Mode.Memory: 265 case WebInspector.TimelinePanel.Mode.Memory:
264 views.overviewView = new WebInspector.TimelineMemoryOverview(thi s._model); 266 views.overviewView = new WebInspector.TimelineMemoryOverview(thi s._model);
265 this._timelineView().setFrameModel(null); 267 this._timelineView().setFrameModel(null);
266 views.mainViews = [this._timelineView(), new WebInspector.Counte rsGraph(this, this._model)]; 268 views.mainViews = [this._timelineView(), new WebInspector.Counte rsGraph(this, this._model)];
267 break; 269 break;
268 case WebInspector.TimelinePanel.Mode.FlameChart: 270 case WebInspector.TimelinePanel.Mode.FlameChart:
269 views.overviewView = new WebInspector.TimelineFrameOverview(this ._model, this._frameModel()); 271 views.overviewView = new WebInspector.TimelineFrameOverview(this ._model, this._frameModel());
270 views.mainViews = [new WebInspector.TimelineFlameChart(this, thi s._model, this._frameModel())]; 272 views.mainViews = [new WebInspector.TimelineFlameChart(this, thi s._model, this._frameModel())];
271 break; 273 break;
274 case WebInspector.TimelinePanel.Mode.Power:
275 views.overviewView = new WebInspector.TimelinePowerOverview(this ._model);
276 views.mainViews = [this._timelineView()];
277 break;
272 default: 278 default:
273 console.assert(false, "Unknown mode: " + mode); 279 console.assert(false, "Unknown mode: " + mode);
274 } 280 }
275 for (var i = 0; i < views.mainViews.length; ++i) 281 for (var i = 0; i < views.mainViews.length; ++i)
276 views.mainViews[i].addEventListener(WebInspector.SplitView.Event s.SidebarSizeChanged, this._sidebarResized, this); 282 views.mainViews[i].addEventListener(WebInspector.SplitView.Event s.SidebarSizeChanged, this._sidebarResized, this);
277 this._viewsMap[mode] = views; 283 this._viewsMap[mode] = views;
278 } 284 }
279 return views; 285 return views;
280 }, 286 },
281 287
282 _createPresentationSelector: function() 288 _createPresentationSelector: function()
283 { 289 {
284 this._viewsMap = {}; 290 this._viewsMap = {};
285 291
286 var topPaneSidebarElement = this._topPane.sidebarElement(); 292 var topPaneSidebarElement = this._topPane.sidebarElement();
287 topPaneSidebarElement.id = "timeline-overview-sidebar"; 293 topPaneSidebarElement.id = "timeline-overview-sidebar";
288 294
289 var overviewTreeElement = topPaneSidebarElement.createChild("ol", "sideb ar-tree vbox"); 295 var overviewTreeElement = topPaneSidebarElement.createChild("ol", "sideb ar-tree vbox");
290 var topPaneSidebarTree = new TreeOutline(overviewTreeElement); 296 var topPaneSidebarTree = new TreeOutline(overviewTreeElement);
291 297
292 this._overviewItems = {}; 298 this._overviewItems = {};
299
293 for (var mode in WebInspector.TimelinePanel.Mode) { 300 for (var mode in WebInspector.TimelinePanel.Mode) {
294 if (mode === WebInspector.TimelinePanel.Mode.FlameChart && !WebInspe ctor.experimentsSettings.timelineFlameChart.isEnabled()) 301 if (mode === WebInspector.TimelinePanel.Mode.FlameChart && !WebInspe ctor.experimentsSettings.timelineFlameChart.isEnabled() ||
302 mode === WebInspector.TimelinePanel.Mode.Power && (!WebInspector .experimentsSettings.powerProfiler.isEnabled() || !Capabilities.canProfilePower) )
pfeldman 2014/03/24 13:41:25 No need to check for experiment here since you onl
Pan 2014/03/25 12:30:20 Done.
295 continue; 303 continue;
296 this._overviewItems[mode] = new WebInspector.SidebarTreeElement("tim eline-overview-sidebar-" + mode.toLowerCase(), WebInspector.UIString(mode)); 304 this._overviewItems[mode] = new WebInspector.SidebarTreeElement("tim eline-overview-sidebar-" + mode.toLowerCase(), WebInspector.UIString(mode));
297 var item = this._overviewItems[mode]; 305 var item = this._overviewItems[mode];
298 item.onselect = this._onModeChanged.bind(this, mode); 306 item.onselect = this._onModeChanged.bind(this, mode);
299 topPaneSidebarTree.appendChild(item); 307 topPaneSidebarTree.appendChild(item);
300 } 308 }
301 }, 309 },
302 310
303 _createStatusBarItems: function() 311 _createStatusBarItems: function()
304 { 312 {
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
544 this._updateSelectionDetails(); 552 this._updateSelectionDetails();
545 }, 553 },
546 554
547 /** 555 /**
548 * @param {boolean} userInitiated 556 * @param {boolean} userInitiated
549 */ 557 */
550 _startRecording: function(userInitiated) 558 _startRecording: function(userInitiated)
551 { 559 {
552 this._userInitiatedRecording = userInitiated; 560 this._userInitiatedRecording = userInitiated;
553 this._model.startRecording(true); 561 this._model.startRecording(true);
562 this._viewsForMode(WebInspector.TimelinePanel.Mode.Power).overviewView.s tartTimeline();
pfeldman 2014/03/24 13:41:25 this._currentViews.overviewView.timelineStarted();
Pan 2014/03/25 12:30:20 Done.
554 if (userInitiated) 563 if (userInitiated)
555 WebInspector.userMetrics.TimelineStarted.record(); 564 WebInspector.userMetrics.TimelineStarted.record();
556 }, 565 },
557 566
558 _stopRecording: function() 567 _stopRecording: function()
559 { 568 {
560 this._userInitiatedRecording = false; 569 this._userInitiatedRecording = false;
561 this._model.stopRecording(); 570 this._model.stopRecording();
571 this._viewsForMode(WebInspector.TimelinePanel.Mode.Power).overviewView.s topTimeline();
pfeldman 2014/03/24 13:41:25 ...Stopped
Pan 2014/03/25 12:30:20 Done.
562 }, 572 },
563 573
564 /** 574 /**
565 * @return {boolean} 575 * @return {boolean}
566 */ 576 */
567 _toggleTimelineButtonClicked: function() 577 _toggleTimelineButtonClicked: function()
568 { 578 {
569 if (this._operationInProgress) 579 if (this._operationInProgress)
570 return true; 580 return true;
571 if (this._recordingInProgress()) 581 if (this._recordingInProgress())
(...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after
1142 * @param {!WebInspector.TimelineModel.Record} record 1152 * @param {!WebInspector.TimelineModel.Record} record
1143 * @return {boolean} 1153 * @return {boolean}
1144 */ 1154 */
1145 accept: function(record) 1155 accept: function(record)
1146 { 1156 {
1147 return !this._hiddenRecords[record.type]; 1157 return !this._hiddenRecords[record.type];
1148 }, 1158 },
1149 1159
1150 __proto__: WebInspector.TimelineModel.Filter.prototype 1160 __proto__: WebInspector.TimelineModel.Filter.prototype
1151 } 1161 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698