Index: third_party/WebKit/Source/platform/ScriptForbiddenScope.h |
diff --git a/third_party/WebKit/Source/platform/ScriptForbiddenScope.h b/third_party/WebKit/Source/platform/ScriptForbiddenScope.h |
index 9c3ba7e8f5dda74bb6ab5445c065f6fecf9b7b77..db7bc6b3e1e62776f0f047c092b254ff61aa839d 100644 |
--- a/third_party/WebKit/Source/platform/ScriptForbiddenScope.h |
+++ b/third_party/WebKit/Source/platform/ScriptForbiddenScope.h |
@@ -6,13 +6,16 @@ |
#define ScriptForbiddenScope_h |
#include "platform/PlatformExport.h" |
-#include "wtf/Assertions.h" |
+#include "wtf/Allocator.h" |
#include "wtf/Optional.h" |
#include "wtf/TemporaryChange.h" |
namespace blink { |
+// Scoped disabling of script execution on the main thread, |
+// and only to be used by the main thread. |
class PLATFORM_EXPORT ScriptForbiddenScope { |
+ STACK_ALLOCATED(); |
public: |
ScriptForbiddenScope(); |
~ScriptForbiddenScope(); |
@@ -30,6 +33,20 @@ public: |
static bool isScriptForbidden(); |
}; |
+// Scoped disabling of script execution on the main thread, |
+// if called on the main thread. |
+// |
+// No effect when used by from other threads -- simplifies |
+// call sites that might be used by multiple threads to have |
+// this scope object perform the is-main-thread check on |
+// its behalf. |
+class PLATFORM_EXPORT ScriptForbiddenIfMainThreadScope { |
+ STACK_ALLOCATED(); |
+public: |
+ ScriptForbiddenIfMainThreadScope(); |
+ ~ScriptForbiddenIfMainThreadScope(); |
+}; |
+ |
} // namespace blink |
#endif // ScriptForbiddenScope_h |