OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/V8StackTraceImpl.h" | 5 #include "platform/v8_inspector/V8StackTraceImpl.h" |
6 | 6 |
| 7 #include "platform/v8_inspector/StringUtil.h" |
7 #include "platform/v8_inspector/V8Debugger.h" | 8 #include "platform/v8_inspector/V8Debugger.h" |
8 #include "platform/v8_inspector/V8StringUtil.h" | 9 #include "platform/v8_inspector/protocol/Protocol.h" |
9 | 10 |
10 #include <v8-debug.h> | 11 #include <v8-debug.h> |
11 #include <v8-profiler.h> | 12 #include <v8-profiler.h> |
12 #include <v8-version.h> | 13 #include <v8-version.h> |
13 | 14 |
14 namespace v8_inspector { | 15 namespace v8_inspector { |
15 | 16 |
16 namespace { | 17 namespace { |
17 | 18 |
18 static const v8::StackTrace::StackTraceOptions stackTraceOptions = static_cast<v
8::StackTrace::StackTraceOptions>( | 19 static const v8::StackTrace::StackTraceOptions stackTraceOptions = static_cast<v
8::StackTrace::StackTraceOptions>( |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 .setFunctionName(m_functionName) | 87 .setFunctionName(m_functionName) |
87 .setScriptId(m_scriptId) | 88 .setScriptId(m_scriptId) |
88 .setUrl(m_scriptName) | 89 .setUrl(m_scriptName) |
89 .setLineNumber(m_lineNumber - 1) | 90 .setLineNumber(m_lineNumber - 1) |
90 .setColumnNumber(m_columnNumber - 1) | 91 .setColumnNumber(m_columnNumber - 1) |
91 .build(); | 92 .build(); |
92 } | 93 } |
93 | 94 |
94 V8StackTraceImpl::Frame V8StackTraceImpl::Frame::clone() const | 95 V8StackTraceImpl::Frame V8StackTraceImpl::Frame::clone() const |
95 { | 96 { |
96 return Frame(m_functionName.isolatedCopy(), m_scriptId.isolatedCopy(), m_scr
iptName.isolatedCopy(), m_lineNumber, m_columnNumber); | 97 return Frame(m_functionName, m_scriptId, m_scriptName, m_lineNumber, m_colum
nNumber); |
97 } | 98 } |
98 | 99 |
99 // static | 100 // static |
100 void V8StackTraceImpl::setCaptureStackTraceForUncaughtExceptions(v8::Isolate* is
olate, bool capture) | 101 void V8StackTraceImpl::setCaptureStackTraceForUncaughtExceptions(v8::Isolate* is
olate, bool capture) |
101 { | 102 { |
102 isolate->SetCaptureStackTraceForUncaughtExceptions(capture, V8StackTraceImpl
::maxCallStackSizeToCapture, stackTraceOptions); | 103 isolate->SetCaptureStackTraceForUncaughtExceptions(capture, V8StackTraceImpl
::maxCallStackSizeToCapture, stackTraceOptions); |
103 } | 104 } |
104 | 105 |
105 // static | 106 // static |
106 std::unique_ptr<V8StackTraceImpl> V8StackTraceImpl::create(V8Debugger* debugger,
int contextGroupId, v8::Local<v8::StackTrace> stackTrace, size_t maxStackSize,
const String16& description) | 107 std::unique_ptr<V8StackTraceImpl> V8StackTraceImpl::create(V8Debugger* debugger,
int contextGroupId, v8::Local<v8::StackTrace> stackTrace, size_t maxStackSize,
const String16& description) |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 { | 164 { |
164 std::vector<Frame> framesCopy(m_frames); | 165 std::vector<Frame> framesCopy(m_frames); |
165 return wrapUnique(new V8StackTraceImpl(m_contextGroupId, m_description, fram
esCopy, m_parent ? m_parent->cloneImpl() : nullptr)); | 166 return wrapUnique(new V8StackTraceImpl(m_contextGroupId, m_description, fram
esCopy, m_parent ? m_parent->cloneImpl() : nullptr)); |
166 } | 167 } |
167 | 168 |
168 std::unique_ptr<V8StackTrace> V8StackTraceImpl::clone() | 169 std::unique_ptr<V8StackTrace> V8StackTraceImpl::clone() |
169 { | 170 { |
170 std::vector<Frame> frames; | 171 std::vector<Frame> frames; |
171 for (size_t i = 0; i < m_frames.size(); i++) | 172 for (size_t i = 0; i < m_frames.size(); i++) |
172 frames.push_back(m_frames.at(i).clone()); | 173 frames.push_back(m_frames.at(i).clone()); |
173 return wrapUnique(new V8StackTraceImpl(m_contextGroupId, m_description.isola
tedCopy(), frames, nullptr)); | 174 return wrapUnique(new V8StackTraceImpl(m_contextGroupId, m_description, fram
es, nullptr)); |
174 } | 175 } |
175 | 176 |
176 V8StackTraceImpl::V8StackTraceImpl(int contextGroupId, const String16& descripti
on, std::vector<Frame>& frames, std::unique_ptr<V8StackTraceImpl> parent) | 177 V8StackTraceImpl::V8StackTraceImpl(int contextGroupId, const String16& descripti
on, std::vector<Frame>& frames, std::unique_ptr<V8StackTraceImpl> parent) |
177 : m_contextGroupId(contextGroupId) | 178 : m_contextGroupId(contextGroupId) |
178 , m_description(description) | 179 , m_description(description) |
179 , m_parent(std::move(parent)) | 180 , m_parent(std::move(parent)) |
180 { | 181 { |
181 m_frames.swap(frames); | 182 m_frames.swap(frames); |
182 } | 183 } |
183 | 184 |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 stackTrace.append(String16::fromInteger(frame.lineNumber())); | 258 stackTrace.append(String16::fromInteger(frame.lineNumber())); |
258 stackTrace.append(':'); | 259 stackTrace.append(':'); |
259 stackTrace.append(String16::fromInteger(frame.columnNumber())); | 260 stackTrace.append(String16::fromInteger(frame.columnNumber())); |
260 stackTrace.append(')'); | 261 stackTrace.append(')'); |
261 } | 262 } |
262 String16 string = stackTrace.toString(); | 263 String16 string = stackTrace.toString(); |
263 return StringBufferImpl::adopt(string); | 264 return StringBufferImpl::adopt(string); |
264 } | 265 } |
265 | 266 |
266 } // namespace v8_inspector | 267 } // namespace v8_inspector |
OLD | NEW |