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

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

Issue 325313006: Timeline: show record details as a tabbed pane (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebased Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | Source/devtools/front_end/timelinePanel.css » ('j') | 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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 this._registerShortcuts(); 128 this._registerShortcuts();
129 129
130 WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeMod el.EventTypes.WillReloadPage, this._willReloadPage, this); 130 WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeMod el.EventTypes.WillReloadPage, this._willReloadPage, this);
131 WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeMod el.EventTypes.Load, this._loadEventFired, this); 131 WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeMod el.EventTypes.Load, this._loadEventFired, this);
132 132
133 // Create top level properties splitter. 133 // Create top level properties splitter.
134 this._detailsSplitView = new WebInspector.SplitView(false, true, "timelinePa nelDetailsSplitViewState"); 134 this._detailsSplitView = new WebInspector.SplitView(false, true, "timelinePa nelDetailsSplitViewState");
135 this._detailsSplitView.element.classList.add("timeline-details-split"); 135 this._detailsSplitView.element.classList.add("timeline-details-split");
136 this._detailsSplitView.sidebarElement().classList.add("timeline-details"); 136 this._detailsSplitView.sidebarElement().classList.add("timeline-details");
137 this._detailsView = new WebInspector.TimelineDetailsView(); 137 this._detailsView = new WebInspector.TimelineDetailsView();
138 this._detailsSplitView.installResizer(this._detailsView.titleElement()); 138 this._detailsSplitView.installResizer(this._detailsView.headerElement());
139 this._detailsView.show(this._detailsSplitView.sidebarElement()); 139 this._detailsView.show(this._detailsSplitView.sidebarElement());
140 140
141 this._searchableView = new WebInspector.SearchableView(this); 141 this._searchableView = new WebInspector.SearchableView(this);
142 this._searchableView.setMinimumSize(0, 25); 142 this._searchableView.setMinimumSize(0, 25);
143 this._searchableView.element.classList.add("searchable-view"); 143 this._searchableView.element.classList.add("searchable-view");
144 this._searchableView.show(this._detailsSplitView.mainElement()); 144 this._searchableView.show(this._detailsSplitView.mainElement());
145 145
146 this._stackView = new WebInspector.StackView(false); 146 this._stackView = new WebInspector.StackView(false);
147 this._stackView.show(this._searchableView.element); 147 this._stackView.show(this._searchableView.element);
148 this._stackView.element.classList.add("timeline-view-stack"); 148 this._stackView.element.classList.add("timeline-view-stack");
(...skipping 843 matching lines...) Expand 10 before | Expand all | Expand 10 after
992 } else { 992 } else {
993 WebInspector.TimelineUIUtils.generateDetailsContent(record, this ._model, this._detailsLinkifier, this.showInDetails.bind(this, record.title()), this._model.loadedFromFile()); 993 WebInspector.TimelineUIUtils.generateDetailsContent(record, this ._model, this._detailsLinkifier, this.showInDetails.bind(this, record.title()), this._model.loadedFromFile());
994 } 994 }
995 break; 995 break;
996 case WebInspector.TimelineSelection.Type.TraceEvent: 996 case WebInspector.TimelineSelection.Type.TraceEvent:
997 var event = /** @type {!WebInspector.TracingModel.Event} */ (this._s election.object()); 997 var event = /** @type {!WebInspector.TracingModel.Event} */ (this._s election.object());
998 this._buildSelectionDetailsForTraceEvent(event); 998 this._buildSelectionDetailsForTraceEvent(event);
999 break; 999 break;
1000 case WebInspector.TimelineSelection.Type.Frame: 1000 case WebInspector.TimelineSelection.Type.Frame:
1001 var frame = /** @type {!WebInspector.TimelineFrame} */ (this._select ion.object()); 1001 var frame = /** @type {!WebInspector.TimelineFrame} */ (this._select ion.object());
1002 this.showInDetails(WebInspector.UIString("Frame Statistics"), WebIns pector.TimelineUIUtils.generateDetailsContentForFrame(this._lazyFrameModel, fram e));
1002 if (frame.layerTree) { 1003 if (frame.layerTree) {
1003 var layersView = this._layersView(); 1004 var layersView = this._layersView();
1004 layersView.showLayerTree(frame.layerTree); 1005 layersView.showLayerTree(frame.layerTree);
1005 this._detailsView.setChildView(WebInspector.UIString("Frame Laye rs"), layersView); 1006 this._detailsView.appendTab("layers", WebInspector.UIString("Lay ers"), layersView);
1006 } else {
1007 this.showInDetails(WebInspector.UIString("Frame Statistics"), We bInspector.TimelineUIUtils.generateDetailsContentForFrame(this._lazyFrameModel, frame));
1008 } 1007 }
1009 break; 1008 break;
1010 } 1009 }
1011 }, 1010 },
1012 1011
1013 /** 1012 /**
1014 * @param {!WebInspector.TracingModel.Event} event 1013 * @param {!WebInspector.TracingModel.Event} event
1015 */ 1014 */
1016 _buildSelectionDetailsForTraceEvent: function(event) 1015 _buildSelectionDetailsForTraceEvent: function(event)
1017 { 1016 {
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
1072 if (task.startTime() > endTime) 1071 if (task.startTime() > endTime)
1073 break; 1072 break;
1074 aggregateTimeForRecordWithinWindow(task); 1073 aggregateTimeForRecordWithinWindow(task);
1075 } 1074 }
1076 1075
1077 var aggregatedTotal = 0; 1076 var aggregatedTotal = 0;
1078 for (var categoryName in aggregatedStats) 1077 for (var categoryName in aggregatedStats)
1079 aggregatedTotal += aggregatedStats[categoryName]; 1078 aggregatedTotal += aggregatedStats[categoryName];
1080 aggregatedStats["idle"] = Math.max(0, endTime - startTime - aggregatedTo tal); 1079 aggregatedStats["idle"] = Math.max(0, endTime - startTime - aggregatedTo tal);
1081 1080
1082 var fragment = document.createDocumentFragment(); 1081 var pieChartContainer = document.createElement("div");
1083 fragment.appendChild(WebInspector.TimelineUIUtils.generatePieChart(aggre gatedStats)); 1082 pieChartContainer.classList.add("vbox", "timeline-range-summary");
1084 var startOffset = startTime - this._model.minimumRecordTime(); 1083 var startOffset = startTime - this._model.minimumRecordTime();
1085 var endOffset = endTime - this._model.minimumRecordTime(); 1084 var endOffset = endTime - this._model.minimumRecordTime();
1086 var title = WebInspector.UIString("%s \u2013 %s", Number.millisToString( startOffset), Number.millisToString(endOffset)); 1085 var title = WebInspector.UIString("Range: %s \u2013 %s", Number.millisTo String(startOffset), Number.millisToString(endOffset));
1087 1086
1088 for (var i = 0; i < this._overviewControls.length; ++i) { 1087 for (var i = 0; i < this._overviewControls.length; ++i) {
1089 if (this._overviewControls[i] instanceof WebInspector.TimelinePowerO verview) { 1088 if (this._overviewControls[i] instanceof WebInspector.TimelinePowerO verview) {
1090 var energy = this._overviewControls[i].calculateEnergy(startTime , endTime); 1089 var energy = this._overviewControls[i].calculateEnergy(startTime , endTime);
1091 title += WebInspector.UIString(" Energy: %.2f Joules", energy); 1090 title += WebInspector.UIString(" Energy: %.2f Joules", energy);
1092 break; 1091 break;
1093 } 1092 }
1094 } 1093 }
1095 this.showInDetails(title, fragment); 1094 pieChartContainer.appendChild(document.createTextNode(title));
1095 pieChartContainer.appendChild(WebInspector.TimelineUIUtils.generatePieCh art(aggregatedStats));
1096 this.showInDetails(WebInspector.UIString("Selected Range"), pieChartCont ainer);
1096 }, 1097 },
1097 1098
1098 /** 1099 /**
1099 * @param {?WebInspector.TimelineSelection} selection 1100 * @param {?WebInspector.TimelineSelection} selection
1100 */ 1101 */
1101 select: function(selection) 1102 select: function(selection)
1102 { 1103 {
1103 this._detailsLinkifier.reset(); 1104 this._detailsLinkifier.reset();
1104 this._selection = selection; 1105 this._selection = selection;
1105 1106
(...skipping 11 matching lines...) Expand all
1117 showInDetails: function(title, node) 1118 showInDetails: function(title, node)
1118 { 1119 {
1119 this._detailsView.setContent(title, node); 1120 this._detailsView.setContent(title, node);
1120 }, 1121 },
1121 1122
1122 __proto__: WebInspector.Panel.prototype 1123 __proto__: WebInspector.Panel.prototype
1123 } 1124 }
1124 1125
1125 /** 1126 /**
1126 * @constructor 1127 * @constructor
1127 * @extends {WebInspector.VBox} 1128 * @extends {WebInspector.TabbedPane}
1128 */ 1129 */
1129 WebInspector.TimelineDetailsView = function() 1130 WebInspector.TimelineDetailsView = function()
1130 { 1131 {
1131 WebInspector.VBox.call(this); 1132 WebInspector.TabbedPane.call(this);
1132 this.element.classList.add("timeline-details-view"); 1133
1133 this._titleElement = this.element.createChild("div", "timeline-details-view- title"); 1134 this._defaultDetailsView = new WebInspector.VBox();
1134 this._titleElement.textContent = WebInspector.UIString("DETAILS"); 1135 this._defaultDetailsView.element.classList.add("timeline-details-view");
1135 this._contentElement = this.element.createChild("div", "timeline-details-vie w-body"); 1136 this._defaultDetailsContentElement = this._defaultDetailsView.element.create Child("div", "timeline-details-view-body");
1136 this._currentChildView = null; 1137
1138 this.appendTab("default", WebInspector.UIString("Details"), this._defaultDet ailsView);
1139
1140 this.addEventListener(WebInspector.TabbedPane.EventTypes.TabSelected, this._ tabSelected, this);
1137 } 1141 }
1138 1142
1139 WebInspector.TimelineDetailsView.prototype = { 1143 WebInspector.TimelineDetailsView.prototype = {
1140 /** 1144 /**
1141 * @return {!Element}
1142 */
1143 titleElement: function()
1144 {
1145 return this._titleElement;
1146 },
1147
1148 /**
1149 * @param {string} title 1145 * @param {string} title
1150 * @param {!Node} node 1146 * @param {!Node} node
1151 */ 1147 */
1152 setContent: function(title, node) 1148 setContent: function(title, node)
1153 { 1149 {
1154 this._titleElement.textContent = WebInspector.UIString("DETAILS: %s", ti tle); 1150 this.changeTabTitle("default", WebInspector.UIString("Details: %s", titl e));
1155 this._clearContent(); 1151 var otherTabs = this.otherTabs("default");
1156 this._contentElement.appendChild(node); 1152 for (var i = 0; i < otherTabs.length; ++i)
1157 }, 1153 this.closeTab(otherTabs[i]);
1158 1154 this._defaultDetailsContentElement.removeChildren();
1159 /** 1155 this._defaultDetailsContentElement.appendChild(node);
1160 * @param {string} title
1161 * @param {!WebInspector.View} view
1162 */
1163 setChildView: function(title, view)
1164 {
1165 this._titleElement.textContent = WebInspector.UIString("DETAILS: %s", ti tle);
1166 if (this._currentChildView === view)
1167 return;
1168 this._clearContent();
1169 view.show(this._contentElement);
1170 this._currentChildView = view;
1171 },
1172
1173 _clearContent: function()
1174 {
1175 if (this._currentChildView) {
1176 this._currentChildView.detach();
1177 this._currentChildView = null;
1178 }
1179 this._contentElement.removeChildren();
1180 }, 1156 },
1181 1157
1182 /** 1158 /**
1183 * @param {boolean} vertical 1159 * @param {boolean} vertical
1184 */ 1160 */
1185 setVertical: function(vertical) 1161 setVertical: function(vertical)
1186 { 1162 {
1187 this._contentElement.classList.toggle("hbox", !vertical); 1163 this._defaultDetailsContentElement.classList.toggle("hbox", !vertical);
1188 this._contentElement.classList.toggle("vbox", vertical); 1164 this._defaultDetailsContentElement.classList.toggle("vbox", vertical);
1189 }, 1165 },
1190 1166
1191 __proto__: WebInspector.VBox.prototype 1167 /**
1168 * @param {string} id
1169 * @param {string} tabTitle
1170 * @param {!WebInspector.View} view
1171 * @param {string=} tabTooltip
1172 */
1173 appendTab: function(id, tabTitle, view, tabTooltip)
1174 {
1175 WebInspector.TabbedPane.prototype.appendTab.call(this, id, tabTitle, vie w, tabTooltip);
1176 if (this._lastUserSelectedTabId === id)
1177 this.selectTab(id);
1178 },
1179
1180 _tabSelected: function(event)
1181 {
1182 if (!event.data.isUserGesture)
1183 return;
1184
1185 this._lastUserSelectedTabId = event.data.tabId;
1186 },
1187
1188 __proto__: WebInspector.TabbedPane.prototype
1192 } 1189 }
1193 1190
1194 /** 1191 /**
1195 * @constructor 1192 * @constructor
1196 */ 1193 */
1197 WebInspector.TimelineSelection = function() 1194 WebInspector.TimelineSelection = function()
1198 { 1195 {
1199 } 1196 }
1200 1197
1201 /** 1198 /**
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
1457 * @param {!WebInspector.TimelineModel.Record} record 1454 * @param {!WebInspector.TimelineModel.Record} record
1458 * @return {boolean} 1455 * @return {boolean}
1459 */ 1456 */
1460 accept: function(record) 1457 accept: function(record)
1461 { 1458 {
1462 return !this._hiddenRecords[record.type()]; 1459 return !this._hiddenRecords[record.type()];
1463 }, 1460 },
1464 1461
1465 __proto__: WebInspector.TimelineModel.Filter.prototype 1462 __proto__: WebInspector.TimelineModel.Filter.prototype
1466 } 1463 }
OLDNEW
« no previous file with comments | « no previous file | Source/devtools/front_end/timelinePanel.css » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698