| 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 {!ProfilerAgent.CPUProfile} jsProfile | 9 * @param {!WebInspector.CPUProfileDataModel} jsProfileModel |
| 10 * @param {!WebInspector.TracingModel.Thread} thread | 10 * @param {!WebInspector.TracingModel.Thread} thread |
| 11 * @return {!Array<!WebInspector.TracingModel.Event>} | 11 * @return {!Array<!WebInspector.TracingModel.Event>} |
| 12 */ | 12 */ |
| 13 WebInspector.TimelineJSProfileProcessor.generateTracingEventsFromCpuProfile = fu
nction(jsProfile, thread) | 13 WebInspector.TimelineJSProfileProcessor.generateTracingEventsFromCpuProfile = fu
nction(jsProfileModel, thread) |
| 14 { | 14 { |
| 15 if (!jsProfile.samples) | |
| 16 return []; | |
| 17 var jsProfileModel = new WebInspector.CPUProfileDataModel(jsProfile); | |
| 18 var idleNode = jsProfileModel.idleNode; | 15 var idleNode = jsProfileModel.idleNode; |
| 19 var programNode = jsProfileModel.programNode; | 16 var programNode = jsProfileModel.programNode; |
| 20 var gcNode = jsProfileModel.gcNode; | 17 var gcNode = jsProfileModel.gcNode; |
| 21 var samples = jsProfileModel.samples; | 18 var samples = jsProfileModel.samples; |
| 22 var timestamps = jsProfileModel.timestamps; | 19 var timestamps = jsProfileModel.timestamps; |
| 23 var jsEvents = []; | 20 var jsEvents = []; |
| 24 /** @type {!Map<!Object, !Array<!RuntimeAgent.CallFrame>>} */ | 21 /** @type {!Map<!Object, !Array<!RuntimeAgent.CallFrame>>} */ |
| 25 var nodeToStackMap = new Map(); | 22 var nodeToStackMap = new Map(); |
| 26 nodeToStackMap.set(programNode, []); | 23 nodeToStackMap.set(programNode, []); |
| 27 for (var i = 0; i < samples.length; ++i) { | 24 for (var i = 0; i < samples.length; ++i) { |
| (...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 487 WebInspector.TracingModel.Phase.Instant, e.startTime, e.thread); | 484 WebInspector.TracingModel.Phase.Instant, e.startTime, e.thread); |
| 488 sampleEvent.ordinal = e.ordinal; | 485 sampleEvent.ordinal = e.ordinal; |
| 489 sampleEvent.args = {"data": {"stackTrace": stack }}; | 486 sampleEvent.args = {"data": {"stackTrace": stack }}; |
| 490 samples.push(sampleEvent); | 487 samples.push(sampleEvent); |
| 491 break; | 488 break; |
| 492 } | 489 } |
| 493 } | 490 } |
| 494 | 491 |
| 495 return samples; | 492 return samples; |
| 496 } | 493 } |
| OLD | NEW |