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 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 _generateJSFrameEvents: function(events) | 230 _generateJSFrameEvents: function(events) |
231 { | 231 { |
232 function equalFrames(frame1, frame2) | 232 function equalFrames(frame1, frame2) |
233 { | 233 { |
234 return frame1.scriptId === frame2.scriptId && frame1.functionName ==
= frame2.functionName; | 234 return frame1.scriptId === frame2.scriptId && frame1.functionName ==
= frame2.functionName; |
235 } | 235 } |
236 function eventEndTime(e) | 236 function eventEndTime(e) |
237 { | 237 { |
238 return e.endTime || e.startTime + WebInspector.TimelineFlameChartDat
aProvider.InstantEventVisibleDurationMs; | 238 return e.endTime || e.startTime + WebInspector.TimelineFlameChartDat
aProvider.InstantEventVisibleDurationMs; |
239 } | 239 } |
| 240 function isJSInvocationEvent(e) |
| 241 { |
| 242 switch (e.name) { |
| 243 case WebInspector.TracingTimelineModel.RecordType.FunctionCall: |
| 244 case WebInspector.TracingTimelineModel.RecordType.EvaluateScript: |
| 245 return true; |
| 246 } |
| 247 return false; |
| 248 } |
240 var jsFrameEvents = []; | 249 var jsFrameEvents = []; |
241 var stackTraceOpenEvents = []; | 250 var stackTraceOpenEvents = []; |
| 251 var currentJSInvocationEndTime = 0; |
242 var coalesceThresholdMs = WebInspector.TimelineFlameChartDataProvider.JS
FrameCoalsceThresholdMs; | 252 var coalesceThresholdMs = WebInspector.TimelineFlameChartDataProvider.JS
FrameCoalsceThresholdMs; |
243 for (var i = 0; i < events.length; ++i) { | 253 for (var i = 0; i < events.length; ++i) { |
244 var e = events[i]; | 254 var e = events[i]; |
245 if (!e.stackTrace || !this._isVisible(e)) | 255 if (e.startTime >= currentJSInvocationEndTime) { |
| 256 stackTraceOpenEvents.length = 0; |
| 257 currentJSInvocationEndTime = 0; |
| 258 } |
| 259 if (isJSInvocationEvent(e)) |
| 260 currentJSInvocationEndTime = e.endTime; |
| 261 if (!currentJSInvocationEndTime) |
| 262 continue; |
| 263 if (!e.stackTrace) |
246 continue; | 264 continue; |
247 while (stackTraceOpenEvents.length && eventEndTime(stackTraceOpenEve
nts.peekLast()) + coalesceThresholdMs <= e.startTime) | 265 while (stackTraceOpenEvents.length && eventEndTime(stackTraceOpenEve
nts.peekLast()) + coalesceThresholdMs <= e.startTime) |
248 stackTraceOpenEvents.pop(); | 266 stackTraceOpenEvents.pop(); |
249 var numFrames = e.stackTrace.length; | 267 var numFrames = e.stackTrace.length; |
250 for (var j = 0; j < numFrames && j < stackTraceOpenEvents.length; ++
j) { | 268 for (var j = 0; j < numFrames && j < stackTraceOpenEvents.length; ++
j) { |
251 var frame = e.stackTrace[numFrames - 1 - j]; | 269 var frame = e.stackTrace[numFrames - 1 - j]; |
252 if (!equalFrames(frame, stackTraceOpenEvents[j].args.data)) | 270 if (!equalFrames(frame, stackTraceOpenEvents[j].args.data)) |
253 break; | 271 break; |
254 stackTraceOpenEvents[j].endTime = Math.max(stackTraceOpenEvents[
j].endTime, eventEndTime(e)); | 272 stackTraceOpenEvents[j].endTime = Math.max(stackTraceOpenEvents[
j].endTime, eventEndTime(e)); |
255 stackTraceOpenEvents[j].duration = stackTraceOpenEvents[j].endTi
me - stackTraceOpenEvents[j].startTime; | 273 stackTraceOpenEvents[j].duration = stackTraceOpenEvents[j].endTi
me - stackTraceOpenEvents[j].startTime; |
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
756 /** | 774 /** |
757 * @constructor | 775 * @constructor |
758 * @param {!WebInspector.TimelineSelection} selection | 776 * @param {!WebInspector.TimelineSelection} selection |
759 * @param {number} entryIndex | 777 * @param {number} entryIndex |
760 */ | 778 */ |
761 WebInspector.TimelineFlameChart.Selection = function(selection, entryIndex) | 779 WebInspector.TimelineFlameChart.Selection = function(selection, entryIndex) |
762 { | 780 { |
763 this.timelineSelection = selection; | 781 this.timelineSelection = selection; |
764 this.entryIndex = entryIndex; | 782 this.entryIndex = entryIndex; |
765 } | 783 } |
OLD | NEW |