Chromium Code Reviews| Index: third_party/WebKit/Source/core/inspector/v8/V8DebuggerAgentImpl.cpp |
| diff --git a/third_party/WebKit/Source/core/inspector/v8/V8DebuggerAgentImpl.cpp b/third_party/WebKit/Source/core/inspector/v8/V8DebuggerAgentImpl.cpp |
| index 4eeb32846b2385d880322d1b517ab040bab127b8..562061d31e32cbf499df7575625505714abb9d37 100644 |
| --- a/third_party/WebKit/Source/core/inspector/v8/V8DebuggerAgentImpl.cpp |
| +++ b/third_party/WebKit/Source/core/inspector/v8/V8DebuggerAgentImpl.cpp |
| @@ -9,7 +9,6 @@ |
| #include "bindings/core/v8/V8RecursionScope.h" |
| #include "core/dom/Microtask.h" |
| #include "core/inspector/ContentSearchUtils.h" |
| -#include "core/inspector/ScriptAsyncCallStack.h" |
| #include "core/inspector/ScriptCallFrame.h" |
| #include "core/inspector/ScriptCallStack.h" |
| #include "core/inspector/v8/AsyncCallChain.h" |
| @@ -29,7 +28,6 @@ |
| #include "wtf/text/WTFString.h" |
| using blink::TypeBuilder::Array; |
| -using blink::TypeBuilder::Console::AsyncStackTrace; |
| using blink::TypeBuilder::Debugger::AsyncOperation; |
| using blink::TypeBuilder::Debugger::BreakpointId; |
| using blink::TypeBuilder::Debugger::CallFrame; |
| @@ -41,6 +39,7 @@ using blink::TypeBuilder::Debugger::PromiseDetails; |
| using blink::TypeBuilder::Runtime::ScriptId; |
| using blink::TypeBuilder::Debugger::StackTrace; |
| using blink::TypeBuilder::Runtime::RemoteObject; |
| +using RuntimeStack = blink::TypeBuilder::Runtime::StackTrace; |
|
dgozman
2016/02/04 01:43:06
unused
pfeldman
2016/02/04 03:15:59
Done.
|
| namespace blink { |
| @@ -99,12 +98,11 @@ static ScriptCallFrame toScriptCallFrame(JavaScriptCallFrame* callFrame) |
| return ScriptCallFrame(callFrame->functionName(), scriptId, callFrame->scriptName(), line, column); |
| } |
| -static PassRefPtr<ScriptCallStack> toScriptCallStack(JavaScriptCallFrame* callFrame) |
| +static void toScriptCallFrames(JavaScriptCallFrame* callFrame, Vector<ScriptCallFrame>& frames) |
|
dgozman
2016/02/04 01:43:06
non-const reference is prohibited
pfeldman
2016/02/04 03:15:59
Acknowledged.
|
| { |
| - Vector<ScriptCallFrame> frames; |
| + Vector<ScriptCallFrame> callFrames; |
| for (; callFrame; callFrame = callFrame->caller()) |
| - frames.append(toScriptCallFrame(callFrame)); |
| - return ScriptCallStack::create(frames); |
| + callFrames.append(toScriptCallFrame(callFrame)); |
| } |
| static PassRefPtr<JavaScriptCallFrame> toJavaScriptCallFrame(v8::Local<v8::Context> context, v8::Local<v8::Object> value) |
| @@ -114,12 +112,6 @@ static PassRefPtr<JavaScriptCallFrame> toJavaScriptCallFrame(v8::Local<v8::Conte |
| return V8JavaScriptCallFrame::unwrap(context, value); |
| } |
| -static PassRefPtr<ScriptCallStack> toScriptCallStack(v8::Local<v8::Context> context, v8::Local<v8::Object> callFrames) |
| -{ |
| - RefPtr<JavaScriptCallFrame> jsCallFrame = toJavaScriptCallFrame(context, callFrames); |
| - return jsCallFrame ? toScriptCallStack(jsCallFrame.get()) : nullptr; |
| -} |
| - |
| static bool positionComparator(const std::pair<int, int>& a, const std::pair<int, int>& b) |
| { |
| if (a.first != b.first) |
| @@ -1151,33 +1143,25 @@ void V8DebuggerAgentImpl::flushAsyncOperationEvents(ErrorString*) |
| const AsyncCallStackVector& callStacks = chain->callStacks(); |
| ASSERT(!callStacks.isEmpty()); |
| - RefPtr<AsyncOperation> operation; |
| - RefPtr<AsyncStackTrace> lastAsyncStackTrace; |
| - for (const auto& callStack : callStacks) { |
| - v8::HandleScope scope(m_isolate); |
| - RefPtr<ScriptCallStack> scriptCallStack = toScriptCallStack(chain->creationContext(m_isolate), callStack->callFrames(m_isolate)); |
| - if (!scriptCallStack) |
| - break; |
| - if (!operation) { |
| - operation = AsyncOperation::create() |
| - .setId(operationId) |
| - .setDescription(callStack->description()) |
| - .release(); |
| - operation->setStackTrace(scriptCallStack->buildInspectorArray()); |
| + RefPtr<ScriptCallStack> stack; |
| + v8::HandleScope scope(m_isolate); |
| + for (int i = callStacks.size() - 1; i >= 0; --i) { |
| + v8::Local<v8::Object> callFrames = callStacks.at(i)->callFrames(m_isolate); |
| + RefPtr<JavaScriptCallFrame> jsCallFrame = toJavaScriptCallFrame(chain->creationContext(m_isolate), callFrames); |
| + if (!jsCallFrame) |
| continue; |
| - } |
| - RefPtr<AsyncStackTrace> asyncStackTrace = AsyncStackTrace::create() |
| - .setCallFrames(scriptCallStack->buildInspectorArray()); |
| - asyncStackTrace->setDescription(callStack->description()); |
| - if (lastAsyncStackTrace) |
| - lastAsyncStackTrace->setAsyncStackTrace(asyncStackTrace); |
| - else |
| - operation->setAsyncStackTrace(asyncStackTrace); |
| - lastAsyncStackTrace = asyncStackTrace.release(); |
| + Vector<ScriptCallFrame> frames; |
| + toScriptCallFrames(jsCallFrame.get(), frames); |
| + stack = ScriptCallStack::create(callStacks.at(i)->description(), frames, stack); |
| } |
| - if (operation) |
| + if (stack) { |
| + RefPtr<AsyncOperation> operation = AsyncOperation::create() |
| + .setId(operationId) |
| + .release(); |
| + operation->setStack(stack->buildInspectorObject()); |
| m_frontend->asyncOperationStarted(operation.release()); |
| + } |
| } |
| m_asyncOperationNotifications.clear(); |
| @@ -1372,7 +1356,7 @@ PassRefPtr<StackTrace> V8DebuggerAgentImpl::currentAsyncStackTrace() |
| return result.release(); |
| } |
| -PassRefPtr<ScriptAsyncCallStack> V8DebuggerAgentImpl::currentAsyncStackTraceForConsole() |
| +PassRefPtr<ScriptCallStack> V8DebuggerAgentImpl::currentAsyncStackTraceForConsole() |
| { |
| if (!trackingAsyncCalls()) |
| return nullptr; |
| @@ -1382,13 +1366,15 @@ PassRefPtr<ScriptAsyncCallStack> V8DebuggerAgentImpl::currentAsyncStackTraceForC |
| const AsyncCallStackVector& callStacks = chain->callStacks(); |
| if (callStacks.isEmpty()) |
| return nullptr; |
| - RefPtr<ScriptAsyncCallStack> result; |
| + RefPtr<ScriptCallStack> result; |
| for (AsyncCallStackVector::const_reverse_iterator it = callStacks.rbegin(); it != callStacks.rend(); ++it) { |
| v8::HandleScope scope(m_isolate); |
| RefPtr<JavaScriptCallFrame> callFrame = toJavaScriptCallFrame(chain->creationContext(m_isolate), (*it)->callFrames(m_isolate)); |
| if (!callFrame) |
| break; |
| - result = ScriptAsyncCallStack::create((*it)->description(), toScriptCallStack(callFrame.get()), result.release()); |
| + Vector<ScriptCallFrame> frames; |
| + toScriptCallFrames(callFrame.get(), frames); |
| + result = ScriptCallStack::create((*it)->description(), frames, result.release()); |
| } |
| return result.release(); |
| } |