Chromium Code Reviews| Index: third_party/WebKit/Source/bindings/core/v8/GlobalScopeScriptController.h |
| diff --git a/third_party/WebKit/Source/bindings/core/v8/WorkerScriptController.h b/third_party/WebKit/Source/bindings/core/v8/GlobalScopeScriptController.h |
| similarity index 74% |
| copy from third_party/WebKit/Source/bindings/core/v8/WorkerScriptController.h |
| copy to third_party/WebKit/Source/bindings/core/v8/GlobalScopeScriptController.h |
| index 8213766fb9fa0e007989d39bd31dfdccdc60292d..67b5474dba332432f6f2c92f9b882ae4e5adb4ad 100644 |
| --- a/third_party/WebKit/Source/bindings/core/v8/WorkerScriptController.h |
| +++ b/third_party/WebKit/Source/bindings/core/v8/GlobalScopeScriptController.h |
| @@ -28,8 +28,8 @@ |
| * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| */ |
| -#ifndef WorkerScriptController_h |
| -#define WorkerScriptController_h |
| +#ifndef GlobalScopeScriptController_h |
| +#define GlobalScopeScriptController_h |
| #include "bindings/core/v8/RejectedPromises.h" |
| #include "bindings/core/v8/ScriptValue.h" |
| @@ -48,14 +48,10 @@ class CachedMetadataHandler; |
| class ErrorEvent; |
| class ExceptionState; |
| class ScriptSourceCode; |
| -class WorkerGlobalScope; |
| -class CORE_EXPORT WorkerScriptController : public NoBaseWillBeGarbageCollectedFinalized<WorkerScriptController> { |
| - USING_FAST_MALLOC_WILL_BE_REMOVED(WorkerScriptController); |
| - WTF_MAKE_NONCOPYABLE(WorkerScriptController); |
| +class CORE_EXPORT GlobalScopeScriptController : public NoBaseWillBeGarbageCollectedFinalized<GlobalScopeScriptController> { |
| public: |
| - static PassOwnPtrWillBeRawPtr<WorkerScriptController> create(WorkerGlobalScope*, v8::Isolate*); |
| - virtual ~WorkerScriptController(); |
| + virtual ~GlobalScopeScriptController(); |
| void dispose(); |
| bool isExecutionForbidden() const; |
| @@ -72,7 +68,7 @@ public: |
| bool initializeContextIfNeeded(); |
| // Async request to terminate future JavaScript execution on the |
| // worker thread. JavaScript evaluation exits with a |
| - // non-continuable exception and WorkerScriptController calls |
| + // non-continuable exception and GlobalScopeScriptController calls |
| // forbidExecution to prevent further JavaScript execution. Use |
| // forbidExecution()/isExecutionForbidden() to guard against |
| // reentry into JavaScript. |
| @@ -90,20 +86,31 @@ public: |
| RejectedPromises* rejectedPromises() const { return m_rejectedPromises.get(); } |
| - DECLARE_TRACE(); |
| + DECLARE_VIRTUAL_TRACE(); |
| bool isContextInitialized() const { return m_scriptState && !!m_scriptState->perContextData(); } |
| +protected: |
| + GlobalScopeScriptController(v8::Isolate*); |
| + |
| + virtual void didStopRunLoop() = 0; |
|
kinuko
2015/12/24 04:45:51
(I think we can remove this from Worker*ScriptCont
ikilpatrick
2015/12/27 20:22:39
Done.
|
| + virtual v8::Isolate* isolate() const = 0; |
|
kinuko
2015/12/24 04:45:51
We can just store isolate ptr given to the ctor as
ikilpatrick
2015/12/27 20:22:39
Done.
|
| + virtual bool isContextThread() const = 0; |
|
kinuko
2015/12/24 04:45:51
For this, runCompiledScript, shouldSanitizedScript
ikilpatrick
2015/12/27 20:22:39
Done.
|
| + |
| + virtual const WrapperTypeInfo* wrapperTypeInfoForGlobalScope() const = 0; |
| + virtual v8::Local<v8::Object> associateGlobalScopeWithWrapper(const WrapperTypeInfo*, v8::Local<v8::Object> wrapper) = 0; |
|
kinuko
2015/12/24 04:45:51
For these ones similarly I think we can basically
ikilpatrick
2015/12/27 20:22:39
Done.
|
| + virtual v8::MaybeLocal<v8::Value> runCompiledScript(v8::Local<v8::Script>) = 0; |
| + |
| + virtual bool shouldSanitizeScriptError(const String& sourceURL, AccessControlStatus) = 0; |
| + virtual void reportException(PassRefPtrWillBeRawPtr<ErrorEvent>, int scriptId, PassRefPtrWillBeRawPtr<ScriptCallStack>, AccessControlStatus) = 0; |
| + |
| private: |
| - WorkerScriptController(WorkerGlobalScope*, v8::Isolate*); |
| - class WorkerGlobalScopeExecutionState; |
| + class ExecutionState; |
| - v8::Isolate* isolate() const; |
| // Evaluate a script file in the current execution environment. |
| ScriptValue evaluate(const String& script, const String& fileName, const TextPosition& scriptStartPosition, CachedMetadataHandler*, V8CacheOptions); |
| - RawPtrWillBeMember<WorkerGlobalScope> m_workerGlobalScope; |
| RefPtr<ScriptState> m_scriptState; |
| RefPtr<DOMWrapperWorld> m_world; |
| String m_disableEvalPending; |
| @@ -113,16 +120,15 @@ private: |
| RefPtrWillBeMember<RejectedPromises> m_rejectedPromises; |
| - // |m_globalScopeExecutionState| refers to a stack object |
| - // that evaluate() allocates; evaluate() ensuring that the |
| - // pointer reference to it is removed upon returning. Hence |
| - // kept as a bare pointer here, and not a Persistent with |
| + // |m_executionState| refers to a stack object that evaluate() allocates; |
| + // evaluate() ensuring that the pointer reference to it is removed upon |
| + // returning. Hence kept as a bare pointer here, and not a Persistent with |
| // Oilpan enabled; stack scanning will visit the object and |
| // trace its on-heap fields. |
| GC_PLUGIN_IGNORE("394615") |
| - WorkerGlobalScopeExecutionState* m_globalScopeExecutionState; |
| + ExecutionState* m_executionState; |
| }; |
| } // namespace blink |
| -#endif // WorkerScriptController_h |
| +#endif // GlobalScopeScriptController_h |