OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef IgnoreExceptionsScope_h | |
6 #define IgnoreExceptionsScope_h | |
7 | |
8 #include "platform/inspector_protocol/Allocator.h" | |
9 #include "platform/v8_inspector/V8DebuggerImpl.h" | |
10 #include "wtf/OwnPtr.h" | |
11 | |
12 namespace blink { | |
13 | |
14 class IgnoreExceptionsScope { | |
15 PROTOCOL_DISALLOW_COPY(IgnoreExceptionsScope); | |
16 public: | |
17 explicit IgnoreExceptionsScope(V8DebuggerImpl* debugger) | |
18 : m_debugger(debugger) | |
19 , m_previousPauseOnExceptionsState(V8DebuggerImpl::DontPauseOnExceptions
) | |
20 { | |
21 m_previousPauseOnExceptionsState = setPauseOnExceptionsState(V8DebuggerI
mpl::DontPauseOnExceptions); | |
22 } | |
23 | |
24 ~IgnoreExceptionsScope() | |
25 { | |
26 setPauseOnExceptionsState(m_previousPauseOnExceptionsState); | |
27 } | |
28 | |
29 private: | |
30 V8DebuggerImpl::PauseOnExceptionsState setPauseOnExceptionsState(V8DebuggerI
mpl::PauseOnExceptionsState newState) | |
31 { | |
32 if (!m_debugger || !m_debugger->enabled()) | |
33 return newState; | |
34 V8DebuggerImpl::PauseOnExceptionsState presentState = m_debugger->getPau
seOnExceptionsState(); | |
35 if (presentState != newState) | |
36 m_debugger->setPauseOnExceptionsState(newState); | |
37 return presentState; | |
38 } | |
39 | |
40 V8DebuggerImpl* m_debugger; | |
41 V8DebuggerImpl::PauseOnExceptionsState m_previousPauseOnExceptionsState; | |
42 }; | |
43 | |
44 } // namespace blink | |
45 | |
46 #endif // IgnoreExceptionsScope_h | |
OLD | NEW |