| 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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 return protocol::Profiler::Profile::create() | 116 return protocol::Profiler::Profile::create() |
| 116 .setNodes(std::move(nodes)) | 117 .setNodes(std::move(nodes)) |
| 117 .setStartTime(static_cast<double>(v8profile->GetStartTime())) | 118 .setStartTime(static_cast<double>(v8profile->GetStartTime())) |
| 118 .setEndTime(static_cast<double>(v8profile->GetEndTime())) | 119 .setEndTime(static_cast<double>(v8profile->GetEndTime())) |
| 119 .setSamples(buildInspectorObjectForSamples(v8profile)) | 120 .setSamples(buildInspectorObjectForSamples(v8profile)) |
| 120 .setTimeDeltas(buildInspectorObjectForTimestamps(v8profile)).build(); | 121 .setTimeDeltas(buildInspectorObjectForTimestamps(v8profile)).build(); |
| 121 } | 122 } |
| 122 | 123 |
| 123 std::unique_ptr<protocol::Debugger::Location> currentDebugLocation(V8InspectorIm
pl* inspector) | 124 std::unique_ptr<protocol::Debugger::Location> currentDebugLocation(V8InspectorIm
pl* inspector) |
| 124 { | 125 { |
| 125 std::unique_ptr<V8StackTrace> callStack = inspector->captureStackTrace(1); | 126 std::unique_ptr<V8StackTraceImpl> callStack = inspector->debugger()->capture
StackTrace(false /* fullStack */); |
| 126 auto location = protocol::Debugger::Location::create() | 127 auto location = protocol::Debugger::Location::create() |
| 127 .setScriptId(callStack->topScriptId()) | 128 .setScriptId(toString16(callStack->topScriptId())) |
| 128 .setLineNumber(callStack->topLineNumber()).build(); | 129 .setLineNumber(callStack->topLineNumber()).build(); |
| 129 location->setColumnNumber(callStack->topColumnNumber()); | 130 location->setColumnNumber(callStack->topColumnNumber()); |
| 130 return location; | 131 return location; |
| 131 } | 132 } |
| 132 | 133 |
| 133 volatile int s_lastProfileId = 0; | 134 volatile int s_lastProfileId = 0; |
| 134 | 135 |
| 135 } // namespace | 136 } // namespace |
| 136 | 137 |
| 137 class V8ProfilerAgentImpl::ProfileDescriptor { | 138 class V8ProfilerAgentImpl::ProfileDescriptor { |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 326 v8::CpuProfiler* V8ProfilerAgentImpl::profiler() | 327 v8::CpuProfiler* V8ProfilerAgentImpl::profiler() |
| 327 { | 328 { |
| 328 #if ENSURE_V8_VERSION(5, 4) | 329 #if ENSURE_V8_VERSION(5, 4) |
| 329 return m_profiler; | 330 return m_profiler; |
| 330 #else | 331 #else |
| 331 return m_isolate->GetCpuProfiler(); | 332 return m_isolate->GetCpuProfiler(); |
| 332 #endif | 333 #endif |
| 333 } | 334 } |
| 334 | 335 |
| 335 } // namespace v8_inspector | 336 } // namespace v8_inspector |
| OLD | NEW |