| 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 18 matching lines...) Expand all Loading... |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #ifndef WorkerOrWorkletScriptController_h | 31 #ifndef WorkerOrWorkletScriptController_h |
| 32 #define WorkerOrWorkletScriptController_h | 32 #define WorkerOrWorkletScriptController_h |
| 33 | 33 |
| 34 #include "bindings/core/v8/RejectedPromises.h" | 34 #include "bindings/core/v8/RejectedPromises.h" |
| 35 #include "bindings/core/v8/ScriptValue.h" | 35 #include "bindings/core/v8/ScriptValue.h" |
| 36 #include "bindings/core/v8/V8Binding.h" | 36 #include "bindings/core/v8/V8Binding.h" |
| 37 #include "bindings/core/v8/V8CacheOptions.h" | 37 #include "bindings/core/v8/V8CacheOptions.h" |
| 38 #include "core/CoreExport.h" | 38 #include "core/CoreExport.h" |
| 39 #include "platform/text/CompressibleString.h" |
| 39 #include "wtf/Allocator.h" | 40 #include "wtf/Allocator.h" |
| 40 #include "wtf/OwnPtr.h" | 41 #include "wtf/OwnPtr.h" |
| 41 #include "wtf/ThreadingPrimitives.h" | 42 #include "wtf/ThreadingPrimitives.h" |
| 42 #include "wtf/text/TextPosition.h" | 43 #include "wtf/text/TextPosition.h" |
| 43 #include <v8.h> | 44 #include <v8.h> |
| 44 | 45 |
| 45 namespace blink { | 46 namespace blink { |
| 46 | 47 |
| 47 class CachedMetadataHandler; | 48 class CachedMetadataHandler; |
| 48 class ErrorEvent; | 49 class ErrorEvent; |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 | 94 |
| 94 bool isContextInitialized() const { return m_scriptState && !!m_scriptState-
>perContextData(); } | 95 bool isContextInitialized() const { return m_scriptState && !!m_scriptState-
>perContextData(); } |
| 95 | 96 |
| 96 private: | 97 private: |
| 97 WorkerOrWorkletScriptController(WorkerGlobalScope*, v8::Isolate*); | 98 WorkerOrWorkletScriptController(WorkerGlobalScope*, v8::Isolate*); |
| 98 class ExecutionState; | 99 class ExecutionState; |
| 99 | 100 |
| 100 v8::Isolate* isolate() const; | 101 v8::Isolate* isolate() const; |
| 101 | 102 |
| 102 // Evaluate a script file in the current execution environment. | 103 // Evaluate a script file in the current execution environment. |
| 103 ScriptValue evaluate(const String& script, const String& fileName, const Tex
tPosition& scriptStartPosition, CachedMetadataHandler*, V8CacheOptions); | 104 ScriptValue evaluate(const CompressibleString& script, const String& fileNam
e, const TextPosition& scriptStartPosition, CachedMetadataHandler*, V8CacheOptio
ns); |
| 104 | 105 |
| 105 RawPtrWillBeMember<WorkerGlobalScope> m_workerGlobalScope; | 106 RawPtrWillBeMember<WorkerGlobalScope> m_workerGlobalScope; |
| 106 RefPtr<ScriptState> m_scriptState; | 107 RefPtr<ScriptState> m_scriptState; |
| 107 RefPtr<DOMWrapperWorld> m_world; | 108 RefPtr<DOMWrapperWorld> m_world; |
| 108 String m_disableEvalPending; | 109 String m_disableEvalPending; |
| 109 bool m_executionForbidden; | 110 bool m_executionForbidden; |
| 110 bool m_executionScheduledToTerminate; | 111 bool m_executionScheduledToTerminate; |
| 111 mutable Mutex m_scheduledTerminationMutex; | 112 mutable Mutex m_scheduledTerminationMutex; |
| 112 | 113 |
| 113 RefPtrWillBeMember<RejectedPromises> m_rejectedPromises; | 114 RefPtrWillBeMember<RejectedPromises> m_rejectedPromises; |
| 114 | 115 |
| 115 // |m_executionState| refers to a stack object that evaluate() allocates; | 116 // |m_executionState| refers to a stack object that evaluate() allocates; |
| 116 // evaluate() ensuring that the pointer reference to it is removed upon | 117 // evaluate() ensuring that the pointer reference to it is removed upon |
| 117 // returning. Hence kept as a bare pointer here, and not a Persistent with | 118 // returning. Hence kept as a bare pointer here, and not a Persistent with |
| 118 // Oilpan enabled; stack scanning will visit the object and | 119 // Oilpan enabled; stack scanning will visit the object and |
| 119 // trace its on-heap fields. | 120 // trace its on-heap fields. |
| 120 GC_PLUGIN_IGNORE("394615") | 121 GC_PLUGIN_IGNORE("394615") |
| 121 ExecutionState* m_executionState; | 122 ExecutionState* m_executionState; |
| 122 }; | 123 }; |
| 123 | 124 |
| 124 } // namespace blink | 125 } // namespace blink |
| 125 | 126 |
| 126 #endif // WorkerOrWorkletScriptController_h | 127 #endif // WorkerOrWorkletScriptController_h |
| OLD | NEW |