OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 the V8 project 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 "src/inspector/v8-stack-trace-impl.h" | 5 #include "src/inspector/v8-stack-trace-impl.h" |
6 | 6 |
7 #include "src/inspector/string-util.h" | 7 #include "src/inspector/string-util.h" |
8 #include "src/inspector/v8-debugger.h" | 8 #include "src/inspector/v8-debugger.h" |
9 #include "src/inspector/v8-inspector-impl.h" | 9 #include "src/inspector/v8-inspector-impl.h" |
10 #include "src/inspector/v8-profiler-agent-impl.h" | 10 #include "src/inspector/v8-profiler-agent-impl.h" |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 V8StackTraceImpl* deepest = result.get(); | 146 V8StackTraceImpl* deepest = result.get(); |
147 while (deepest && maxAsyncCallChainDepth) { | 147 while (deepest && maxAsyncCallChainDepth) { |
148 deepest = deepest->m_parent.get(); | 148 deepest = deepest->m_parent.get(); |
149 maxAsyncCallChainDepth--; | 149 maxAsyncCallChainDepth--; |
150 } | 150 } |
151 if (deepest) deepest->m_parent.reset(); | 151 if (deepest) deepest->m_parent.reset(); |
152 | 152 |
153 return result; | 153 return result; |
154 } | 154 } |
155 | 155 |
| 156 // static |
156 std::unique_ptr<V8StackTraceImpl> V8StackTraceImpl::capture( | 157 std::unique_ptr<V8StackTraceImpl> V8StackTraceImpl::capture( |
157 V8Debugger* debugger, int contextGroupId, size_t maxStackSize, | 158 V8Debugger* debugger, int contextGroupId, size_t maxStackSize, |
158 const String16& description) { | 159 const String16& description) { |
159 v8::Isolate* isolate = v8::Isolate::GetCurrent(); | 160 v8::Isolate* isolate = v8::Isolate::GetCurrent(); |
160 v8::HandleScope handleScope(isolate); | 161 v8::HandleScope handleScope(isolate); |
161 v8::Local<v8::StackTrace> stackTrace; | 162 v8::Local<v8::StackTrace> stackTrace; |
162 if (isolate->InContext()) { | 163 if (isolate->InContext()) { |
163 if (debugger) { | 164 if (debugger) { |
164 V8InspectorImpl* inspector = debugger->inspector(); | 165 V8InspectorImpl* inspector = debugger->inspector(); |
165 V8ProfilerAgentImpl* profilerAgent = | 166 V8ProfilerAgentImpl* profilerAgent = |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 stackTrace.append(String16::fromInteger(frame.lineNumber())); | 272 stackTrace.append(String16::fromInteger(frame.lineNumber())); |
272 stackTrace.append(':'); | 273 stackTrace.append(':'); |
273 stackTrace.append(String16::fromInteger(frame.columnNumber())); | 274 stackTrace.append(String16::fromInteger(frame.columnNumber())); |
274 stackTrace.append(')'); | 275 stackTrace.append(')'); |
275 } | 276 } |
276 String16 string = stackTrace.toString(); | 277 String16 string = stackTrace.toString(); |
277 return StringBufferImpl::adopt(string); | 278 return StringBufferImpl::adopt(string); |
278 } | 279 } |
279 | 280 |
280 } // namespace v8_inspector | 281 } // namespace v8_inspector |
OLD | NEW |