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 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 /** | 217 /** |
218 * @param {!WebInspector.Event} event | 218 * @param {!WebInspector.Event} event |
219 */ | 219 */ |
220 _onWindowChanged: function(event) | 220 _onWindowChanged: function(event) |
221 { | 221 { |
222 this._windowStartTime = event.data.startTime; | 222 this._windowStartTime = event.data.startTime; |
223 this._windowEndTime = event.data.endTime; | 223 this._windowEndTime = event.data.endTime; |
224 | 224 |
225 for (var i = 0; i < this._currentViews.length; ++i) | 225 for (var i = 0; i < this._currentViews.length; ++i) |
226 this._currentViews[i].setWindowTimes(this._windowStartTime, this._wi
ndowEndTime); | 226 this._currentViews[i].setWindowTimes(this._windowStartTime, this._wi
ndowEndTime); |
227 this._updateSelectionDetails(); | 227 this._updateSelectedRangeStats(); |
228 }, | 228 }, |
229 | 229 |
230 /** | 230 /** |
231 * @param {number} windowStartTime | 231 * @param {number} windowStartTime |
232 * @param {number} windowEndTime | 232 * @param {number} windowEndTime |
233 */ | 233 */ |
234 requestWindowTimes: function(windowStartTime, windowEndTime) | 234 requestWindowTimes: function(windowStartTime, windowEndTime) |
235 { | 235 { |
236 this._overviewPane.requestWindowTimes(windowStartTime, windowEndTime); | 236 this._overviewPane.requestWindowTimes(windowStartTime, windowEndTime); |
237 }, | 237 }, |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
544 return; | 544 return; |
545 this._model.loadFromURL(url, progressIndicator); | 545 this._model.loadFromURL(url, progressIndicator); |
546 }, | 546 }, |
547 | 547 |
548 _refreshViews: function() | 548 _refreshViews: function() |
549 { | 549 { |
550 for (var i = 0; i < this._currentViews.length; ++i) { | 550 for (var i = 0; i < this._currentViews.length; ++i) { |
551 var view = this._currentViews[i]; | 551 var view = this._currentViews[i]; |
552 view.refreshRecords(this._textFilter._regex); | 552 view.refreshRecords(this._textFilter._regex); |
553 } | 553 } |
554 this._updateSelectionDetails(); | 554 this._updateSelectedRangeStats(); |
555 }, | 555 }, |
556 | 556 |
557 /** | 557 /** |
558 * @param {!WebInspector.StatusBarButton} button | 558 * @param {!WebInspector.StatusBarButton} button |
559 */ | 559 */ |
560 _overviewModeChanged: function(button) | 560 _overviewModeChanged: function(button) |
561 { | 561 { |
562 var oldMode = this._overviewModeSetting.get(); | 562 var oldMode = this._overviewModeSetting.get(); |
563 if (oldMode === WebInspector.TimelinePanel.OverviewMode.Events) { | 563 if (oldMode === WebInspector.TimelinePanel.OverviewMode.Events) { |
564 this._overviewModeSetting.set(WebInspector.TimelinePanel.OverviewMod
e.Frames); | 564 this._overviewModeSetting.set(WebInspector.TimelinePanel.OverviewMod
e.Frames); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
611 this._overviewControls.push(new WebInspector.TimelinePowerOvervi
ew(this._model)); | 611 this._overviewControls.push(new WebInspector.TimelinePowerOvervi
ew(this._model)); |
612 this._addModeView(new WebInspector.TimelinePowerGraph(this, this._mo
del)); | 612 this._addModeView(new WebInspector.TimelinePowerGraph(this, this._mo
del)); |
613 } | 613 } |
614 | 614 |
615 if (this._captureTracingSetting && this._captureTracingSetting.get()) | 615 if (this._captureTracingSetting && this._captureTracingSetting.get()) |
616 this._addModeView(new WebInspector.TimelineTracingView(this, this._t
racingModel())); | 616 this._addModeView(new WebInspector.TimelineTracingView(this, this._t
racingModel())); |
617 | 617 |
618 this._timelineView().setFrameModel(isFrameMode ? this._frameModel() : nu
ll); | 618 this._timelineView().setFrameModel(isFrameMode ? this._frameModel() : nu
ll); |
619 this._overviewPane.setOverviewControls(this._overviewControls); | 619 this._overviewPane.setOverviewControls(this._overviewControls); |
620 this.doResize(); | 620 this.doResize(); |
621 this._updateSelectionDetails(); | 621 this._updateSelectedRangeStats(); |
622 | 622 |
623 this._stackView.show(this._searchableView.element); | 623 this._stackView.show(this._searchableView.element); |
624 }, | 624 }, |
625 | 625 |
626 /** | 626 /** |
627 * @param {boolean} userInitiated | 627 * @param {boolean} userInitiated |
628 */ | 628 */ |
629 _startRecording: function(userInitiated) | 629 _startRecording: function(userInitiated) |
630 { | 630 { |
631 this._userInitiatedRecording = userInitiated; | 631 this._userInitiatedRecording = userInitiated; |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
703 }, | 703 }, |
704 | 704 |
705 _onClearButtonClick: function() | 705 _onClearButtonClick: function() |
706 { | 706 { |
707 this._model.reset(); | 707 this._model.reset(); |
708 }, | 708 }, |
709 | 709 |
710 _onRecordsCleared: function() | 710 _onRecordsCleared: function() |
711 { | 711 { |
712 this.requestWindowTimes(0, Infinity); | 712 this.requestWindowTimes(0, Infinity); |
713 delete this._selectedRecord; | 713 delete this._selection; |
714 if (this._lazyFrameModel) | 714 if (this._lazyFrameModel) |
715 this._lazyFrameModel.reset(); | 715 this._lazyFrameModel.reset(); |
716 for (var i = 0; i < this._currentViews.length; ++i) | 716 for (var i = 0; i < this._currentViews.length; ++i) |
717 this._currentViews[i].reset(); | 717 this._currentViews[i].reset(); |
718 for (var i = 0; i < this._overviewControls.length; ++i) | 718 for (var i = 0; i < this._overviewControls.length; ++i) |
719 this._overviewControls[i].reset(); | 719 this._overviewControls[i].reset(); |
720 this._updateSelectionDetails(); | 720 this._updateSelectedRangeStats(); |
721 }, | 721 }, |
722 | 722 |
723 _onRecordingStarted: function() | 723 _onRecordingStarted: function() |
724 { | 724 { |
725 this._updateToggleTimelineButton(true); | 725 this._updateToggleTimelineButton(true); |
726 if (WebInspector.experimentsSettings.timelineNoLiveUpdate.isEnabled()) | 726 if (WebInspector.experimentsSettings.timelineNoLiveUpdate.isEnabled()) |
727 this._updateProgress(WebInspector.UIString("%d events collected", 0)
); | 727 this._updateProgress(WebInspector.UIString("%d events collected", 0)
); |
728 }, | 728 }, |
729 | 729 |
730 _recordingInProgress: function() | 730 _recordingInProgress: function() |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
926 */ | 926 */ |
927 performSearch: function(query, shouldJump, jumpBackwards) | 927 performSearch: function(query, shouldJump, jumpBackwards) |
928 { | 928 { |
929 this._searchRegex = createPlainTextSearchRegex(query, "i"); | 929 this._searchRegex = createPlainTextSearchRegex(query, "i"); |
930 delete this._searchResults; | 930 delete this._searchResults; |
931 this._updateSearchHighlight(true, shouldJump, jumpBackwards); | 931 this._updateSearchHighlight(true, shouldJump, jumpBackwards); |
932 }, | 932 }, |
933 | 933 |
934 _updateSelectionDetails: function() | 934 _updateSelectionDetails: function() |
935 { | 935 { |
936 if (this._selectedRecord) | 936 if (!this._selection) { |
| 937 this._updateSelectedRangeStats(); |
| 938 return; |
| 939 } |
| 940 if (this._selection.type() === WebInspector.TimelineSelection.Type.Recor
d) { |
| 941 var record = /** @type {!WebInspector.TimelineModel.Record} */ (this
._selection.object()); |
| 942 WebInspector.TimelineUIUtils.generatePopupContent(record, this._mode
l, this._detailsLinkifier, showCallback.bind(this), this._model.loadedFromFile()
); |
| 943 } else if (this._selection.type() === WebInspector.TimelineSelection.Typ
e.Frame) { |
| 944 var frame = /** @type {!WebInspector.TimelineFrame} */ (this._select
ion.object()); |
| 945 this._detailsView.setContent(WebInspector.UIString("Frame Statistics
"), WebInspector.TimelineUIUtils.generatePopupContentForFrame(frame)); |
| 946 } |
| 947 |
| 948 /** |
| 949 * @param {!DocumentFragment} element |
| 950 * @this {WebInspector.TimelinePanel} |
| 951 */ |
| 952 function showCallback(element) |
| 953 { |
| 954 this._detailsView.setContent(record.title(), element); |
| 955 } |
| 956 }, |
| 957 |
| 958 _updateSelectedRangeStats: function() |
| 959 { |
| 960 if (this._selection) |
937 return; | 961 return; |
938 | 962 |
939 var startTime = this._windowStartTime; | 963 var startTime = this._windowStartTime; |
940 var endTime = this._windowEndTime; | 964 var endTime = this._windowEndTime; |
941 | 965 |
942 // Return early in case 0 selection window. | 966 // Return early in case 0 selection window. |
943 if (startTime < 0) | 967 if (startTime < 0) |
944 return; | 968 return; |
945 | 969 |
946 var aggregatedStats = {}; | 970 var aggregatedStats = {}; |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1001 if (this._overviewControls[i] instanceof WebInspector.TimelinePowerO
verview) { | 1025 if (this._overviewControls[i] instanceof WebInspector.TimelinePowerO
verview) { |
1002 var energy = this._overviewControls[i].calculateEnergy(startTime
, endTime); | 1026 var energy = this._overviewControls[i].calculateEnergy(startTime
, endTime); |
1003 title += WebInspector.UIString(" Energy: %.2f Joules", energy); | 1027 title += WebInspector.UIString(" Energy: %.2f Joules", energy); |
1004 break; | 1028 break; |
1005 } | 1029 } |
1006 } | 1030 } |
1007 this._detailsView.setContent(title, fragment); | 1031 this._detailsView.setContent(title, fragment); |
1008 }, | 1032 }, |
1009 | 1033 |
1010 /** | 1034 /** |
1011 * @param {?WebInspector.TimelineModel.Record} record | 1035 * @param {?WebInspector.TimelineSelection} selection |
1012 */ | 1036 */ |
1013 selectRecord: function(record) | 1037 select: function(selection) |
1014 { | 1038 { |
1015 this._detailsLinkifier.reset(); | 1039 this._detailsLinkifier.reset(); |
1016 this._selectedRecord = record; | 1040 this._selection = selection; |
1017 | |
1018 if (!record) { | |
1019 this._updateSelectionDetails(); | |
1020 return; | |
1021 } | |
1022 | 1041 |
1023 for (var i = 0; i < this._currentViews.length; ++i) { | 1042 for (var i = 0; i < this._currentViews.length; ++i) { |
1024 var view = this._currentViews[i]; | 1043 var view = this._currentViews[i]; |
1025 view.setSelectedRecord(record); | 1044 view.setSelection(selection); |
1026 } | 1045 } |
1027 if (!record) { | 1046 this._updateSelectionDetails(); |
1028 this._updateSelectionDetails(); | |
1029 return; | |
1030 } | |
1031 WebInspector.TimelineUIUtils.generatePopupContent(record, this._model, t
his._detailsLinkifier, showCallback.bind(this), this._model.loadedFromFile()); | |
1032 | |
1033 /** | |
1034 * @param {!DocumentFragment} element | |
1035 * @this {WebInspector.TimelinePanel} | |
1036 */ | |
1037 function showCallback(element) | |
1038 { | |
1039 this._detailsView.setContent(record.title(), element); | |
1040 } | |
1041 }, | 1047 }, |
1042 | 1048 |
1043 /** | 1049 /** |
1044 * @param {string} title | 1050 * @param {string} title |
1045 * @param {!Node} node | 1051 * @param {!Node} node |
1046 */ | 1052 */ |
1047 showInDetails: function(title, node) | 1053 showInDetails: function(title, node) |
1048 { | 1054 { |
1049 this._detailsView.setContent(title, node); | 1055 this._detailsView.setContent(title, node); |
1050 }, | 1056 }, |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1091 setVertical: function(vertical) | 1097 setVertical: function(vertical) |
1092 { | 1098 { |
1093 this._contentElement.classList.toggle("hbox", !vertical); | 1099 this._contentElement.classList.toggle("hbox", !vertical); |
1094 this._contentElement.classList.toggle("vbox", vertical); | 1100 this._contentElement.classList.toggle("vbox", vertical); |
1095 }, | 1101 }, |
1096 | 1102 |
1097 __proto__: WebInspector.VBox.prototype | 1103 __proto__: WebInspector.VBox.prototype |
1098 } | 1104 } |
1099 | 1105 |
1100 /** | 1106 /** |
| 1107 * @constructor |
| 1108 */ |
| 1109 WebInspector.TimelineSelection = function() |
| 1110 { |
| 1111 } |
| 1112 |
| 1113 /** |
| 1114 * @enum {string} |
| 1115 */ |
| 1116 WebInspector.TimelineSelection.Type = { |
| 1117 Record: "Record", |
| 1118 Frame: "Frame", |
| 1119 }; |
| 1120 |
| 1121 /** |
| 1122 * @param {!WebInspector.TimelineModel.Record} record |
| 1123 * @return {!WebInspector.TimelineSelection} |
| 1124 */ |
| 1125 WebInspector.TimelineSelection.fromRecord = function(record) |
| 1126 { |
| 1127 var selection = new WebInspector.TimelineSelection(); |
| 1128 selection._type = WebInspector.TimelineSelection.Type.Record; |
| 1129 selection._object = record; |
| 1130 return selection; |
| 1131 } |
| 1132 |
| 1133 /** |
| 1134 * @param {!WebInspector.TimelineFrame} frame |
| 1135 * @return {!WebInspector.TimelineSelection} |
| 1136 */ |
| 1137 WebInspector.TimelineSelection.fromFrame = function(frame) |
| 1138 { |
| 1139 var selection = new WebInspector.TimelineSelection(); |
| 1140 selection._type = WebInspector.TimelineSelection.Type.Frame; |
| 1141 selection._object = frame; |
| 1142 return selection; |
| 1143 } |
| 1144 |
| 1145 WebInspector.TimelineSelection.prototype = { |
| 1146 /** |
| 1147 * @return {!WebInspector.TimelineSelection.Type} |
| 1148 */ |
| 1149 type: function() |
| 1150 { |
| 1151 return this._type; |
| 1152 }, |
| 1153 |
| 1154 /** |
| 1155 * @return {!Object} |
| 1156 */ |
| 1157 object: function() |
| 1158 { |
| 1159 return this._object; |
| 1160 } |
| 1161 }; |
| 1162 |
| 1163 /** |
1101 * @interface | 1164 * @interface |
1102 */ | 1165 */ |
1103 WebInspector.TimelineModeView = function() | 1166 WebInspector.TimelineModeView = function() |
1104 { | 1167 { |
1105 } | 1168 } |
1106 | 1169 |
1107 WebInspector.TimelineModeView.prototype = { | 1170 WebInspector.TimelineModeView.prototype = { |
1108 /** | 1171 /** |
1109 * @return {!WebInspector.View} | 1172 * @return {!WebInspector.View} |
1110 */ | 1173 */ |
(...skipping 25 matching lines...) Expand all Loading... |
1136 * @param {number} endTime | 1199 * @param {number} endTime |
1137 */ | 1200 */ |
1138 setWindowTimes: function(startTime, endTime) {}, | 1201 setWindowTimes: function(startTime, endTime) {}, |
1139 | 1202 |
1140 /** | 1203 /** |
1141 * @param {number} width | 1204 * @param {number} width |
1142 */ | 1205 */ |
1143 setSidebarSize: function(width) {}, | 1206 setSidebarSize: function(width) {}, |
1144 | 1207 |
1145 /** | 1208 /** |
1146 * @param {?WebInspector.TimelineModel.Record} record | 1209 * @param {?WebInspector.TimelineSelection} selection |
1147 */ | 1210 */ |
1148 setSelectedRecord: function(record) {}, | 1211 setSelection: function(selection) {}, |
1149 } | 1212 } |
1150 | 1213 |
1151 /** | 1214 /** |
1152 * @interface | 1215 * @interface |
1153 */ | 1216 */ |
1154 WebInspector.TimelineModeViewDelegate = function() {} | 1217 WebInspector.TimelineModeViewDelegate = function() {} |
1155 | 1218 |
1156 WebInspector.TimelineModeViewDelegate.prototype = { | 1219 WebInspector.TimelineModeViewDelegate.prototype = { |
1157 /** | 1220 /** |
1158 * @param {number} startTime | 1221 * @param {number} startTime |
1159 * @param {number} endTime | 1222 * @param {number} endTime |
1160 */ | 1223 */ |
1161 requestWindowTimes: function(startTime, endTime) {}, | 1224 requestWindowTimes: function(startTime, endTime) {}, |
1162 | 1225 |
1163 /** | 1226 /** |
1164 * @param {?WebInspector.TimelineModel.Record} record | 1227 * @param {?WebInspector.TimelineSelection} selection |
1165 */ | 1228 */ |
1166 selectRecord: function(record) {}, | 1229 select: function(selection) {}, |
1167 | 1230 |
1168 /** | 1231 /** |
1169 * @param {string} title | 1232 * @param {string} title |
1170 * @param {!Node} node | 1233 * @param {!Node} node |
1171 */ | 1234 */ |
1172 showInDetails: function(title, node) {}, | 1235 showInDetails: function(title, node) {}, |
1173 } | 1236 } |
1174 | 1237 |
1175 /** | 1238 /** |
1176 * @constructor | 1239 * @constructor |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1292 * @param {!WebInspector.TimelineModel.Record} record | 1355 * @param {!WebInspector.TimelineModel.Record} record |
1293 * @return {boolean} | 1356 * @return {boolean} |
1294 */ | 1357 */ |
1295 accept: function(record) | 1358 accept: function(record) |
1296 { | 1359 { |
1297 return !this._hiddenRecords[record.type()]; | 1360 return !this._hiddenRecords[record.type()]; |
1298 }, | 1361 }, |
1299 | 1362 |
1300 __proto__: WebInspector.TimelineModel.Filter.prototype | 1363 __proto__: WebInspector.TimelineModel.Filter.prototype |
1301 } | 1364 } |
OLD | NEW |