| Index: src/inspector/v8-debugger.cc
|
| diff --git a/src/inspector/v8-debugger.cc b/src/inspector/v8-debugger.cc
|
| index 39cc556fb920bebb164c7b077e7aef6e340dd837..d116a453a94f00318812c8b20dda1bf7d9d7a6c7 100644
|
| --- a/src/inspector/v8-debugger.cc
|
| +++ b/src/inspector/v8-debugger.cc
|
| @@ -72,6 +72,8 @@ void V8Debugger::enable() {
|
| v8::External::New(m_isolate, this));
|
| v8::debug::SetAsyncTaskListener(m_isolate, &V8Debugger::v8AsyncTaskListener,
|
| this);
|
| + v8::debug::SetOutOfMemoryCallback(m_isolate, &V8Debugger::v8OOMCallback,
|
| + this);
|
| m_debuggerContext.Reset(m_isolate, v8::debug::GetDebugContext(m_isolate));
|
| v8::debug::ChangeBreakOnException(m_isolate, v8::debug::NoBreakOnException);
|
| m_pauseOnExceptionsState = v8::debug::NoBreakOnException;
|
| @@ -88,6 +90,9 @@ void V8Debugger::disable() {
|
| m_wasmTranslation.Clear();
|
| v8::debug::SetDebugEventListener(m_isolate, nullptr);
|
| v8::debug::SetAsyncTaskListener(m_isolate, nullptr, nullptr);
|
| + v8::debug::SetOutOfMemoryCallback(m_isolate, &V8Debugger::v8OOMCallback,
|
| + nullptr);
|
| + m_isolate->RestoreOriginalHeapLimit();
|
| }
|
|
|
| bool V8Debugger::enabled() const { return !m_debuggerScript.IsEmpty(); }
|
| @@ -480,8 +485,9 @@ void V8Debugger::handleProgramBreak(v8::Local<v8::Context> pausedContext,
|
|
|
| m_pausedContext = pausedContext;
|
| m_executionState = executionState;
|
| - V8DebuggerAgentImpl::SkipPauseRequest result = agent->didPause(
|
| - pausedContext, exception, breakpointIds, isPromiseRejection, isUncaught);
|
| + V8DebuggerAgentImpl::SkipPauseRequest result =
|
| + agent->didPause(pausedContext, exception, breakpointIds,
|
| + isPromiseRejection, isUncaught, m_scheduledOOMBreak);
|
| if (result == V8DebuggerAgentImpl::RequestNoSkip) {
|
| m_runningNestedMessageLoop = true;
|
| int groupId = m_inspector->contextGroupId(pausedContext);
|
| @@ -497,6 +503,8 @@ void V8Debugger::handleProgramBreak(v8::Local<v8::Context> pausedContext,
|
| if (agent) agent->didContinue();
|
| m_runningNestedMessageLoop = false;
|
| }
|
| + if (m_scheduledOOMBreak) m_isolate->RestoreOriginalHeapLimit();
|
| + m_scheduledOOMBreak = false;
|
| m_pausedContext.Clear();
|
| m_executionState.Clear();
|
|
|
| @@ -509,6 +517,13 @@ void V8Debugger::handleProgramBreak(v8::Local<v8::Context> pausedContext,
|
| }
|
| }
|
|
|
| +void V8Debugger::v8OOMCallback(void* data) {
|
| + V8Debugger* thisPtr = static_cast<V8Debugger*>(data);
|
| + thisPtr->m_isolate->IncreaseHeapLimitForDebugging();
|
| + thisPtr->m_scheduledOOMBreak = true;
|
| + thisPtr->setPauseOnNextStatement(true);
|
| +}
|
| +
|
| void V8Debugger::v8DebugEventCallback(
|
| const v8::debug::EventDetails& eventDetails) {
|
| V8Debugger* thisPtr = toV8Debugger(eventDetails.GetCallbackData());
|
|
|