| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009, 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2009, 2012 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 | 47 |
| 48 class CachedMetadataHandler; | 48 class CachedMetadataHandler; |
| 49 class ErrorEvent; | 49 class ErrorEvent; |
| 50 class ExceptionState; | 50 class ExceptionState; |
| 51 class ScriptSourceCode; | 51 class ScriptSourceCode; |
| 52 class WorkerOrWorkletGlobalScope; | 52 class WorkerOrWorkletGlobalScope; |
| 53 | 53 |
| 54 class CORE_EXPORT WorkerOrWorkletScriptController : public GarbageCollectedFinal
ized<WorkerOrWorkletScriptController> { | 54 class CORE_EXPORT WorkerOrWorkletScriptController : public GarbageCollectedFinal
ized<WorkerOrWorkletScriptController> { |
| 55 WTF_MAKE_NONCOPYABLE(WorkerOrWorkletScriptController); | 55 WTF_MAKE_NONCOPYABLE(WorkerOrWorkletScriptController); |
| 56 public: | 56 public: |
| 57 static RawPtr<WorkerOrWorkletScriptController> create(WorkerOrWorkletGlobalS
cope*, v8::Isolate*); | 57 static WorkerOrWorkletScriptController* create(WorkerOrWorkletGlobalScope*,
v8::Isolate*); |
| 58 virtual ~WorkerOrWorkletScriptController(); | 58 virtual ~WorkerOrWorkletScriptController(); |
| 59 void dispose(); | 59 void dispose(); |
| 60 | 60 |
| 61 bool isExecutionForbidden() const; | 61 bool isExecutionForbidden() const; |
| 62 bool isExecutionTerminating() const; | 62 bool isExecutionTerminating() const; |
| 63 | 63 |
| 64 // Returns true if the evaluation completed with no uncaught exception. | 64 // Returns true if the evaluation completed with no uncaught exception. |
| 65 bool evaluate(const ScriptSourceCode&, ErrorEvent** = nullptr, CachedMetadat
aHandler* = nullptr, V8CacheOptions = V8CacheOptionsDefault); | 65 bool evaluate(const ScriptSourceCode&, ErrorEvent** = nullptr, CachedMetadat
aHandler* = nullptr, V8CacheOptions = V8CacheOptionsDefault); |
| 66 | 66 |
| 67 // Prevents future JavaScript execution. See | 67 // Prevents future JavaScript execution. See |
| 68 // willScheduleExecutionTermination, isExecutionForbidden. | 68 // willScheduleExecutionTermination, isExecutionForbidden. |
| 69 void forbidExecution(); | 69 void forbidExecution(); |
| 70 | 70 |
| 71 // Used by WorkerThread: | 71 // Used by WorkerThread: |
| 72 bool initializeContextIfNeeded(); | 72 bool initializeContextIfNeeded(); |
| 73 // Async request to terminate future JavaScript execution on the worker | 73 // Async request to terminate future JavaScript execution on the worker |
| 74 // thread. JavaScript evaluation exits with a non-continuable exception and | 74 // thread. JavaScript evaluation exits with a non-continuable exception and |
| 75 // WorkerOrWorkletScriptController calls forbidExecution to prevent further | 75 // WorkerOrWorkletScriptController calls forbidExecution to prevent further |
| 76 // JavaScript execution. Use forbidExecution()/isExecutionForbidden() to | 76 // JavaScript execution. Use forbidExecution()/isExecutionForbidden() to |
| 77 // guard against reentry into JavaScript. | 77 // guard against reentry into JavaScript. |
| 78 void willScheduleExecutionTermination(); | 78 void willScheduleExecutionTermination(); |
| 79 | 79 |
| 80 // Used by WorkerGlobalScope: | 80 // Used by WorkerGlobalScope: |
| 81 void rethrowExceptionFromImportedScript(RawPtr<ErrorEvent>, ExceptionState&)
; | 81 void rethrowExceptionFromImportedScript(ErrorEvent*, ExceptionState&); |
| 82 void disableEval(const String&); | 82 void disableEval(const String&); |
| 83 | 83 |
| 84 // Used by Inspector agents: | 84 // Used by Inspector agents: |
| 85 ScriptState* getScriptState() { return m_scriptState.get(); } | 85 ScriptState* getScriptState() { return m_scriptState.get(); } |
| 86 | 86 |
| 87 // Used by V8 bindings: | 87 // Used by V8 bindings: |
| 88 v8::Local<v8::Context> context() { return m_scriptState ? m_scriptState->con
text() : v8::Local<v8::Context>(); } | 88 v8::Local<v8::Context> context() { return m_scriptState ? m_scriptState->con
text() : v8::Local<v8::Context>(); } |
| 89 | 89 |
| 90 RejectedPromises* getRejectedPromises() const { return m_rejectedPromises.ge
t(); } | 90 RejectedPromises* getRejectedPromises() const { return m_rejectedPromises.ge
t(); } |
| 91 | 91 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 122 // returning. Hence kept as a bare pointer here, and not a Persistent with | 122 // returning. Hence kept as a bare pointer here, and not a Persistent with |
| 123 // Oilpan enabled; stack scanning will visit the object and | 123 // Oilpan enabled; stack scanning will visit the object and |
| 124 // trace its on-heap fields. | 124 // trace its on-heap fields. |
| 125 GC_PLUGIN_IGNORE("394615") | 125 GC_PLUGIN_IGNORE("394615") |
| 126 ExecutionState* m_executionState; | 126 ExecutionState* m_executionState; |
| 127 }; | 127 }; |
| 128 | 128 |
| 129 } // namespace blink | 129 } // namespace blink |
| 130 | 130 |
| 131 #endif // WorkerOrWorkletScriptController_h | 131 #endif // WorkerOrWorkletScriptController_h |
| OLD | NEW |