| 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 13 matching lines...) Expand all Loading... |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #ifndef WorkerScriptController_h | 31 #ifndef WorkerScriptController_h |
| 32 #define WorkerScriptController_h | 32 #define WorkerScriptController_h |
| 33 | 33 |
| 34 #include "bindings/core/v8/RejectedPromises.h" |
| 34 #include "bindings/core/v8/ScriptValue.h" | 35 #include "bindings/core/v8/ScriptValue.h" |
| 35 #include "bindings/core/v8/V8Binding.h" | 36 #include "bindings/core/v8/V8Binding.h" |
| 36 #include "wtf/OwnPtr.h" | 37 #include "wtf/OwnPtr.h" |
| 37 #include "wtf/ThreadingPrimitives.h" | 38 #include "wtf/ThreadingPrimitives.h" |
| 38 #include "wtf/text/TextPosition.h" | 39 #include "wtf/text/TextPosition.h" |
| 39 #include <v8.h> | 40 #include <v8.h> |
| 40 | 41 |
| 41 namespace blink { | 42 namespace blink { |
| 42 | 43 |
| 43 class ErrorEvent; | 44 class ErrorEvent; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 // Returns true if the embedder should stop calling idleNotification | 78 // Returns true if the embedder should stop calling idleNotification |
| 78 // until real work has been done. | 79 // until real work has been done. |
| 79 bool idleNotification() { return m_isolate->IdleNotification(1000); } | 80 bool idleNotification() { return m_isolate->IdleNotification(1000); } |
| 80 | 81 |
| 81 // Used by Inspector agents: | 82 // Used by Inspector agents: |
| 82 ScriptState* scriptState() { return m_scriptState.get(); } | 83 ScriptState* scriptState() { return m_scriptState.get(); } |
| 83 | 84 |
| 84 // Used by V8 bindings: | 85 // Used by V8 bindings: |
| 85 v8::Local<v8::Context> context() { return m_scriptState ? m_scriptState->con
text() : v8::Local<v8::Context>(); } | 86 v8::Local<v8::Context> context() { return m_scriptState ? m_scriptState->con
text() : v8::Local<v8::Context>(); } |
| 86 | 87 |
| 88 RejectedPromises* rejectedPromises() const { return m_rejectedPromises.get()
; } |
| 89 |
| 87 private: | 90 private: |
| 88 class WorkerGlobalScopeExecutionState; | 91 class WorkerGlobalScopeExecutionState; |
| 89 | 92 |
| 90 bool isContextInitialized() { return m_scriptState && !!m_scriptState->perCo
ntextData(); } | 93 bool isContextInitialized() { return m_scriptState && !!m_scriptState->perCo
ntextData(); } |
| 91 | 94 |
| 92 // Evaluate a script file in the current execution environment. | 95 // Evaluate a script file in the current execution environment. |
| 93 ScriptValue evaluate(const String& script, const String& fileName, const Tex
tPosition& scriptStartPosition); | 96 ScriptValue evaluate(const String& script, const String& fileName, const Tex
tPosition& scriptStartPosition); |
| 94 | 97 |
| 95 v8::Isolate* m_isolate; | 98 v8::Isolate* m_isolate; |
| 96 WorkerGlobalScope& m_workerGlobalScope; | 99 WorkerGlobalScope& m_workerGlobalScope; |
| 97 RefPtr<ScriptState> m_scriptState; | 100 RefPtr<ScriptState> m_scriptState; |
| 98 RefPtr<DOMWrapperWorld> m_world; | 101 RefPtr<DOMWrapperWorld> m_world; |
| 99 String m_disableEvalPending; | 102 String m_disableEvalPending; |
| 100 bool m_executionForbidden; | 103 bool m_executionForbidden; |
| 101 bool m_executionScheduledToTerminate; | 104 bool m_executionScheduledToTerminate; |
| 102 mutable Mutex m_scheduledTerminationMutex; | 105 mutable Mutex m_scheduledTerminationMutex; |
| 103 | 106 |
| 107 OwnPtrWillBePersistent<RejectedPromises> m_rejectedPromises; |
| 108 |
| 104 // |m_globalScopeExecutionState| refers to a stack object | 109 // |m_globalScopeExecutionState| refers to a stack object |
| 105 // that evaluate() allocates; evaluate() ensuring that the | 110 // that evaluate() allocates; evaluate() ensuring that the |
| 106 // pointer reference to it is removed upon returning. Hence | 111 // pointer reference to it is removed upon returning. Hence |
| 107 // kept as a bare pointer here, and not a Persistent with | 112 // kept as a bare pointer here, and not a Persistent with |
| 108 // Oilpan enabled; stack scanning will visit the object and | 113 // Oilpan enabled; stack scanning will visit the object and |
| 109 // trace its on-heap fields. | 114 // trace its on-heap fields. |
| 110 GC_PLUGIN_IGNORE("394615") | 115 GC_PLUGIN_IGNORE("394615") |
| 111 WorkerGlobalScopeExecutionState* m_globalScopeExecutionState; | 116 WorkerGlobalScopeExecutionState* m_globalScopeExecutionState; |
| 112 OwnPtr<V8IsolateInterruptor> m_interruptor; | 117 OwnPtr<V8IsolateInterruptor> m_interruptor; |
| 113 }; | 118 }; |
| 114 | 119 |
| 115 } // namespace blink | 120 } // namespace blink |
| 116 | 121 |
| 117 #endif // WorkerScriptController_h | 122 #endif // WorkerScriptController_h |
| OLD | NEW |