| 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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 .setNodes(std::move(nodes)) | 110 .setNodes(std::move(nodes)) |
| 110 .setStartTime(static_cast<double>(v8profile->GetStartTime()) / 1000000) | 111 .setStartTime(static_cast<double>(v8profile->GetStartTime()) / 1000000) |
| 111 .setEndTime(static_cast<double>(v8profile->GetEndTime()) / 1000000).buil
d(); | 112 .setEndTime(static_cast<double>(v8profile->GetEndTime()) / 1000000).buil
d(); |
| 112 profile->setSamples(buildInspectorObjectForSamples(v8profile)); | 113 profile->setSamples(buildInspectorObjectForSamples(v8profile)); |
| 113 profile->setTimestamps(buildInspectorObjectForTimestamps(v8profile)); | 114 profile->setTimestamps(buildInspectorObjectForTimestamps(v8profile)); |
| 114 return profile; | 115 return profile; |
| 115 } | 116 } |
| 116 | 117 |
| 117 std::unique_ptr<protocol::Debugger::Location> currentDebugLocation(V8InspectorIm
pl* inspector) | 118 std::unique_ptr<protocol::Debugger::Location> currentDebugLocation(V8InspectorIm
pl* inspector) |
| 118 { | 119 { |
| 119 std::unique_ptr<V8StackTrace> callStack = inspector->captureStackTrace(1); | 120 std::unique_ptr<V8StackTraceImpl> callStack = inspector->debugger()->capture
StackTrace(false /* fullStack */); |
| 120 std::unique_ptr<protocol::Debugger::Location> location = protocol::Debugger:
:Location::create() | 121 std::unique_ptr<protocol::Debugger::Location> location = protocol::Debugger:
:Location::create() |
| 121 .setScriptId(callStack->topScriptId()) | 122 .setScriptId(toString16(callStack->topScriptId())) |
| 122 .setLineNumber(callStack->topLineNumber()).build(); | 123 .setLineNumber(callStack->topLineNumber()).build(); |
| 123 location->setColumnNumber(callStack->topColumnNumber()); | 124 location->setColumnNumber(callStack->topColumnNumber()); |
| 124 return location; | 125 return location; |
| 125 } | 126 } |
| 126 | 127 |
| 127 volatile int s_lastProfileId = 0; | 128 volatile int s_lastProfileId = 0; |
| 128 | 129 |
| 129 } // namespace | 130 } // namespace |
| 130 | 131 |
| 131 class V8ProfilerAgentImpl::ProfileDescriptor { | 132 class V8ProfilerAgentImpl::ProfileDescriptor { |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 320 v8::CpuProfiler* V8ProfilerAgentImpl::profiler() | 321 v8::CpuProfiler* V8ProfilerAgentImpl::profiler() |
| 321 { | 322 { |
| 322 #if ENSURE_V8_VERSION(5, 4) | 323 #if ENSURE_V8_VERSION(5, 4) |
| 323 return m_profiler; | 324 return m_profiler; |
| 324 #else | 325 #else |
| 325 return m_isolate->GetCpuProfiler(); | 326 return m_isolate->GetCpuProfiler(); |
| 326 #endif | 327 #endif |
| 327 } | 328 } |
| 328 | 329 |
| 329 } // namespace v8_inspector | 330 } // namespace v8_inspector |
| OLD | NEW |