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 680 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
691 function linkifyTopCallFrame() { | 691 function linkifyTopCallFrame() { |
692 var frame = TimelineModel.TimelineData.forEvent(event).topFrame(); | 692 var frame = TimelineModel.TimelineData.forEvent(event).topFrame(); |
693 return frame ? linkifier.maybeLinkifyConsoleCallFrame(target, frame, 'time
line-details') : null; | 693 return frame ? linkifier.maybeLinkifyConsoleCallFrame(target, frame, 'time
line-details') : null; |
694 } | 694 } |
695 } | 695 } |
696 | 696 |
697 /** | 697 /** |
698 * @param {!SDK.TracingModel.Event} event | 698 * @param {!SDK.TracingModel.Event} event |
699 * @param {!TimelineModel.TimelineModel} model | 699 * @param {!TimelineModel.TimelineModel} model |
700 * @param {!Components.Linkifier} linkifier | 700 * @param {!Components.Linkifier} linkifier |
| 701 * @param {!ProductRegistry.BadgePool} badgePool |
701 * @param {boolean} detailed | 702 * @param {boolean} detailed |
702 * @return {!Promise<!DocumentFragment>} | 703 * @return {!Promise<!DocumentFragment>} |
703 */ | 704 */ |
704 static async buildTraceEventDetails(event, model, linkifier, detailed) { | 705 static async buildTraceEventDetails(event, model, linkifier, badgePool, detail
ed) { |
705 var maybeTarget = model.targetByEvent(event); | 706 var maybeTarget = model.targetByEvent(event); |
706 /** @type {?Map<number, ?SDK.DOMNode>} */ | 707 /** @type {?Map<number, ?SDK.DOMNode>} */ |
707 var relatedNodesMap = null; | 708 var relatedNodesMap = null; |
708 if (maybeTarget) { | 709 if (maybeTarget) { |
709 var target = /** @type {!SDK.Target} */ (maybeTarget); | 710 var target = /** @type {!SDK.Target} */ (maybeTarget); |
710 if (typeof event[Timeline.TimelineUIUtils._previewElementSymbol] === 'unde
fined') { | 711 if (typeof event[Timeline.TimelineUIUtils._previewElementSymbol] === 'unde
fined') { |
711 var previewElement = null; | 712 var previewElement = null; |
712 var url = TimelineModel.TimelineData.forEvent(event).url; | 713 var url = TimelineModel.TimelineData.forEvent(event).url; |
713 if (url) | 714 if (url) |
714 previewElement = await Components.DOMPresentationUtils.buildImagePrevi
ewContents(target, url, false); | 715 previewElement = await Components.DOMPresentationUtils.buildImagePrevi
ewContents(target, url, false); |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
902 break; | 903 break; |
903 | 904 |
904 default: | 905 default: |
905 var detailsNode = | 906 var detailsNode = |
906 Timeline.TimelineUIUtils.buildDetailsNodeForTraceEvent(event, model.
targetByEvent(event), linkifier); | 907 Timeline.TimelineUIUtils.buildDetailsNodeForTraceEvent(event, model.
targetByEvent(event), linkifier); |
907 if (detailsNode) | 908 if (detailsNode) |
908 contentHelper.appendElementRow(Common.UIString('Details'), detailsNode
); | 909 contentHelper.appendElementRow(Common.UIString('Details'), detailsNode
); |
909 break; | 910 break; |
910 } | 911 } |
911 | 912 |
912 await Timeline.TimelineUIUtils._maybeAppendProductToDetails(contentHelper, u
rl || eventData && eventData['url']); | 913 Timeline.TimelineUIUtils._maybeAppendProductToDetails( |
| 914 contentHelper, badgePool, url || eventData && eventData['url']); |
913 | 915 |
914 if (timelineData.timeWaitingForMainThread) { | 916 if (timelineData.timeWaitingForMainThread) { |
915 contentHelper.appendTextRow( | 917 contentHelper.appendTextRow( |
916 Common.UIString('Time Waiting for Main Thread'), | 918 Common.UIString('Time Waiting for Main Thread'), |
917 Number.millisToString(timelineData.timeWaitingForMainThread, true)); | 919 Number.millisToString(timelineData.timeWaitingForMainThread, true)); |
918 } | 920 } |
919 | 921 |
920 var relatedNode = relatedNodesMap && relatedNodesMap.get(timelineData.backen
dNodeId); | 922 var relatedNode = relatedNodesMap && relatedNodesMap.get(timelineData.backen
dNodeId); |
921 if (relatedNode) { | 923 if (relatedNode) { |
922 contentHelper.appendElementRow( | 924 contentHelper.appendElementRow( |
(...skipping 17 matching lines...) Expand all Loading... |
940 var pieChart = Timeline.TimelineUIUtils.generatePieChart( | 942 var pieChart = Timeline.TimelineUIUtils.generatePieChart( |
941 stats, Timeline.TimelineUIUtils.eventStyle(event).category, event.self
Time); | 943 stats, Timeline.TimelineUIUtils.eventStyle(event).category, event.self
Time); |
942 contentHelper.appendElementRow('', pieChart); | 944 contentHelper.appendElementRow('', pieChart); |
943 } | 945 } |
944 | 946 |
945 return contentHelper.fragment; | 947 return contentHelper.fragment; |
946 } | 948 } |
947 | 949 |
948 /** | 950 /** |
949 * @param {!Timeline.TimelineDetailsContentHelper} contentHelper | 951 * @param {!Timeline.TimelineDetailsContentHelper} contentHelper |
| 952 * @param {!ProductRegistry.BadgePool} badgePool |
950 * @param {?string} url | 953 * @param {?string} url |
951 * @return {!Promise} | |
952 */ | 954 */ |
953 static async _maybeAppendProductToDetails(contentHelper, url) { | 955 static _maybeAppendProductToDetails(contentHelper, badgePool, url) { |
954 var parsedURL = url && url.asParsedURL(); | 956 var parsedURL = url ? url.asParsedURL() : null; |
955 if (!parsedURL) | 957 if (parsedURL) |
956 return; | 958 contentHelper.appendElementRow('', badgePool.badgeForURL(parsedURL, true))
; |
957 var registry = await ProductRegistry.instance(); | |
958 var name = registry.nameForUrl(parsedURL); | |
959 if (name) | |
960 contentHelper.appendTextRow(Common.UIString('Product'), name); | |
961 } | 959 } |
962 | 960 |
963 /** | 961 /** |
964 * @param {!TimelineModel.TimelineModel} model | 962 * @param {!TimelineModel.TimelineModel} model |
965 * @param {number} startTime | 963 * @param {number} startTime |
966 * @param {number} endTime | 964 * @param {number} endTime |
967 * @return {!DocumentFragment} | 965 * @return {!DocumentFragment} |
968 */ | 966 */ |
969 static buildRangeStats(model, startTime, endTime) { | 967 static buildRangeStats(model, startTime, endTime) { |
970 var aggregatedStats = Timeline.TimelineUIUtils.statsForTimeRange(model, star
tTime, endTime); | 968 var aggregatedStats = Timeline.TimelineUIUtils.statsForTimeRange(model, star
tTime, endTime); |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1090 aggregatedStats[category] = (aggregatedStats[category] || 0) + ownTimes.po
p(); | 1088 aggregatedStats[category] = (aggregatedStats[category] || 0) + ownTimes.po
p(); |
1091 if (!ownTimes.length) | 1089 if (!ownTimes.length) |
1092 e[Timeline.TimelineUIUtils._categoryBreakdownCacheSymbol] = Object.assig
n({}, aggregatedStats); | 1090 e[Timeline.TimelineUIUtils._categoryBreakdownCacheSymbol] = Object.assig
n({}, aggregatedStats); |
1093 } | 1091 } |
1094 } | 1092 } |
1095 | 1093 |
1096 /** | 1094 /** |
1097 * @param {!TimelineModel.TimelineModel.NetworkRequest} request | 1095 * @param {!TimelineModel.TimelineModel.NetworkRequest} request |
1098 * @param {!TimelineModel.TimelineModel} model | 1096 * @param {!TimelineModel.TimelineModel} model |
1099 * @param {!Components.Linkifier} linkifier | 1097 * @param {!Components.Linkifier} linkifier |
| 1098 * @param {!ProductRegistry.BadgePool} badgePool |
1100 * @return {!Promise<!DocumentFragment>} | 1099 * @return {!Promise<!DocumentFragment>} |
1101 */ | 1100 */ |
1102 static async buildNetworkRequestDetails(request, model, linkifier) { | 1101 static async buildNetworkRequestDetails(request, model, linkifier, badgePool)
{ |
1103 const target = model.targetByEvent(request.children[0]); | 1102 const target = model.targetByEvent(request.children[0]); |
1104 const contentHelper = new Timeline.TimelineDetailsContentHelper(target, link
ifier); | 1103 const contentHelper = new Timeline.TimelineDetailsContentHelper(target, link
ifier); |
1105 const category = Timeline.TimelineUIUtils.networkRequestCategory(request); | 1104 const category = Timeline.TimelineUIUtils.networkRequestCategory(request); |
1106 const color = Timeline.TimelineUIUtils.networkCategoryColor(category); | 1105 const color = Timeline.TimelineUIUtils.networkCategoryColor(category); |
1107 contentHelper.addSection(Common.UIString('Network request'), color); | 1106 contentHelper.addSection(Common.UIString('Network request'), color); |
1108 | 1107 |
1109 const duration = request.endTime - (request.startTime || -Infinity); | 1108 const duration = request.endTime - (request.startTime || -Infinity); |
1110 if (request.url) | 1109 if (request.url) |
1111 contentHelper.appendElementRow(Common.UIString('URL'), Components.Linkifie
r.linkifyURL(request.url)); | 1110 contentHelper.appendElementRow(Common.UIString('URL'), Components.Linkifie
r.linkifyURL(request.url)); |
1112 await Timeline.TimelineUIUtils._maybeAppendProductToDetails(contentHelper, r
equest.url); | 1111 Timeline.TimelineUIUtils._maybeAppendProductToDetails(contentHelper, badgePo
ol, request.url); |
1113 if (isFinite(duration)) | 1112 if (isFinite(duration)) |
1114 contentHelper.appendTextRow(Common.UIString('Duration'), Number.millisToSt
ring(duration, true)); | 1113 contentHelper.appendTextRow(Common.UIString('Duration'), Number.millisToSt
ring(duration, true)); |
1115 if (request.requestMethod) | 1114 if (request.requestMethod) |
1116 contentHelper.appendTextRow(Common.UIString('Request Method'), request.req
uestMethod); | 1115 contentHelper.appendTextRow(Common.UIString('Request Method'), request.req
uestMethod); |
1117 if (typeof request.priority === 'string') { | 1116 if (typeof request.priority === 'string') { |
1118 const priority = | 1117 const priority = |
1119 NetworkConditions.uiLabelForPriority(/** @type {!Protocol.Network.Reso
urcePriority} */ (request.priority)); | 1118 NetworkConditions.uiLabelForPriority(/** @type {!Protocol.Network.Reso
urcePriority} */ (request.priority)); |
1120 contentHelper.appendTextRow(Common.UIString('Priority'), priority); | 1119 contentHelper.appendTextRow(Common.UIString('Priority'), priority); |
1121 } | 1120 } |
1122 if (request.mimeType) | 1121 if (request.mimeType) |
(...skipping 1162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2285 * @param {string=} warningType | 2284 * @param {string=} warningType |
2286 */ | 2285 */ |
2287 appendWarningRow(event, warningType) { | 2286 appendWarningRow(event, warningType) { |
2288 var warning = Timeline.TimelineUIUtils.eventWarning(event, warningType); | 2287 var warning = Timeline.TimelineUIUtils.eventWarning(event, warningType); |
2289 if (warning) | 2288 if (warning) |
2290 this.appendElementRow(Common.UIString('Warning'), warning, true); | 2289 this.appendElementRow(Common.UIString('Warning'), warning, true); |
2291 } | 2290 } |
2292 }; | 2291 }; |
2293 | 2292 |
2294 Timeline.TimelineUIUtils._categoryBreakdownCacheSymbol = Symbol('categoryBreakdo
wnCache'); | 2293 Timeline.TimelineUIUtils._categoryBreakdownCacheSymbol = Symbol('categoryBreakdo
wnCache'); |
OLD | NEW |