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 } | |
| 1069 var eventStack = this._eventStack; | 1083 var eventStack = this._eventStack; |
| 1070 while (eventStack.length && eventStack.peekLast().endTime <= event.start Time) | 1084 while (eventStack.length && eventStack.peekLast().endTime <= event.start Time) |
| 1071 eventStack.pop(); | 1085 eventStack.pop(); |
| 1072 | 1086 |
| 1073 var recordTypes = WebInspector.TimelineModel.RecordType; | 1087 var recordTypes = WebInspector.TimelineModel.RecordType; |
| 1074 | 1088 |
| 1075 if (this._currentScriptEvent && event.startTime > this._currentScriptEve nt.endTime) | 1089 if (this._currentScriptEvent && event.startTime > this._currentScriptEve nt.endTime) |
| 1076 this._currentScriptEvent = null; | 1090 this._currentScriptEvent = null; |
| 1077 | 1091 |
| 1078 var eventData = event.args["data"] || event.args["beginData"] || {}; | 1092 var eventData = event.args["data"] || event.args["beginData"] || {}; |
| 1079 if (eventData && eventData["stackTrace"]) | 1093 if (eventData && eventData["stackTrace"]) |
| 1080 event.stackTrace = eventData["stackTrace"]; | 1094 event.stackTrace = eventData["stackTrace"]; |
| 1081 | 1095 |
| 1082 if (eventStack.length && eventStack.peekLast().name === recordTypes.Even tDispatch) | 1096 if (eventStack.length && eventStack.peekLast().name === recordTypes.Even tDispatch) |
| 1083 eventStack.peekLast().hasChildren = true; | 1097 eventStack.peekLast().hasChildren = true; |
| 1084 this._asyncEventTracker.processEvent(event); | 1098 this._asyncEventTracker.processEvent(event); |
| 1085 if (event.initiator && event.initiator.url) | 1099 if (event.initiator && event.initiator.url) |
| 1086 event.url = event.initiator.url; | 1100 event.url = event.initiator.url; |
| 1087 switch (event.name) { | 1101 switch (event.name) { |
| 1088 case recordTypes.ResourceSendRequest: | 1102 case recordTypes.ResourceSendRequest: |
| 1103 case recordTypes.ResourceReceiveResponse: | |
| 1104 case recordTypes.ResourceReceivedData: | |
| 1105 case recordTypes.ResourceFinish: | |
| 1106 var parent = eventStack.peekLast(); | |
|
caseq
2015/11/06 19:37:47
This looks fragile, we can't expect other events n
alph
2015/11/06 21:04:51
Done.
| |
| 1107 if (!parent) | |
| 1108 break; | |
| 1109 if (!parent.args["data"]) | |
| 1110 parent.args["data"] = {}; | |
| 1111 mergeData(parent.args["data"], eventData); | |
| 1112 parent.stackTrace = parent.stackTrace || event.stackTrace; | |
| 1113 parent.initiator = parent.initiator || event.initiator; | |
| 1114 var url = eventData["url"] || event.initiator.url; | |
| 1115 event.url = url; | |
| 1116 parent.url = url; | |
| 1117 break; | |
| 1118 | |
| 1089 case recordTypes.WebSocketCreate: | 1119 case recordTypes.WebSocketCreate: |
| 1090 event.url = event.args["data"]["url"]; | 1120 event.url = event.args["data"]["url"]; |
| 1091 break; | 1121 break; |
| 1092 | 1122 |
| 1093 case recordTypes.ScheduleStyleRecalculation: | 1123 case recordTypes.ScheduleStyleRecalculation: |
| 1094 this._lastScheduleStyleRecalculation[event.args["data"]["frame"]] = event; | 1124 this._lastScheduleStyleRecalculation[event.args["data"]["frame"]] = event; |
| 1095 break; | 1125 break; |
| 1096 | 1126 |
| 1097 case recordTypes.UpdateLayoutTree: | 1127 case recordTypes.UpdateLayoutTree: |
| 1098 case recordTypes.RecalculateStyles: | 1128 case recordTypes.RecalculateStyles: |
| (...skipping 1300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2399 if (!id) | 2429 if (!id) |
| 2400 return; | 2430 return; |
| 2401 /** @type {!Map<string, !WebInspector.TracingModel.Event>|undefined} */ | 2431 /** @type {!Map<string, !WebInspector.TracingModel.Event>|undefined} */ |
| 2402 var initiatorMap = this._initiatorByType.get(initiatorType); | 2432 var initiatorMap = this._initiatorByType.get(initiatorType); |
| 2403 if (isInitiator) | 2433 if (isInitiator) |
| 2404 initiatorMap.set(id, event); | 2434 initiatorMap.set(id, event); |
| 2405 else | 2435 else |
| 2406 event.initiator = initiatorMap.get(id) || null; | 2436 event.initiator = initiatorMap.get(id) || null; |
| 2407 } | 2437 } |
| 2408 } | 2438 } |
| OLD | NEW |