| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 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 975 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 986 return contentHelper.fragment; | 986 return contentHelper.fragment; |
| 987 } | 987 } |
| 988 | 988 |
| 989 /** | 989 /** |
| 990 * @param {!TimelineModel.TimelineModel.Record} record | 990 * @param {!TimelineModel.TimelineModel.Record} record |
| 991 * @param {number} startTime | 991 * @param {number} startTime |
| 992 * @param {number} endTime | 992 * @param {number} endTime |
| 993 * @param {!Object} aggregatedStats | 993 * @param {!Object} aggregatedStats |
| 994 */ | 994 */ |
| 995 static _collectAggregatedStatsForRecord(record, startTime, endTime, aggregated
Stats) { | 995 static _collectAggregatedStatsForRecord(record, startTime, endTime, aggregated
Stats) { |
| 996 var records = []; | |
| 997 | |
| 998 if (!record.endTime() || record.endTime() < startTime || record.startTime()
> endTime) | 996 if (!record.endTime() || record.endTime() < startTime || record.startTime()
> endTime) |
| 999 return; | 997 return; |
| 1000 | 998 |
| 1001 var childrenTime = 0; | 999 var childrenTime = 0; |
| 1002 var children = record.children() || []; | 1000 var children = record.children() || []; |
| 1003 for (var i = 0; i < children.length; ++i) { | 1001 for (var i = 0; i < children.length; ++i) { |
| 1004 var child = children[i]; | 1002 var child = children[i]; |
| 1005 if (!child.endTime() || child.endTime() < startTime || child.startTime() >
endTime) | 1003 if (!child.endTime() || child.endTime() < startTime || child.startTime() >
endTime) |
| 1006 continue; | 1004 continue; |
| 1007 childrenTime += Math.min(endTime, child.endTime()) - Math.max(startTime, c
hild.startTime()); | 1005 childrenTime += Math.min(endTime, child.endTime()) - Math.max(startTime, c
hild.startTime()); |
| 1008 Timeline.TimelineUIUtils._collectAggregatedStatsForRecord(child, startTime
, endTime, aggregatedStats); | 1006 Timeline.TimelineUIUtils._collectAggregatedStatsForRecord(child, startTime
, endTime, aggregatedStats); |
| 1009 } | 1007 } |
| 1010 var categoryName = Timeline.TimelineUIUtils.categoryForRecord(record).name; | 1008 var categoryName = Timeline.TimelineUIUtils.categoryForRecord(record).name; |
| 1011 var ownTime = Math.min(endTime, record.endTime()) - Math.max(startTime, reco
rd.startTime()) - childrenTime; | 1009 var ownTime = Math.min(endTime, record.endTime()) - Math.max(startTime, reco
rd.startTime()) - childrenTime; |
| 1012 aggregatedStats[categoryName] = (aggregatedStats[categoryName] || 0) + ownTi
me; | 1010 aggregatedStats[categoryName] = (aggregatedStats[categoryName] || 0) + ownTi
me; |
| 1013 } | 1011 } |
| 1014 | 1012 |
| 1015 /** | 1013 /** |
| 1016 * @param {!TimelineModel.TimelineModel.NetworkRequest} request | 1014 * @param {!TimelineModel.TimelineModel.NetworkRequest} request |
| 1017 * @param {!TimelineModel.TimelineModel} model | 1015 * @param {!TimelineModel.TimelineModel} model |
| 1018 * @param {!Components.Linkifier} linkifier | 1016 * @param {!Components.Linkifier} linkifier |
| 1019 * @return {!Promise<!DocumentFragment>} | 1017 * @return {!Promise<!DocumentFragment>} |
| 1020 */ | 1018 */ |
| 1021 static buildNetworkRequestDetails(request, model, linkifier) { | 1019 static buildNetworkRequestDetails(request, model, linkifier) { |
| 1022 var target = model.targetByEvent(request.children[0]); | 1020 var target = model.targetByEvent(request.children[0]); |
| 1023 var contentHelper = new Timeline.TimelineDetailsContentHelper(target, linkif
ier); | 1021 var contentHelper = new Timeline.TimelineDetailsContentHelper(target, linkif
ier); |
| 1024 | 1022 |
| 1025 var duration = request.endTime - (request.startTime || -Infinity); | 1023 var duration = request.endTime - (request.startTime || -Infinity); |
| 1026 var items = []; | |
| 1027 if (request.url) | 1024 if (request.url) |
| 1028 contentHelper.appendElementRow(Common.UIString('URL'), Components.Linkifie
r.linkifyURL(request.url)); | 1025 contentHelper.appendElementRow(Common.UIString('URL'), Components.Linkifie
r.linkifyURL(request.url)); |
| 1029 if (isFinite(duration)) | 1026 if (isFinite(duration)) |
| 1030 contentHelper.appendTextRow(Common.UIString('Duration'), Number.millisToSt
ring(duration, true)); | 1027 contentHelper.appendTextRow(Common.UIString('Duration'), Number.millisToSt
ring(duration, true)); |
| 1031 if (request.requestMethod) | 1028 if (request.requestMethod) |
| 1032 contentHelper.appendTextRow(Common.UIString('Request Method'), request.req
uestMethod); | 1029 contentHelper.appendTextRow(Common.UIString('Request Method'), request.req
uestMethod); |
| 1033 if (typeof request.priority === 'string') { | 1030 if (typeof request.priority === 'string') { |
| 1034 var priority = | 1031 var priority = |
| 1035 Components.uiLabelForPriority(/** @type {!Protocol.Network.ResourcePri
ority} */ (request.priority)); | 1032 Components.uiLabelForPriority(/** @type {!Protocol.Network.ResourcePri
ority} */ (request.priority)); |
| 1036 contentHelper.appendTextRow(Common.UIString('Priority'), priority); | 1033 contentHelper.appendTextRow(Common.UIString('Priority'), priority); |
| (...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1504 return element; | 1501 return element; |
| 1505 } | 1502 } |
| 1506 | 1503 |
| 1507 /** | 1504 /** |
| 1508 * @param {!TimelineModel.TimelineFrameModel} frameModel | 1505 * @param {!TimelineModel.TimelineFrameModel} frameModel |
| 1509 * @param {!TimelineModel.TimelineFrame} frame | 1506 * @param {!TimelineModel.TimelineFrame} frame |
| 1510 * @param {?Components.FilmStripModel.Frame} filmStripFrame | 1507 * @param {?Components.FilmStripModel.Frame} filmStripFrame |
| 1511 * @return {!Element} | 1508 * @return {!Element} |
| 1512 */ | 1509 */ |
| 1513 static generateDetailsContentForFrame(frameModel, frame, filmStripFrame) { | 1510 static generateDetailsContentForFrame(frameModel, frame, filmStripFrame) { |
| 1514 var pieChart = Timeline.TimelineUIUtils.generatePieChart(frame.timeByCategor
y); | |
| 1515 var contentHelper = new Timeline.TimelineDetailsContentHelper(null, null); | 1511 var contentHelper = new Timeline.TimelineDetailsContentHelper(null, null); |
| 1516 contentHelper.addSection(Common.UIString('Frame')); | 1512 contentHelper.addSection(Common.UIString('Frame')); |
| 1517 | 1513 |
| 1518 var duration = Timeline.TimelineUIUtils.frameDuration(frame); | 1514 var duration = Timeline.TimelineUIUtils.frameDuration(frame); |
| 1519 contentHelper.appendElementRow(Common.UIString('Duration'), duration, frame.
hasWarnings()); | 1515 contentHelper.appendElementRow(Common.UIString('Duration'), duration, frame.
hasWarnings()); |
| 1520 if (filmStripFrame) { | 1516 if (filmStripFrame) { |
| 1521 var filmStripPreview = createElementWithClass('img', 'timeline-filmstrip-p
review'); | 1517 var filmStripPreview = createElementWithClass('img', 'timeline-filmstrip-p
review'); |
| 1522 filmStripFrame.imageDataPromise().then(onGotImageData.bind(null, filmStrip
Preview)); | 1518 filmStripFrame.imageDataPromise().then(onGotImageData.bind(null, filmStrip
Preview)); |
| 1523 contentHelper.appendElementRow('', filmStripPreview); | 1519 contentHelper.appendElementRow('', filmStripPreview); |
| 1524 filmStripPreview.addEventListener('click', frameClicked.bind(null, filmStr
ipFrame), false); | 1520 filmStripPreview.addEventListener('click', frameClicked.bind(null, filmStr
ipFrame), false); |
| (...skipping 714 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2239 /** | 2235 /** |
| 2240 * @param {!SDK.TracingModel.Event} event | 2236 * @param {!SDK.TracingModel.Event} event |
| 2241 * @param {string=} warningType | 2237 * @param {string=} warningType |
| 2242 */ | 2238 */ |
| 2243 appendWarningRow(event, warningType) { | 2239 appendWarningRow(event, warningType) { |
| 2244 var warning = Timeline.TimelineUIUtils.eventWarning(event, warningType); | 2240 var warning = Timeline.TimelineUIUtils.eventWarning(event, warningType); |
| 2245 if (warning) | 2241 if (warning) |
| 2246 this.appendElementRow(Common.UIString('Warning'), warning, true); | 2242 this.appendElementRow(Common.UIString('Warning'), warning, true); |
| 2247 } | 2243 } |
| 2248 }; | 2244 }; |
| OLD | NEW |