Index: third_party/WebKit/Source/bindings/core/v8/WorkerOrWorkletScriptController.h |
diff --git a/third_party/WebKit/Source/bindings/core/v8/WorkerOrWorkletScriptController.h b/third_party/WebKit/Source/bindings/core/v8/WorkerOrWorkletScriptController.h |
index 4ea92e4a76b3c06172b01c59bda673e104b5ad5b..1c6d97a0035a194513be3d270de72c9a391b0ac6 100644 |
--- a/third_party/WebKit/Source/bindings/core/v8/WorkerOrWorkletScriptController.h |
+++ b/third_party/WebKit/Source/bindings/core/v8/WorkerOrWorkletScriptController.h |
@@ -37,6 +37,7 @@ |
#include "bindings/core/v8/V8CacheOptions.h" |
#include "core/CoreExport.h" |
#include "wtf/Allocator.h" |
+#include "wtf/ThreadingPrimitives.h" |
#include "wtf/text/TextPosition.h" |
#include <v8.h> |
@@ -56,15 +57,23 @@ |
void dispose(); |
bool isExecutionForbidden() const; |
+ bool isExecutionTerminating() const; |
// Returns true if the evaluation completed with no uncaught exception. |
bool evaluate(const ScriptSourceCode&, ErrorEvent** = nullptr, CachedMetadataHandler* = nullptr, V8CacheOptions = V8CacheOptionsDefault); |
- // Prevents future JavaScript execution. |
+ // Prevents future JavaScript execution. See |
+ // willScheduleExecutionTermination, isExecutionForbidden. |
void forbidExecution(); |
// Used by WorkerThread: |
bool initializeContextIfNeeded(); |
+ // Async request to terminate future JavaScript execution on the worker |
+ // thread. JavaScript evaluation exits with a non-continuable exception and |
+ // WorkerOrWorkletScriptController calls forbidExecution to prevent further |
+ // JavaScript execution. Use forbidExecution()/isExecutionForbidden() to |
+ // guard against reentry into JavaScript. |
+ void willScheduleExecutionTermination(); |
// Used by WorkerGlobalScope: |
void rethrowExceptionFromImportedScript(ErrorEvent*, ExceptionState&); |
@@ -101,6 +110,8 @@ |
RefPtr<DOMWrapperWorld> m_world; |
String m_disableEvalPending; |
bool m_executionForbidden; |
+ bool m_executionScheduledToTerminate; |
+ mutable Mutex m_scheduledTerminationMutex; |
RefPtr<RejectedPromises> m_rejectedPromises; |