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

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: 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
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.powerTimeline.isEnabled() || !Capabilities.canProfilePower) )
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 823 matching lines...) Expand 10 before | Expand all | Expand 10 after
1128 this._hiddenRecords[WebInspector.TimelineModel.RecordType.MarkDOMContent] = 1; 1136 this._hiddenRecords[WebInspector.TimelineModel.RecordType.MarkDOMContent] = 1;
1129 this._hiddenRecords[WebInspector.TimelineModel.RecordType.MarkLoad] = 1; 1137 this._hiddenRecords[WebInspector.TimelineModel.RecordType.MarkLoad] = 1;
1130 this._hiddenRecords[WebInspector.TimelineModel.RecordType.MarkFirstPaint] = 1; 1138 this._hiddenRecords[WebInspector.TimelineModel.RecordType.MarkFirstPaint] = 1;
1131 this._hiddenRecords[WebInspector.TimelineModel.RecordType.GPUTask] = 1; 1139 this._hiddenRecords[WebInspector.TimelineModel.RecordType.GPUTask] = 1;
1132 this._hiddenRecords[WebInspector.TimelineModel.RecordType.ScheduleStyleRecal culation] = 1; 1140 this._hiddenRecords[WebInspector.TimelineModel.RecordType.ScheduleStyleRecal culation] = 1;
1133 this._hiddenRecords[WebInspector.TimelineModel.RecordType.InvalidateLayout] = 1; 1141 this._hiddenRecords[WebInspector.TimelineModel.RecordType.InvalidateLayout] = 1;
1134 this._hiddenRecords[WebInspector.TimelineModel.RecordType.RequestMainThreadF rame] = 1; 1142 this._hiddenRecords[WebInspector.TimelineModel.RecordType.RequestMainThreadF rame] = 1;
1135 this._hiddenRecords[WebInspector.TimelineModel.RecordType.ActivateLayerTree] = 1; 1143 this._hiddenRecords[WebInspector.TimelineModel.RecordType.ActivateLayerTree] = 1;
1136 this._hiddenRecords[WebInspector.TimelineModel.RecordType.DrawFrame] = 1; 1144 this._hiddenRecords[WebInspector.TimelineModel.RecordType.DrawFrame] = 1;
1137 this._hiddenRecords[WebInspector.TimelineModel.RecordType.BeginFrame] = 1; 1145 this._hiddenRecords[WebInspector.TimelineModel.RecordType.BeginFrame] = 1;
1146 this._hiddenRecords[WebInspector.TimelineModel.RecordType.SoC_Package] = 1;
1138 } 1147 }
1139 1148
1140 WebInspector.TimelineHiddenFilter.prototype = { 1149 WebInspector.TimelineHiddenFilter.prototype = {
1141 /** 1150 /**
1142 * @param {!WebInspector.TimelineModel.Record} record 1151 * @param {!WebInspector.TimelineModel.Record} record
1143 * @return {boolean} 1152 * @return {boolean}
1144 */ 1153 */
1145 accept: function(record) 1154 accept: function(record)
1146 { 1155 {
1147 return !this._hiddenRecords[record.type]; 1156 return !this._hiddenRecords[record.type];
1148 }, 1157 },
1149 1158
1150 __proto__: WebInspector.TimelineModel.Filter.prototype 1159 __proto__: WebInspector.TimelineModel.Filter.prototype
1151 } 1160 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698