Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 | 5 |
| 6 WebInspector.TimelineJSProfileProcessor = { }; | 6 WebInspector.TimelineJSProfileProcessor = { }; |
| 7 | 7 |
| 8 /** | 8 /** |
| 9 * @param {!WebInspector.CPUProfileDataModel} jsProfileModel | 9 * @param {!WebInspector.CPUProfileDataModel} jsProfileModel |
| 10 * @param {!WebInspector.TracingModel.Thread} thread | 10 * @param {!WebInspector.TracingModel.Thread} thread |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 26 if (!node) { | 26 if (!node) { |
| 27 console.error(`Node with unknown id ${samples[i]} at index ${i}`); | 27 console.error(`Node with unknown id ${samples[i]} at index ${i}`); |
| 28 continue; | 28 continue; |
| 29 } | 29 } |
| 30 if (node === gcNode || node === idleNode) | 30 if (node === gcNode || node === idleNode) |
| 31 continue; | 31 continue; |
| 32 var callFrames = nodeToStackMap.get(node); | 32 var callFrames = nodeToStackMap.get(node); |
| 33 if (!callFrames) { | 33 if (!callFrames) { |
| 34 callFrames = /** @type {!Array<!RuntimeAgent.CallFrame>} */ (new Arr ay(node.depth + 1)); | 34 callFrames = /** @type {!Array<!RuntimeAgent.CallFrame>} */ (new Arr ay(node.depth + 1)); |
| 35 nodeToStackMap.set(node, callFrames); | 35 nodeToStackMap.set(node, callFrames); |
| 36 for (var j = 0; node.parent; node = node.parent) | 36 for (var j = 0; node.parent; node = node.parent) { |
| 37 callFrames[j++] = /** @type {!RuntimeAgent.CallFrame} */ (node); | 37 // Tracing Events are 1-based. |
| 38 callFrames[j++] = /** @type {!RuntimeAgent.CallFrame} */ ({ | |
| 39 functionName: node.functionName, | |
|
alph
2016/07/15 22:42:25
You're creating a bunch of objects here. There wer
| |
| 40 scriptId: node.scriptId, | |
| 41 url: node.url, | |
| 42 lineNumber: node.lineNumber + 1, | |
| 43 columnNumber: node.columnNumber + 1 | |
| 44 }); | |
| 45 } | |
| 38 } | 46 } |
| 39 var jsSampleEvent = new WebInspector.TracingModel.Event(WebInspector.Tra cingModel.DevToolsTimelineEventCategory, | 47 var jsSampleEvent = new WebInspector.TracingModel.Event(WebInspector.Tra cingModel.DevToolsTimelineEventCategory, |
| 40 WebInspector.TimelineModel.RecordType.JSSample, | 48 WebInspector.TimelineModel.RecordType.JSSample, |
| 41 WebInspector.TracingModel.Phase.Instant, timestamps[i], thread); | 49 WebInspector.TracingModel.Phase.Instant, timestamps[i], thread); |
| 42 jsSampleEvent.args["data"] = { stackTrace: callFrames }; | 50 jsSampleEvent.args["data"] = { stackTrace: callFrames }; |
| 43 jsEvents.push(jsSampleEvent); | 51 jsEvents.push(jsSampleEvent); |
| 44 } | 52 } |
| 45 return jsEvents; | 53 return jsEvents; |
| 46 } | 54 } |
| 47 | 55 |
| (...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 488 WebInspector.TracingModel.Phase.Instant, e.startTime, e.thread); | 496 WebInspector.TracingModel.Phase.Instant, e.startTime, e.thread); |
| 489 sampleEvent.ordinal = e.ordinal; | 497 sampleEvent.ordinal = e.ordinal; |
| 490 sampleEvent.args = {"data": {"stackTrace": stack }}; | 498 sampleEvent.args = {"data": {"stackTrace": stack }}; |
| 491 samples.push(sampleEvent); | 499 samples.push(sampleEvent); |
| 492 break; | 500 break; |
| 493 } | 501 } |
| 494 } | 502 } |
| 495 | 503 |
| 496 return samples; | 504 return samples; |
| 497 } | 505 } |
| OLD | NEW |