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