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

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("CountersGraph.js"); 32 importScript("CountersGraph.js");
33 importScript("DOMCountersGraph.js"); 33 importScript("DOMCountersGraph.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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 this._dockSideChanged(); 122 this._dockSideChanged();
122 123
123 this._selectPresentationMode(this._presentationModeSetting.get()); 124 this._selectPresentationMode(this._presentationModeSetting.get());
124 this._detailsSplitView.show(this.element); 125 this._detailsSplitView.show(this.element);
125 } 126 }
126 127
127 WebInspector.TimelinePanel.Mode = { 128 WebInspector.TimelinePanel.Mode = {
128 Events: "Events", 129 Events: "Events",
129 Frames: "Frames", 130 Frames: "Frames",
130 Memory: "Memory", 131 Memory: "Memory",
131 FlameChart: "FlameChart" 132 FlameChart: "FlameChart",
133 Power: "Power"
132 }; 134 };
133 135
134 // Define row and header height, should be in sync with styles for timeline grap hs. 136 // Define row and header height, should be in sync with styles for timeline grap hs.
135 WebInspector.TimelinePanel.rowHeight = 18; 137 WebInspector.TimelinePanel.rowHeight = 18;
136 WebInspector.TimelinePanel.headerHeight = 20; 138 WebInspector.TimelinePanel.headerHeight = 20;
137 139
138 WebInspector.TimelinePanel.durationFilterPresetsMs = [0, 1, 15]; 140 WebInspector.TimelinePanel.durationFilterPresetsMs = [0, 1, 15];
139 141
140 WebInspector.TimelinePanel.prototype = { 142 WebInspector.TimelinePanel.prototype = {
141 wasShown: function() 143 wasShown: function()
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 views.mainViews = [this._timelineView()]; 259 views.mainViews = [this._timelineView()];
258 break; 260 break;
259 case WebInspector.TimelinePanel.Mode.Memory: 261 case WebInspector.TimelinePanel.Mode.Memory:
260 views.overviewView = new WebInspector.TimelineMemoryOverview(thi s._model); 262 views.overviewView = new WebInspector.TimelineMemoryOverview(thi s._model);
261 views.mainViews = [this._timelineView(), new WebInspector.DOMCou ntersGraph(this, this._model)]; 263 views.mainViews = [this._timelineView(), new WebInspector.DOMCou ntersGraph(this, this._model)];
262 break; 264 break;
263 case WebInspector.TimelinePanel.Mode.FlameChart: 265 case WebInspector.TimelinePanel.Mode.FlameChart:
264 views.overviewView = new WebInspector.TimelineFrameOverview(this ._model, this._frameModel()); 266 views.overviewView = new WebInspector.TimelineFrameOverview(this ._model, this._frameModel());
265 views.mainViews = [new WebInspector.TimelineFlameChart(this, thi s._model, this._frameModel())]; 267 views.mainViews = [new WebInspector.TimelineFlameChart(this, thi s._model, this._frameModel())];
266 break; 268 break;
269 case WebInspector.TimelinePanel.Mode.Power:
270 views.overviewView = new WebInspector.TimelinePowerOverview(this ._model);
271 views.mainViews = [this._timelineView()];
272 break;
267 default: 273 default:
268 console.assert(false, "Unknown mode: " + mode); 274 console.assert(false, "Unknown mode: " + mode);
269 } 275 }
270 for (var i = 0; i < views.mainViews.length; ++i) 276 for (var i = 0; i < views.mainViews.length; ++i)
271 views.mainViews[i].addEventListener(WebInspector.SplitView.Event s.SidebarSizeChanged, this._sidebarResized, this); 277 views.mainViews[i].addEventListener(WebInspector.SplitView.Event s.SidebarSizeChanged, this._sidebarResized, this);
272 this._viewsMap[mode] = views; 278 this._viewsMap[mode] = views;
273 } 279 }
274 280
275 this._timelineView().setFrameModel(mode === WebInspector.TimelinePanel.M ode.Frames ? this._frameModel() : null); 281 this._timelineView().setFrameModel(mode === WebInspector.TimelinePanel.M ode.Frames ? this._frameModel() : null);
276 return views; 282 return views;
277 }, 283 },
278 284
279 _createPresentationSelector: function() 285 _createPresentationSelector: function()
280 { 286 {
281 this._viewsMap = {}; 287 this._viewsMap = {};
282 288
283 var topPaneSidebarElement = this._topPane.sidebarElement(); 289 var topPaneSidebarElement = this._topPane.sidebarElement();
284 topPaneSidebarElement.id = "timeline-overview-sidebar"; 290 topPaneSidebarElement.id = "timeline-overview-sidebar";
285 291
286 var overviewTreeElement = topPaneSidebarElement.createChild("ol", "sideb ar-tree vbox"); 292 var overviewTreeElement = topPaneSidebarElement.createChild("ol", "sideb ar-tree vbox");
287 var topPaneSidebarTree = new TreeOutline(overviewTreeElement); 293 var topPaneSidebarTree = new TreeOutline(overviewTreeElement);
288 294
289 this._overviewItems = {}; 295 this._overviewItems = {};
290 for (var mode in WebInspector.TimelinePanel.Mode) { 296 for (var mode in WebInspector.TimelinePanel.Mode) {
291 if (mode === WebInspector.TimelinePanel.Mode.FlameChart && !WebInspe ctor.experimentsSettings.timelineFlameChart.isEnabled()) 297 if (mode === WebInspector.TimelinePanel.Mode.FlameChart && !WebInspe ctor.experimentsSettings.timelineFlameChart.isEnabled() ||
298 mode === WebInspector.TimelinePanel.Mode.Power && !Capabilities. canProfilePower)
292 continue; 299 continue;
293 this._overviewItems[mode] = new WebInspector.SidebarTreeElement("tim eline-overview-sidebar-" + mode.toLowerCase(), WebInspector.UIString(mode)); 300 this._overviewItems[mode] = new WebInspector.SidebarTreeElement("tim eline-overview-sidebar-" + mode.toLowerCase(), WebInspector.UIString(mode));
294 var item = this._overviewItems[mode]; 301 var item = this._overviewItems[mode];
295 item.onselect = this._onModeChanged.bind(this, mode); 302 item.onselect = this._onModeChanged.bind(this, mode);
296 topPaneSidebarTree.appendChild(item); 303 topPaneSidebarTree.appendChild(item);
297 } 304 }
298 }, 305 },
299 306
300 _createStatusBarItems: function() 307 _createStatusBarItems: function()
301 { 308 {
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 this._updateSelectionDetails(); 555 this._updateSelectionDetails();
549 }, 556 },
550 557
551 /** 558 /**
552 * @param {boolean} userInitiated 559 * @param {boolean} userInitiated
553 */ 560 */
554 _startRecording: function(userInitiated) 561 _startRecording: function(userInitiated)
555 { 562 {
556 this._userInitiatedRecording = userInitiated; 563 this._userInitiatedRecording = userInitiated;
557 this._model.startRecording(true); 564 this._model.startRecording(true);
565 for (var mode in WebInspector.TimelinePanel.Mode)
566 this._viewsForMode(mode).overviewView.timelineStarted();
567
558 if (userInitiated) 568 if (userInitiated)
559 WebInspector.userMetrics.TimelineStarted.record(); 569 WebInspector.userMetrics.TimelineStarted.record();
560 }, 570 },
561 571
562 _stopRecording: function() 572 _stopRecording: function()
563 { 573 {
564 this._userInitiatedRecording = false; 574 this._userInitiatedRecording = false;
565 this._model.stopRecording(); 575 this._model.stopRecording();
576 for (var mode in WebInspector.TimelinePanel.Mode)
577 this._viewsForMode(mode).overviewView.timelineStopped();
566 }, 578 },
567 579
568 /** 580 /**
569 * @return {boolean} 581 * @return {boolean}
570 */ 582 */
571 _toggleTimelineButtonClicked: function() 583 _toggleTimelineButtonClicked: function()
572 { 584 {
573 if (this._operationInProgress) 585 if (this._operationInProgress)
574 return true; 586 return true;
575 if (this._recordingInProgress()) 587 if (this._recordingInProgress())
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after
1110 * @param {!WebInspector.TimelineModel.Record} record 1122 * @param {!WebInspector.TimelineModel.Record} record
1111 * @return {boolean} 1123 * @return {boolean}
1112 */ 1124 */
1113 accept: function(record) 1125 accept: function(record)
1114 { 1126 {
1115 return !this._hiddenRecords[record.type]; 1127 return !this._hiddenRecords[record.type];
1116 }, 1128 },
1117 1129
1118 __proto__: WebInspector.TimelineModel.Filter.prototype 1130 __proto__: WebInspector.TimelineModel.Filter.prototype
1119 } 1131 }
OLDNEW
« no previous file with comments | « Source/devtools/front_end/TimelineOverviewPane.js ('k') | Source/devtools/front_end/TimelinePowerOverview.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698