| Index: third_party/WebKit/Source/core/inspector/v8/IgnoreExceptionsScope.cpp
|
| diff --git a/third_party/WebKit/Source/core/inspector/v8/IgnoreExceptionsScope.cpp b/third_party/WebKit/Source/core/inspector/v8/IgnoreExceptionsScope.cpp
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..4b53415d565dc782f2bfcacd7547ab713a42ab07
|
| --- /dev/null
|
| +++ b/third_party/WebKit/Source/core/inspector/v8/IgnoreExceptionsScope.cpp
|
| @@ -0,0 +1,49 @@
|
| +// Copyright 2016 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "core/inspector/v8/IgnoreExceptionsScope.h"
|
| +
|
| +#include "core/inspector/v8/V8DebuggerImpl.h"
|
| +
|
| +namespace blink {
|
| +
|
| +class IgnoreExceptionsScopeImpl {
|
| +public:
|
| + explicit IgnoreExceptionsScopeImpl(V8DebuggerImpl* debugger)
|
| + : m_debugger(debugger)
|
| + , m_previousPauseOnExceptionsState(V8DebuggerImpl::DontPauseOnExceptions)
|
| + {
|
| + m_previousPauseOnExceptionsState = setPauseOnExceptionsState(V8DebuggerImpl::DontPauseOnExceptions);
|
| + }
|
| + ~IgnoreExceptionsScopeImpl()
|
| + {
|
| + setPauseOnExceptionsState(m_previousPauseOnExceptionsState);
|
| + }
|
| +
|
| +private:
|
| + V8DebuggerImpl::PauseOnExceptionsState setPauseOnExceptionsState(V8DebuggerImpl::PauseOnExceptionsState newState)
|
| + {
|
| + ASSERT(m_debugger);
|
| + if (!m_debugger->enabled())
|
| + return newState;
|
| + V8DebuggerImpl::PauseOnExceptionsState presentState = m_debugger->pauseOnExceptionsState();
|
| + if (presentState != newState)
|
| + m_debugger->setPauseOnExceptionsState(newState);
|
| + return presentState;
|
| + }
|
| +
|
| + V8DebuggerImpl* m_debugger;
|
| + V8DebuggerImpl::PauseOnExceptionsState m_previousPauseOnExceptionsState;
|
| +};
|
| +
|
| +IgnoreExceptionsScope::IgnoreExceptionsScope(V8Debugger* debugger)
|
| + : m_impl(adoptPtr(new IgnoreExceptionsScopeImpl(static_cast<V8DebuggerImpl*>(debugger))))
|
| +{
|
| +}
|
| +
|
| +IgnoreExceptionsScope::~IgnoreExceptionsScope()
|
| +{
|
| +}
|
| +
|
| +} // namespace blink
|
|
|