OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2014 Google Inc. All rights reserved. | 2 * Copyright (C) 2014 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 25 matching lines...) Expand all Loading... |
36 */ | 36 */ |
37 WebInspector.TimelineFlameChartDataProviderBase = function(model, filters) | 37 WebInspector.TimelineFlameChartDataProviderBase = function(model, filters) |
38 { | 38 { |
39 WebInspector.FlameChartDataProvider.call(this); | 39 WebInspector.FlameChartDataProvider.call(this); |
40 this.reset(); | 40 this.reset(); |
41 this._model = model; | 41 this._model = model; |
42 /** @type {?WebInspector.FlameChart.TimelineData} */ | 42 /** @type {?WebInspector.FlameChart.TimelineData} */ |
43 this._timelineData; | 43 this._timelineData; |
44 this._font = "11px " + WebInspector.fontFamily(); | 44 this._font = "11px " + WebInspector.fontFamily(); |
45 this._filters = filters; | 45 this._filters = filters; |
46 } | 46 }; |
47 | 47 |
48 WebInspector.TimelineFlameChartDataProviderBase.prototype = { | 48 WebInspector.TimelineFlameChartDataProviderBase.prototype = { |
49 /** | 49 /** |
50 * @override | 50 * @override |
51 * @return {number} | 51 * @return {number} |
52 */ | 52 */ |
53 barHeight: function() | 53 barHeight: function() |
54 { | 54 { |
55 return 17; | 55 return 17; |
56 }, | 56 }, |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 }, | 246 }, |
247 | 247 |
248 /** | 248 /** |
249 * @param {!WebInspector.TracingModel.Event} event | 249 * @param {!WebInspector.TracingModel.Event} event |
250 * @return {boolean} | 250 * @return {boolean} |
251 */ | 251 */ |
252 _isVisible: function(event) | 252 _isVisible: function(event) |
253 { | 253 { |
254 return this._filters.every(function(filter) { return filter.accept(event
); }); | 254 return this._filters.every(function(filter) { return filter.accept(event
); }); |
255 } | 255 } |
256 } | 256 }; |
257 | 257 |
258 /** | 258 /** |
259 * @enum {symbol} | 259 * @enum {symbol} |
260 */ | 260 */ |
261 WebInspector.TimelineFlameChartEntryType = { | 261 WebInspector.TimelineFlameChartEntryType = { |
262 Frame: Symbol("Frame"), | 262 Frame: Symbol("Frame"), |
263 Event: Symbol("Event"), | 263 Event: Symbol("Event"), |
264 InteractionRecord: Symbol("InteractionRecord"), | 264 InteractionRecord: Symbol("InteractionRecord"), |
265 }; | 265 }; |
266 | 266 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 this._interactionsHeaderLevel2 = { | 318 this._interactionsHeaderLevel2 = { |
319 padding: 2, | 319 padding: 2, |
320 height: 17, | 320 height: 17, |
321 collapsible: true, | 321 collapsible: true, |
322 color: WebInspector.themeSupport.patchColor("#222", WebInspector.ThemeSu
pport.ColorUsage.Foreground), | 322 color: WebInspector.themeSupport.patchColor("#222", WebInspector.ThemeSu
pport.ColorUsage.Foreground), |
323 font: this._font, | 323 font: this._font, |
324 backgroundColor: WebInspector.themeSupport.patchColor("white", WebInspec
tor.ThemeSupport.ColorUsage.Background), | 324 backgroundColor: WebInspector.themeSupport.patchColor("white", WebInspec
tor.ThemeSupport.ColorUsage.Background), |
325 nestingLevel: 1, | 325 nestingLevel: 1, |
326 shareHeaderLine: true | 326 shareHeaderLine: true |
327 }; | 327 }; |
328 } | 328 }; |
329 | 329 |
330 WebInspector.TimelineFlameChartDataProvider.InstantEventVisibleDurationMs = 0.00
1; | 330 WebInspector.TimelineFlameChartDataProvider.InstantEventVisibleDurationMs = 0.00
1; |
331 | 331 |
332 WebInspector.TimelineFlameChartDataProvider.prototype = { | 332 WebInspector.TimelineFlameChartDataProvider.prototype = { |
333 /** | 333 /** |
334 * @override | 334 * @override |
335 * @param {number} entryIndex | 335 * @param {number} entryIndex |
336 * @return {?string} | 336 * @return {?string} |
337 */ | 337 */ |
338 entryTitle: function(entryIndex) | 338 entryTitle: function(entryIndex) |
(...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
923 /** | 923 /** |
924 * @override | 924 * @override |
925 * @param {number} entryIndex | 925 * @param {number} entryIndex |
926 * @return {?WebInspector.TimelineSelection} | 926 * @return {?WebInspector.TimelineSelection} |
927 */ | 927 */ |
928 createSelection: function(entryIndex) | 928 createSelection: function(entryIndex) |
929 { | 929 { |
930 var type = this._entryType(entryIndex); | 930 var type = this._entryType(entryIndex); |
931 var timelineSelection = null; | 931 var timelineSelection = null; |
932 if (type === WebInspector.TimelineFlameChartEntryType.Event) | 932 if (type === WebInspector.TimelineFlameChartEntryType.Event) |
933 timelineSelection = WebInspector.TimelineSelection.fromTraceEvent(/*
* @type {!WebInspector.TracingModel.Event} */ (this._entryData[entryIndex])) | 933 timelineSelection = WebInspector.TimelineSelection.fromTraceEvent(/*
* @type {!WebInspector.TracingModel.Event} */ (this._entryData[entryIndex])); |
934 else if (type === WebInspector.TimelineFlameChartEntryType.Frame) | 934 else if (type === WebInspector.TimelineFlameChartEntryType.Frame) |
935 timelineSelection = WebInspector.TimelineSelection.fromFrame(/** @ty
pe {!WebInspector.TimelineFrame} */ (this._entryData[entryIndex])); | 935 timelineSelection = WebInspector.TimelineSelection.fromFrame(/** @ty
pe {!WebInspector.TimelineFrame} */ (this._entryData[entryIndex])); |
936 if (timelineSelection) | 936 if (timelineSelection) |
937 this._lastSelection = new WebInspector.TimelineFlameChartView.Select
ion(timelineSelection, entryIndex); | 937 this._lastSelection = new WebInspector.TimelineFlameChartView.Select
ion(timelineSelection, entryIndex); |
938 return timelineSelection; | 938 return timelineSelection; |
939 }, | 939 }, |
940 | 940 |
941 /** | 941 /** |
942 * @param {?WebInspector.TimelineSelection} selection | 942 * @param {?WebInspector.TimelineSelection} selection |
943 * @return {number} | 943 * @return {number} |
944 */ | 944 */ |
945 entryIndexForSelection: function(selection) | 945 entryIndexForSelection: function(selection) |
946 { | 946 { |
947 if (!selection || selection.type() === WebInspector.TimelineSelection.Ty
pe.Range) | 947 if (!selection || selection.type() === WebInspector.TimelineSelection.Ty
pe.Range) |
948 return -1; | 948 return -1; |
949 | 949 |
950 if (this._lastSelection && this._lastSelection.timelineSelection.object(
) === selection.object()) | 950 if (this._lastSelection && this._lastSelection.timelineSelection.object(
) === selection.object()) |
951 return this._lastSelection.entryIndex; | 951 return this._lastSelection.entryIndex; |
952 var index = this._entryData.indexOf(/** @type {!WebInspector.TracingMode
l.Event|!WebInspector.TimelineFrame|!WebInspector.TimelineIRModel.Phases} */(sel
ection.object())); | 952 var index = this._entryData.indexOf(/** @type {!WebInspector.TracingMode
l.Event|!WebInspector.TimelineFrame|!WebInspector.TimelineIRModel.Phases} */(sel
ection.object())); |
953 if (index !== -1) | 953 if (index !== -1) |
954 this._lastSelection = new WebInspector.TimelineFlameChartView.Select
ion(selection, index); | 954 this._lastSelection = new WebInspector.TimelineFlameChartView.Select
ion(selection, index); |
955 return index; | 955 return index; |
956 }, | 956 }, |
957 | 957 |
958 __proto__: WebInspector.TimelineFlameChartDataProviderBase.prototype | 958 __proto__: WebInspector.TimelineFlameChartDataProviderBase.prototype |
959 } | 959 }; |
960 | 960 |
961 /** | 961 /** |
962 * @constructor | 962 * @constructor |
963 * @extends {WebInspector.TimelineFlameChartDataProviderBase} | 963 * @extends {WebInspector.TimelineFlameChartDataProviderBase} |
964 * @param {!WebInspector.TimelineModel} model | 964 * @param {!WebInspector.TimelineModel} model |
965 */ | 965 */ |
966 WebInspector.TimelineFlameChartNetworkDataProvider = function(model) | 966 WebInspector.TimelineFlameChartNetworkDataProvider = function(model) |
967 { | 967 { |
968 WebInspector.TimelineFlameChartDataProviderBase.call(this, model, []); | 968 WebInspector.TimelineFlameChartDataProviderBase.call(this, model, []); |
969 var loadingCategory = WebInspector.TimelineUIUtils.categories()["loading"]; | 969 var loadingCategory = WebInspector.TimelineUIUtils.categories()["loading"]; |
970 this._waitingColor = loadingCategory.childColor; | 970 this._waitingColor = loadingCategory.childColor; |
971 this._processingColor = loadingCategory.color; | 971 this._processingColor = loadingCategory.color; |
972 } | 972 }; |
973 | 973 |
974 WebInspector.TimelineFlameChartNetworkDataProvider.prototype = { | 974 WebInspector.TimelineFlameChartNetworkDataProvider.prototype = { |
975 /** | 975 /** |
976 * @override | 976 * @override |
977 * @return {!WebInspector.FlameChart.TimelineData} | 977 * @return {!WebInspector.FlameChart.TimelineData} |
978 */ | 978 */ |
979 timelineData: function() | 979 timelineData: function() |
980 { | 980 { |
981 if (this._timelineData) | 981 if (this._timelineData) |
982 return this._timelineData; | 982 return this._timelineData; |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1212 */ | 1212 */ |
1213 _appendEntry: function(request) | 1213 _appendEntry: function(request) |
1214 { | 1214 { |
1215 this._requests.push(request); | 1215 this._requests.push(request); |
1216 this._timelineData.entryStartTimes.push(request.startTime); | 1216 this._timelineData.entryStartTimes.push(request.startTime); |
1217 this._timelineData.entryTotalTimes.push(request.endTime - request.startT
ime); | 1217 this._timelineData.entryTotalTimes.push(request.endTime - request.startT
ime); |
1218 this._timelineData.entryLevels.push(this._requests.length - 1); | 1218 this._timelineData.entryLevels.push(this._requests.length - 1); |
1219 }, | 1219 }, |
1220 | 1220 |
1221 __proto__: WebInspector.TimelineFlameChartDataProviderBase.prototype | 1221 __proto__: WebInspector.TimelineFlameChartDataProviderBase.prototype |
1222 } | 1222 }; |
1223 | 1223 |
1224 /** | 1224 /** |
1225 * @constructor | 1225 * @constructor |
1226 * @implements {WebInspector.FlameChartMarker} | 1226 * @implements {WebInspector.FlameChartMarker} |
1227 * @param {number} startTime | 1227 * @param {number} startTime |
1228 * @param {number} startOffset | 1228 * @param {number} startOffset |
1229 * @param {!WebInspector.TimelineMarkerStyle} style | 1229 * @param {!WebInspector.TimelineMarkerStyle} style |
1230 */ | 1230 */ |
1231 WebInspector.TimelineFlameChartMarker = function(startTime, startOffset, style) | 1231 WebInspector.TimelineFlameChartMarker = function(startTime, startOffset, style) |
1232 { | 1232 { |
1233 this._startTime = startTime; | 1233 this._startTime = startTime; |
1234 this._startOffset = startOffset; | 1234 this._startOffset = startOffset; |
1235 this._style = style; | 1235 this._style = style; |
1236 } | 1236 }; |
1237 | 1237 |
1238 WebInspector.TimelineFlameChartMarker.prototype = { | 1238 WebInspector.TimelineFlameChartMarker.prototype = { |
1239 /** | 1239 /** |
1240 * @override | 1240 * @override |
1241 * @return {number} | 1241 * @return {number} |
1242 */ | 1242 */ |
1243 startTime: function() | 1243 startTime: function() |
1244 { | 1244 { |
1245 return this._startTime; | 1245 return this._startTime; |
1246 }, | 1246 }, |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1293 context.lineWidth = this._style.lineWidth; | 1293 context.lineWidth = this._style.lineWidth; |
1294 context.translate(this._style.lineWidth < 1 || (this._style.lineWidt
h & 1) ? 0.5 : 0, 0.5); | 1294 context.translate(this._style.lineWidth < 1 || (this._style.lineWidt
h & 1) ? 0.5 : 0, 0.5); |
1295 context.beginPath(); | 1295 context.beginPath(); |
1296 context.moveTo(x, height); | 1296 context.moveTo(x, height); |
1297 context.setLineDash(this._style.dashStyle); | 1297 context.setLineDash(this._style.dashStyle); |
1298 context.lineTo(x, context.canvas.height); | 1298 context.lineTo(x, context.canvas.height); |
1299 context.stroke(); | 1299 context.stroke(); |
1300 } | 1300 } |
1301 context.restore(); | 1301 context.restore(); |
1302 } | 1302 } |
1303 } | 1303 }; |
1304 | 1304 |
1305 /** | 1305 /** |
1306 * @constructor | 1306 * @constructor |
1307 * @extends {WebInspector.VBox} | 1307 * @extends {WebInspector.VBox} |
1308 * @implements {WebInspector.TimelineModeView} | 1308 * @implements {WebInspector.TimelineModeView} |
1309 * @implements {WebInspector.FlameChartDelegate} | 1309 * @implements {WebInspector.FlameChartDelegate} |
1310 * @param {!WebInspector.TimelineModeViewDelegate} delegate | 1310 * @param {!WebInspector.TimelineModeViewDelegate} delegate |
1311 * @param {!WebInspector.TimelineModel} timelineModel | 1311 * @param {!WebInspector.TimelineModel} timelineModel |
1312 * @param {!WebInspector.TimelineFrameModel} frameModel | 1312 * @param {!WebInspector.TimelineFrameModel} frameModel |
1313 * @param {!WebInspector.TimelineIRModel} irModel | 1313 * @param {!WebInspector.TimelineIRModel} irModel |
(...skipping 17 matching lines...) Expand all Loading... |
1331 | 1331 |
1332 this._splitWidget.setMainWidget(this._mainView); | 1332 this._splitWidget.setMainWidget(this._mainView); |
1333 this._splitWidget.setSidebarWidget(this._networkView); | 1333 this._splitWidget.setSidebarWidget(this._networkView); |
1334 this._splitWidget.show(this.element); | 1334 this._splitWidget.show(this.element); |
1335 | 1335 |
1336 this._onMainEntrySelected = this._onEntrySelected.bind(this, this._dataProvi
der); | 1336 this._onMainEntrySelected = this._onEntrySelected.bind(this, this._dataProvi
der); |
1337 this._onNetworkEntrySelected = this._onEntrySelected.bind(this, this._networ
kDataProvider); | 1337 this._onNetworkEntrySelected = this._onEntrySelected.bind(this, this._networ
kDataProvider); |
1338 this._mainView.addEventListener(WebInspector.FlameChart.Events.EntrySelected
, this._onMainEntrySelected, this); | 1338 this._mainView.addEventListener(WebInspector.FlameChart.Events.EntrySelected
, this._onMainEntrySelected, this); |
1339 this._networkView.addEventListener(WebInspector.FlameChart.Events.EntrySelec
ted, this._onNetworkEntrySelected, this); | 1339 this._networkView.addEventListener(WebInspector.FlameChart.Events.EntrySelec
ted, this._onNetworkEntrySelected, this); |
1340 WebInspector.blackboxManager.addChangeListener(this.refreshRecords, this); | 1340 WebInspector.blackboxManager.addChangeListener(this.refreshRecords, this); |
1341 } | 1341 }; |
1342 | 1342 |
1343 WebInspector.TimelineFlameChartView.prototype = { | 1343 WebInspector.TimelineFlameChartView.prototype = { |
1344 /** | 1344 /** |
1345 * @override | 1345 * @override |
1346 */ | 1346 */ |
1347 dispose: function() | 1347 dispose: function() |
1348 { | 1348 { |
1349 this._mainView.removeEventListener(WebInspector.FlameChart.Events.EntryS
elected, this._onMainEntrySelected, this); | 1349 this._mainView.removeEventListener(WebInspector.FlameChart.Events.EntryS
elected, this._onMainEntrySelected, this); |
1350 this._networkView.removeEventListener(WebInspector.FlameChart.Events.Ent
rySelected, this._onNetworkEntrySelected, this); | 1350 this._networkView.removeEventListener(WebInspector.FlameChart.Events.Ent
rySelected, this._onNetworkEntrySelected, this); |
1351 WebInspector.blackboxManager.removeChangeListener(this.refreshRecords, t
his); | 1351 WebInspector.blackboxManager.removeChangeListener(this.refreshRecords, t
his); |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1493 */ | 1493 */ |
1494 enableNetworkPane: function(enable, animate) | 1494 enableNetworkPane: function(enable, animate) |
1495 { | 1495 { |
1496 if (enable) | 1496 if (enable) |
1497 this._splitWidget.showBoth(animate); | 1497 this._splitWidget.showBoth(animate); |
1498 else | 1498 else |
1499 this._splitWidget.hideSidebar(animate); | 1499 this._splitWidget.hideSidebar(animate); |
1500 }, | 1500 }, |
1501 | 1501 |
1502 __proto__: WebInspector.VBox.prototype | 1502 __proto__: WebInspector.VBox.prototype |
1503 } | 1503 }; |
1504 | 1504 |
1505 /** | 1505 /** |
1506 * @constructor | 1506 * @constructor |
1507 * @param {!WebInspector.TimelineSelection} selection | 1507 * @param {!WebInspector.TimelineSelection} selection |
1508 * @param {number} entryIndex | 1508 * @param {number} entryIndex |
1509 */ | 1509 */ |
1510 WebInspector.TimelineFlameChartView.Selection = function(selection, entryIndex) | 1510 WebInspector.TimelineFlameChartView.Selection = function(selection, entryIndex) |
1511 { | 1511 { |
1512 this.timelineSelection = selection; | 1512 this.timelineSelection = selection; |
1513 this.entryIndex = entryIndex; | 1513 this.entryIndex = entryIndex; |
1514 } | 1514 }; |
OLD | NEW |