Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 101 EvaluateScript: "EvaluateScript", | 101 EvaluateScript: "EvaluateScript", |
| 102 | 102 |
| 103 CommitLoad: "CommitLoad", | 103 CommitLoad: "CommitLoad", |
| 104 MarkLoad: "MarkLoad", | 104 MarkLoad: "MarkLoad", |
| 105 MarkDOMContent: "MarkDOMContent", | 105 MarkDOMContent: "MarkDOMContent", |
| 106 MarkFirstPaint: "MarkFirstPaint", | 106 MarkFirstPaint: "MarkFirstPaint", |
| 107 | 107 |
| 108 TimeStamp: "TimeStamp", | 108 TimeStamp: "TimeStamp", |
| 109 ConsoleTime: "ConsoleTime", | 109 ConsoleTime: "ConsoleTime", |
| 110 | 110 |
| 111 ResourceFetcherRequestResource: "ResourceFetcher::requestResource", | |
| 112 ResourceDispatcherOnReceivedData: "ResourceDispatcher::OnReceivedData", | |
| 113 ResourceDispatcherOnReceivedResponse: "ResourceDispatcher::OnReceivedRespons e", | |
| 114 ResourceDispatcherOnRequestComplete: "ResourceDispatcher::OnRequestComplete" , | |
| 115 | |
| 111 ResourceSendRequest: "ResourceSendRequest", | 116 ResourceSendRequest: "ResourceSendRequest", |
| 112 ResourceReceiveResponse: "ResourceReceiveResponse", | 117 ResourceReceiveResponse: "ResourceReceiveResponse", |
| 113 ResourceReceivedData: "ResourceReceivedData", | 118 ResourceReceivedData: "ResourceReceivedData", |
| 114 ResourceFinish: "ResourceFinish", | 119 ResourceFinish: "ResourceFinish", |
| 115 | 120 |
| 116 FunctionCall: "FunctionCall", | 121 FunctionCall: "FunctionCall", |
| 117 GCEvent: "GCEvent", // For backwards compatibility only, now replaced by Min orGC/MajorGC. | 122 GCEvent: "GCEvent", // For backwards compatibility only, now replaced by Min orGC/MajorGC. |
| 118 MajorGC: "MajorGC", | 123 MajorGC: "MajorGC", |
| 119 MinorGC: "MinorGC", | 124 MinorGC: "MinorGC", |
| 120 JSFrame: "JSFrame", | 125 JSFrame: "JSFrame", |
| (...skipping 938 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1059 groupAsyncEvents.push(asyncEvent); | 1064 groupAsyncEvents.push(asyncEvent); |
| 1060 } | 1065 } |
| 1061 }, | 1066 }, |
| 1062 | 1067 |
| 1063 /** | 1068 /** |
| 1064 * @param {!WebInspector.TracingModel.Event} event | 1069 * @param {!WebInspector.TracingModel.Event} event |
| 1065 * @return {boolean} | 1070 * @return {boolean} |
| 1066 */ | 1071 */ |
| 1067 _processEvent: function(event) | 1072 _processEvent: function(event) |
| 1068 { | 1073 { |
| 1074 /** | |
| 1075 * @param {!Object} dest | |
| 1076 * @param {!Object} source | |
| 1077 */ | |
| 1078 function mergeData(dest, source) | |
| 1079 { | |
| 1080 for (var field in source) | |
| 1081 dest[field] = dest[field] || source[field]; | |
| 1082 } | |
| 1083 /** | |
| 1084 * @param {!WebInspector.TracingModel.Event} event | |
| 1085 * @param {!WebInspector.TimelineModel.RecordType} parentType | |
| 1086 * @this {WebInspector.TimelineModel} | |
| 1087 */ | |
| 1088 function processNetworkEvent(event, parentType) | |
|
caseq
2015/11/06 21:38:38
nit: I'd extract this to a member function.
alph
2015/11/06 22:16:31
Done.
| |
| 1089 { | |
| 1090 var parent = this._findAncestorEvent(parentType); | |
| 1091 if (!parent) | |
| 1092 return; | |
| 1093 if (!parent.args["data"]) | |
| 1094 parent.args["data"] = {}; | |
| 1095 var eventData = event.args["data"]; | |
| 1096 mergeData(parent.args["data"], eventData); | |
| 1097 parent.stackTrace = parent.stackTrace || event.stackTrace; | |
| 1098 parent.initiator = parent.initiator || event.initiator; | |
| 1099 var url = eventData["url"] || event.initiator && event.initiator.url ; | |
| 1100 event.url = url; | |
| 1101 parent.url = url; | |
| 1102 } | |
| 1103 | |
| 1069 var eventStack = this._eventStack; | 1104 var eventStack = this._eventStack; |
| 1070 while (eventStack.length && eventStack.peekLast().endTime <= event.start Time) | 1105 while (eventStack.length && eventStack.peekLast().endTime <= event.start Time) |
| 1071 eventStack.pop(); | 1106 eventStack.pop(); |
| 1072 | 1107 |
| 1073 var recordTypes = WebInspector.TimelineModel.RecordType; | 1108 var recordTypes = WebInspector.TimelineModel.RecordType; |
| 1074 | 1109 |
| 1075 if (this._currentScriptEvent && event.startTime > this._currentScriptEve nt.endTime) | 1110 if (this._currentScriptEvent && event.startTime > this._currentScriptEve nt.endTime) |
| 1076 this._currentScriptEvent = null; | 1111 this._currentScriptEvent = null; |
| 1077 | 1112 |
| 1078 var eventData = event.args["data"] || event.args["beginData"] || {}; | 1113 var eventData = event.args["data"] || event.args["beginData"] || {}; |
| 1079 if (eventData && eventData["stackTrace"]) | 1114 if (eventData && eventData["stackTrace"]) |
| 1080 event.stackTrace = eventData["stackTrace"]; | 1115 event.stackTrace = eventData["stackTrace"]; |
| 1081 | 1116 |
| 1082 if (eventStack.length && eventStack.peekLast().name === recordTypes.Even tDispatch) | 1117 if (eventStack.length && eventStack.peekLast().name === recordTypes.Even tDispatch) |
| 1083 eventStack.peekLast().hasChildren = true; | 1118 eventStack.peekLast().hasChildren = true; |
| 1084 this._asyncEventTracker.processEvent(event); | 1119 this._asyncEventTracker.processEvent(event); |
| 1085 if (event.initiator && event.initiator.url) | 1120 if (event.initiator && event.initiator.url) |
| 1086 event.url = event.initiator.url; | 1121 event.url = event.initiator.url; |
| 1087 switch (event.name) { | 1122 switch (event.name) { |
| 1088 case recordTypes.ResourceSendRequest: | 1123 case recordTypes.ResourceSendRequest: |
| 1124 processNetworkEvent.call(this, event, recordTypes.ResourceFetcherReq uestResource); | |
| 1125 break; | |
| 1126 | |
| 1127 case recordTypes.ResourceReceiveResponse: | |
| 1128 processNetworkEvent.call(this, event, recordTypes.ResourceDispatcher OnReceivedResponse); | |
| 1129 break; | |
| 1130 | |
| 1131 case recordTypes.ResourceReceivedData: | |
| 1132 processNetworkEvent.call(this, event, recordTypes.ResourceDispatcher OnReceivedData); | |
| 1133 break; | |
| 1134 | |
| 1135 case recordTypes.ResourceFinish: | |
| 1136 processNetworkEvent.call(this, event, recordTypes.ResourceDispatcher OnRequestComplete); | |
| 1137 break; | |
| 1138 | |
| 1089 case recordTypes.WebSocketCreate: | 1139 case recordTypes.WebSocketCreate: |
| 1090 event.url = event.args["data"]["url"]; | 1140 event.url = event.args["data"]["url"]; |
| 1091 break; | 1141 break; |
| 1092 | 1142 |
| 1093 case recordTypes.ScheduleStyleRecalculation: | 1143 case recordTypes.ScheduleStyleRecalculation: |
| 1094 this._lastScheduleStyleRecalculation[event.args["data"]["frame"]] = event; | 1144 this._lastScheduleStyleRecalculation[event.args["data"]["frame"]] = event; |
| 1095 break; | 1145 break; |
| 1096 | 1146 |
| 1097 case recordTypes.UpdateLayoutTree: | 1147 case recordTypes.UpdateLayoutTree: |
| 1098 case recordTypes.RecalculateStyles: | 1148 case recordTypes.RecalculateStyles: |
| (...skipping 1300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2399 if (!id) | 2449 if (!id) |
| 2400 return; | 2450 return; |
| 2401 /** @type {!Map<string, !WebInspector.TracingModel.Event>|undefined} */ | 2451 /** @type {!Map<string, !WebInspector.TracingModel.Event>|undefined} */ |
| 2402 var initiatorMap = this._initiatorByType.get(initiatorType); | 2452 var initiatorMap = this._initiatorByType.get(initiatorType); |
| 2403 if (isInitiator) | 2453 if (isInitiator) |
| 2404 initiatorMap.set(id, event); | 2454 initiatorMap.set(id, event); |
| 2405 else | 2455 else |
| 2406 event.initiator = initiatorMap.get(id) || null; | 2456 event.initiator = initiatorMap.get(id) || null; |
| 2407 } | 2457 } |
| 2408 } | 2458 } |
| OLD | NEW |