Chromium Code Reviews| 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/inspector_protocol/String16.h" | 7 #include "platform/inspector_protocol/String16.h" |
| 8 #include "platform/v8_inspector/V8DebuggerAgentImpl.h" | 8 #include "platform/v8_inspector/V8DebuggerAgentImpl.h" |
| 9 #include "platform/v8_inspector/V8DebuggerImpl.h" | 9 #include "platform/v8_inspector/V8DebuggerImpl.h" |
| 10 #include "platform/v8_inspector/V8StringUtil.h" | 10 #include "platform/v8_inspector/V8StringUtil.h" |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 78 { | 78 { |
| 79 return protocol::Runtime::CallFrame::create() | 79 return protocol::Runtime::CallFrame::create() |
| 80 .setFunctionName(m_functionName) | 80 .setFunctionName(m_functionName) |
| 81 .setScriptId(m_scriptId) | 81 .setScriptId(m_scriptId) |
| 82 .setUrl(m_scriptName) | 82 .setUrl(m_scriptName) |
| 83 .setLineNumber(m_lineNumber) | 83 .setLineNumber(m_lineNumber) |
| 84 .setColumnNumber(m_columnNumber) | 84 .setColumnNumber(m_columnNumber) |
| 85 .build(); | 85 .build(); |
| 86 } | 86 } |
| 87 | 87 |
| 88 V8StackTraceImpl::Frame V8StackTraceImpl::Frame::isolatedCopy() const | |
| 89 { | |
| 90 return Frame(m_functionName.isolatedCopy(), m_scriptId.isolatedCopy(), m_scr iptName.isolatedCopy(), m_lineNumber, m_columnNumber); | |
|
pfeldman
2016/06/08 02:22:18
We should not pass this struct between threads at
| |
| 91 } | |
| 92 | |
| 88 std::unique_ptr<V8StackTraceImpl> V8StackTraceImpl::create(V8DebuggerAgentImpl* agent, v8::Local<v8::StackTrace> stackTrace, size_t maxStackSize, const String16 & description) | 93 std::unique_ptr<V8StackTraceImpl> V8StackTraceImpl::create(V8DebuggerAgentImpl* agent, v8::Local<v8::StackTrace> stackTrace, size_t maxStackSize, const String16 & description) |
| 89 { | 94 { |
| 90 v8::Isolate* isolate = v8::Isolate::GetCurrent(); | 95 v8::Isolate* isolate = v8::Isolate::GetCurrent(); |
| 91 v8::HandleScope scope(isolate); | 96 v8::HandleScope scope(isolate); |
| 92 protocol::Vector<V8StackTraceImpl::Frame> frames; | 97 protocol::Vector<V8StackTraceImpl::Frame> frames; |
| 93 if (!stackTrace.IsEmpty()) | 98 if (!stackTrace.IsEmpty()) |
| 94 toFramesVector(stackTrace, frames, maxStackSize, isolate); | 99 toFramesVector(stackTrace, frames, maxStackSize, isolate); |
| 95 | 100 |
| 96 int maxAsyncCallChainDepth = 1; | 101 int maxAsyncCallChainDepth = 1; |
| 97 V8StackTraceImpl* asyncCallChain = nullptr; | 102 V8StackTraceImpl* asyncCallChain = nullptr; |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 139 { | 144 { |
| 140 return cloneImpl(); | 145 return cloneImpl(); |
| 141 } | 146 } |
| 142 | 147 |
| 143 std::unique_ptr<V8StackTraceImpl> V8StackTraceImpl::cloneImpl() | 148 std::unique_ptr<V8StackTraceImpl> V8StackTraceImpl::cloneImpl() |
| 144 { | 149 { |
| 145 protocol::Vector<Frame> framesCopy(m_frames); | 150 protocol::Vector<Frame> framesCopy(m_frames); |
| 146 return wrapUnique(new V8StackTraceImpl(m_description, framesCopy, m_parent ? m_parent->cloneImpl() : nullptr)); | 151 return wrapUnique(new V8StackTraceImpl(m_description, framesCopy, m_parent ? m_parent->cloneImpl() : nullptr)); |
| 147 } | 152 } |
| 148 | 153 |
| 154 std::unique_ptr<V8StackTrace> V8StackTraceImpl::isolatedCopy() | |
| 155 { | |
| 156 return isolatedCopyImpl(); | |
| 157 } | |
| 158 | |
| 159 std::unique_ptr<V8StackTraceImpl> V8StackTraceImpl::isolatedCopyImpl() | |
| 160 { | |
| 161 protocol::Vector<Frame> frames; | |
| 162 for (size_t i = 0; i < m_frames.size(); i++) | |
| 163 frames.append(m_frames.at(i).isolatedCopy()); | |
| 164 return wrapUnique(new V8StackTraceImpl(m_description.isolatedCopy(), frames, m_parent ? m_parent->isolatedCopyImpl() : nullptr)); | |
| 165 } | |
| 166 | |
| 149 V8StackTraceImpl::V8StackTraceImpl(const String16& description, protocol::Vector <Frame>& frames, std::unique_ptr<V8StackTraceImpl> parent) | 167 V8StackTraceImpl::V8StackTraceImpl(const String16& description, protocol::Vector <Frame>& frames, std::unique_ptr<V8StackTraceImpl> parent) |
| 150 : m_description(description) | 168 : m_description(description) |
| 151 , m_parent(std::move(parent)) | 169 , m_parent(std::move(parent)) |
| 152 { | 170 { |
| 153 m_frames.swap(frames); | 171 m_frames.swap(frames); |
| 154 } | 172 } |
| 155 | 173 |
| 156 V8StackTraceImpl::~V8StackTraceImpl() | 174 V8StackTraceImpl::~V8StackTraceImpl() |
| 157 { | 175 { |
| 158 } | 176 } |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 223 stackTrace.append(':'); | 241 stackTrace.append(':'); |
| 224 stackTrace.appendNumber(frame.lineNumber()); | 242 stackTrace.appendNumber(frame.lineNumber()); |
| 225 stackTrace.append(':'); | 243 stackTrace.append(':'); |
| 226 stackTrace.appendNumber(frame.columnNumber()); | 244 stackTrace.appendNumber(frame.columnNumber()); |
| 227 stackTrace.append(')'); | 245 stackTrace.append(')'); |
| 228 } | 246 } |
| 229 return stackTrace.toString(); | 247 return stackTrace.toString(); |
| 230 } | 248 } |
| 231 | 249 |
| 232 } // namespace blink | 250 } // namespace blink |
| OLD | NEW |