| 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/V8DebuggerAgentImpl.h" | 5 #include "platform/v8_inspector/V8DebuggerAgentImpl.h" |
| 6 | 6 |
| 7 #include "platform/inspector_protocol/String16.h" | 7 #include "platform/inspector_protocol/String16.h" |
| 8 #include "platform/inspector_protocol/Values.h" | 8 #include "platform/inspector_protocol/Values.h" |
| 9 #include "platform/v8_inspector/InjectedScript.h" | 9 #include "platform/v8_inspector/InjectedScript.h" |
| 10 #include "platform/v8_inspector/InspectedContext.h" | 10 #include "platform/v8_inspector/InspectedContext.h" |
| (...skipping 973 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 984 return; | 984 return; |
| 985 m_state->setNumber(DebuggerAgentState::asyncCallStackDepth, depth); | 985 m_state->setNumber(DebuggerAgentState::asyncCallStackDepth, depth); |
| 986 internalSetAsyncCallStackDepth(depth); | 986 internalSetAsyncCallStackDepth(depth); |
| 987 } | 987 } |
| 988 | 988 |
| 989 void V8DebuggerAgentImpl::asyncTaskScheduled(const String16& taskName, void* tas
k, bool recurring) | 989 void V8DebuggerAgentImpl::asyncTaskScheduled(const String16& taskName, void* tas
k, bool recurring) |
| 990 { | 990 { |
| 991 if (!m_maxAsyncCallStackDepth) | 991 if (!m_maxAsyncCallStackDepth) |
| 992 return; | 992 return; |
| 993 v8::HandleScope scope(m_isolate); | 993 v8::HandleScope scope(m_isolate); |
| 994 std::unique_ptr<V8StackTraceImpl> chain = V8StackTraceImpl::capture(this, V8
StackTrace::maxCallStackSizeToCapture, taskName); | 994 std::unique_ptr<V8StackTraceImpl> chain = V8StackTraceImpl::capture(this, V8
StackTraceImpl::maxCallStackSizeToCapture, taskName); |
| 995 if (chain) { | 995 if (chain) { |
| 996 m_asyncTaskStacks.set(task, std::move(chain)); | 996 m_asyncTaskStacks.set(task, std::move(chain)); |
| 997 if (recurring) | 997 if (recurring) |
| 998 m_recurringTasks.add(task); | 998 m_recurringTasks.add(task); |
| 999 } | 999 } |
| 1000 } | 1000 } |
| 1001 | 1001 |
| 1002 void V8DebuggerAgentImpl::asyncTaskCanceled(void* task) | 1002 void V8DebuggerAgentImpl::asyncTaskCanceled(void* task) |
| 1003 { | 1003 { |
| 1004 if (!m_maxAsyncCallStackDepth) | 1004 if (!m_maxAsyncCallStackDepth) |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1165 m_skipNextDebuggerStepOut = true; | 1165 m_skipNextDebuggerStepOut = true; |
| 1166 } | 1166 } |
| 1167 } | 1167 } |
| 1168 } | 1168 } |
| 1169 | 1169 |
| 1170 std::unique_ptr<Array<CallFrame>> V8DebuggerAgentImpl::currentCallFrames(ErrorSt
ring* errorString) | 1170 std::unique_ptr<Array<CallFrame>> V8DebuggerAgentImpl::currentCallFrames(ErrorSt
ring* errorString) |
| 1171 { | 1171 { |
| 1172 if (m_pausedContext.IsEmpty() || !m_pausedCallFrames.size()) | 1172 if (m_pausedContext.IsEmpty() || !m_pausedCallFrames.size()) |
| 1173 return Array<CallFrame>::create(); | 1173 return Array<CallFrame>::create(); |
| 1174 ErrorString ignored; | 1174 ErrorString ignored; |
| 1175 InjectedScript* topFrameInjectedScript = m_session->findInjectedScript(&igno
red, V8Debugger::contextId(m_pausedContext.Get(m_isolate))); | 1175 InjectedScript* topFrameInjectedScript = m_session->findInjectedScript(&igno
red, V8DebuggerImpl::contextId(m_pausedContext.Get(m_isolate))); |
| 1176 if (!topFrameInjectedScript) { | 1176 if (!topFrameInjectedScript) { |
| 1177 // Context has been reported as removed while on pause. | 1177 // Context has been reported as removed while on pause. |
| 1178 return Array<CallFrame>::create(); | 1178 return Array<CallFrame>::create(); |
| 1179 } | 1179 } |
| 1180 | 1180 |
| 1181 v8::HandleScope handles(m_isolate); | 1181 v8::HandleScope handles(m_isolate); |
| 1182 v8::Local<v8::Context> context = topFrameInjectedScript->context()->context(
); | 1182 v8::Local<v8::Context> context = topFrameInjectedScript->context()->context(
); |
| 1183 v8::Context::Scope contextScope(context); | 1183 v8::Context::Scope contextScope(context); |
| 1184 | 1184 |
| 1185 v8::Local<v8::Array> objects = v8::Array::New(m_isolate); | 1185 v8::Local<v8::Array> objects = v8::Array::New(m_isolate); |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1330 if (!topCallFrame) | 1330 if (!topCallFrame) |
| 1331 return RequestContinue; | 1331 return RequestContinue; |
| 1332 | 1332 |
| 1333 DCHECK(m_pausedContext.IsEmpty()); | 1333 DCHECK(m_pausedContext.IsEmpty()); |
| 1334 m_pausedCallFrames.swap(debugger().currentCallFrames()); | 1334 m_pausedCallFrames.swap(debugger().currentCallFrames()); |
| 1335 m_pausedContext.Reset(m_isolate, context); | 1335 m_pausedContext.Reset(m_isolate, context); |
| 1336 v8::HandleScope handles(m_isolate); | 1336 v8::HandleScope handles(m_isolate); |
| 1337 | 1337 |
| 1338 if (!exception.IsEmpty()) { | 1338 if (!exception.IsEmpty()) { |
| 1339 ErrorString ignored; | 1339 ErrorString ignored; |
| 1340 InjectedScript* injectedScript = m_session->findInjectedScript(&ignored,
V8Debugger::contextId(context)); | 1340 InjectedScript* injectedScript = m_session->findInjectedScript(&ignored,
V8DebuggerImpl::contextId(context)); |
| 1341 if (injectedScript) { | 1341 if (injectedScript) { |
| 1342 m_breakReason = isPromiseRejection ? protocol::Debugger::Paused::Rea
sonEnum::PromiseRejection : protocol::Debugger::Paused::ReasonEnum::Exception; | 1342 m_breakReason = isPromiseRejection ? protocol::Debugger::Paused::Rea
sonEnum::PromiseRejection : protocol::Debugger::Paused::ReasonEnum::Exception; |
| 1343 ErrorString errorString; | 1343 ErrorString errorString; |
| 1344 auto obj = injectedScript->wrapObject(&errorString, exception, V8Ins
pectorSession::backtraceObjectGroup); | 1344 auto obj = injectedScript->wrapObject(&errorString, exception, V8Ins
pectorSession::backtraceObjectGroup); |
| 1345 m_breakAuxData = obj ? obj->serialize() : nullptr; | 1345 m_breakAuxData = obj ? obj->serialize() : nullptr; |
| 1346 // m_breakAuxData might be null after this. | 1346 // m_breakAuxData might be null after this. |
| 1347 } | 1347 } |
| 1348 } | 1348 } |
| 1349 | 1349 |
| 1350 std::unique_ptr<Array<String16>> hitBreakpointIds = Array<String16>::create(
); | 1350 std::unique_ptr<Array<String16>> hitBreakpointIds = Array<String16>::create(
); |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1437 if (!enabled()) | 1437 if (!enabled()) |
| 1438 return; | 1438 return; |
| 1439 m_scheduledDebuggerStep = NoStep; | 1439 m_scheduledDebuggerStep = NoStep; |
| 1440 m_scripts.clear(); | 1440 m_scripts.clear(); |
| 1441 m_blackboxedPositions.clear(); | 1441 m_blackboxedPositions.clear(); |
| 1442 m_breakpointIdToDebuggerBreakpointIds.clear(); | 1442 m_breakpointIdToDebuggerBreakpointIds.clear(); |
| 1443 allAsyncTasksCanceled(); | 1443 allAsyncTasksCanceled(); |
| 1444 } | 1444 } |
| 1445 | 1445 |
| 1446 } // namespace blink | 1446 } // namespace blink |
| OLD | NEW |