OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef ScriptForbiddenScope_h | 5 #ifndef ScriptForbiddenScope_h |
6 #define ScriptForbiddenScope_h | 6 #define ScriptForbiddenScope_h |
7 | 7 |
8 #include "platform/PlatformExport.h" | 8 #include "platform/PlatformExport.h" |
9 #include "wtf/Allocator.h" | 9 #include "platform/wtf/Allocator.h" |
10 #include "wtf/AutoReset.h" | 10 #include "platform/wtf/AutoReset.h" |
11 #include "wtf/Optional.h" | 11 #include "platform/wtf/Optional.h" |
12 | 12 |
13 namespace blink { | 13 namespace blink { |
14 | 14 |
15 // Scoped disabling of script execution on the main thread, | 15 // Scoped disabling of script execution on the main thread, |
16 // and only to be used by the main thread. | 16 // and only to be used by the main thread. |
17 class PLATFORM_EXPORT ScriptForbiddenScope final { | 17 class PLATFORM_EXPORT ScriptForbiddenScope final { |
18 STACK_ALLOCATED(); | 18 STACK_ALLOCATED(); |
19 WTF_MAKE_NONCOPYABLE(ScriptForbiddenScope); | 19 WTF_MAKE_NONCOPYABLE(ScriptForbiddenScope); |
20 | 20 |
21 public: | 21 public: |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 ~ScriptForbiddenIfMainThreadScope() { | 75 ~ScriptForbiddenIfMainThreadScope() { |
76 if (is_main_thread_) | 76 if (is_main_thread_) |
77 ScriptForbiddenScope::Exit(); | 77 ScriptForbiddenScope::Exit(); |
78 } | 78 } |
79 bool is_main_thread_; | 79 bool is_main_thread_; |
80 }; | 80 }; |
81 | 81 |
82 } // namespace blink | 82 } // namespace blink |
83 | 83 |
84 #endif // ScriptForbiddenScope_h | 84 #endif // ScriptForbiddenScope_h |
OLD | NEW |