| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #include "platform/v8_inspector/V8ProfilerAgentImpl.h" | 5 #include "platform/v8_inspector/V8ProfilerAgentImpl.h" |
| 6 | 6 |
| 7 #include "platform/v8_inspector/Atomics.h" | 7 #include "platform/v8_inspector/Atomics.h" |
| 8 #include "platform/v8_inspector/V8Debugger.h" |
| 8 #include "platform/v8_inspector/V8InspectorImpl.h" | 9 #include "platform/v8_inspector/V8InspectorImpl.h" |
| 9 #include "platform/v8_inspector/V8InspectorSessionImpl.h" | 10 #include "platform/v8_inspector/V8InspectorSessionImpl.h" |
| 10 #include "platform/v8_inspector/V8StackTraceImpl.h" | 11 #include "platform/v8_inspector/V8StackTraceImpl.h" |
| 11 #include "platform/v8_inspector/V8StringUtil.h" | 12 #include "platform/v8_inspector/V8StringUtil.h" |
| 12 #include <v8-profiler.h> | 13 #include <v8-profiler.h> |
| 13 | 14 |
| 14 #include <vector> | 15 #include <vector> |
| 15 | 16 |
| 16 #define ENSURE_V8_VERSION(major, minor) \ | 17 #define ENSURE_V8_VERSION(major, minor) \ |
| 17 (V8_MAJOR_VERSION * 1000 + V8_MINOR_VERSION >= (major) * 1000 + (minor)) | 18 (V8_MAJOR_VERSION * 1000 + V8_MINOR_VERSION >= (major) * 1000 + (minor)) |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 .setNodes(std::move(nodes)) | 115 .setNodes(std::move(nodes)) |
| 115 .setStartTime(static_cast<double>(v8profile->GetStartTime())) | 116 .setStartTime(static_cast<double>(v8profile->GetStartTime())) |
| 116 .setEndTime(static_cast<double>(v8profile->GetEndTime())).build(); | 117 .setEndTime(static_cast<double>(v8profile->GetEndTime())).build(); |
| 117 profile->setSamples(buildInspectorObjectForSamples(v8profile)); | 118 profile->setSamples(buildInspectorObjectForSamples(v8profile)); |
| 118 profile->setTimestampDeltas(buildInspectorObjectForTimestamps(v8profile)); | 119 profile->setTimestampDeltas(buildInspectorObjectForTimestamps(v8profile)); |
| 119 return profile; | 120 return profile; |
| 120 } | 121 } |
| 121 | 122 |
| 122 std::unique_ptr<protocol::Debugger::Location> currentDebugLocation(V8InspectorIm
pl* inspector) | 123 std::unique_ptr<protocol::Debugger::Location> currentDebugLocation(V8InspectorIm
pl* inspector) |
| 123 { | 124 { |
| 124 std::unique_ptr<V8StackTrace> callStack = inspector->captureStackTrace(1); | 125 std::unique_ptr<V8StackTraceImpl> callStack = inspector->debugger()->capture
StackTrace(false /* fullStack */); |
| 125 std::unique_ptr<protocol::Debugger::Location> location = protocol::Debugger:
:Location::create() | 126 std::unique_ptr<protocol::Debugger::Location> location = protocol::Debugger:
:Location::create() |
| 126 .setScriptId(callStack->topScriptId()) | 127 .setScriptId(toString16(callStack->topScriptId())) |
| 127 .setLineNumber(callStack->topLineNumber()).build(); | 128 .setLineNumber(callStack->topLineNumber()).build(); |
| 128 location->setColumnNumber(callStack->topColumnNumber()); | 129 location->setColumnNumber(callStack->topColumnNumber()); |
| 129 return location; | 130 return location; |
| 130 } | 131 } |
| 131 | 132 |
| 132 volatile int s_lastProfileId = 0; | 133 volatile int s_lastProfileId = 0; |
| 133 | 134 |
| 134 } // namespace | 135 } // namespace |
| 135 | 136 |
| 136 class V8ProfilerAgentImpl::ProfileDescriptor { | 137 class V8ProfilerAgentImpl::ProfileDescriptor { |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 v8::CpuProfiler* V8ProfilerAgentImpl::profiler() | 326 v8::CpuProfiler* V8ProfilerAgentImpl::profiler() |
| 326 { | 327 { |
| 327 #if ENSURE_V8_VERSION(5, 4) | 328 #if ENSURE_V8_VERSION(5, 4) |
| 328 return m_profiler; | 329 return m_profiler; |
| 329 #else | 330 #else |
| 330 return m_isolate->GetCpuProfiler(); | 331 return m_isolate->GetCpuProfiler(); |
| 331 #endif | 332 #endif |
| 332 } | 333 } |
| 333 | 334 |
| 334 } // namespace v8_inspector | 335 } // namespace v8_inspector |
| OLD | NEW |