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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 // Used by Inspector agents: | 82 // Used by Inspector agents: |
83 ScriptState* scriptState() { return m_scriptState.get(); } | 83 ScriptState* scriptState() { return m_scriptState.get(); } |
84 | 84 |
85 // Used by V8 bindings: | 85 // Used by V8 bindings: |
86 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>(); } |
87 | 87 |
88 RejectedPromises* rejectedPromises() const { return m_rejectedPromises.get()
; } | 88 RejectedPromises* rejectedPromises() const { return m_rejectedPromises.get()
; } |
89 | 89 |
90 DECLARE_TRACE(); | 90 DECLARE_TRACE(); |
91 | 91 |
| 92 bool isContextInitialized() const { return m_scriptState && !!m_scriptState-
>perContextData(); } |
| 93 |
92 private: | 94 private: |
93 WorkerScriptController(WorkerGlobalScope*, v8::Isolate*); | 95 WorkerScriptController(WorkerGlobalScope*, v8::Isolate*); |
94 class WorkerGlobalScopeExecutionState; | 96 class WorkerGlobalScopeExecutionState; |
95 | 97 |
96 bool isContextInitialized() { return m_scriptState && !!m_scriptState->perCo
ntextData(); } | |
97 v8::Isolate* isolate() const; | 98 v8::Isolate* isolate() const; |
98 | 99 |
99 // Evaluate a script file in the current execution environment. | 100 // Evaluate a script file in the current execution environment. |
100 ScriptValue evaluate(const String& script, const String& fileName, const Tex
tPosition& scriptStartPosition, CachedMetadataHandler*, V8CacheOptions); | 101 ScriptValue evaluate(const String& script, const String& fileName, const Tex
tPosition& scriptStartPosition, CachedMetadataHandler*, V8CacheOptions); |
101 | 102 |
102 RawPtrWillBeMember<WorkerGlobalScope> m_workerGlobalScope; | 103 RawPtrWillBeMember<WorkerGlobalScope> m_workerGlobalScope; |
103 RefPtr<ScriptState> m_scriptState; | 104 RefPtr<ScriptState> m_scriptState; |
104 RefPtr<DOMWrapperWorld> m_world; | 105 RefPtr<DOMWrapperWorld> m_world; |
105 String m_disableEvalPending; | 106 String m_disableEvalPending; |
106 bool m_executionForbidden; | 107 bool m_executionForbidden; |
107 bool m_executionScheduledToTerminate; | 108 bool m_executionScheduledToTerminate; |
108 mutable Mutex m_scheduledTerminationMutex; | 109 mutable Mutex m_scheduledTerminationMutex; |
109 | 110 |
110 OwnPtrWillBeMember<RejectedPromises> m_rejectedPromises; | 111 OwnPtrWillBeMember<RejectedPromises> m_rejectedPromises; |
111 | 112 |
112 // |m_globalScopeExecutionState| refers to a stack object | 113 // |m_globalScopeExecutionState| refers to a stack object |
113 // that evaluate() allocates; evaluate() ensuring that the | 114 // that evaluate() allocates; evaluate() ensuring that the |
114 // pointer reference to it is removed upon returning. Hence | 115 // pointer reference to it is removed upon returning. Hence |
115 // kept as a bare pointer here, and not a Persistent with | 116 // kept as a bare pointer here, and not a Persistent with |
116 // Oilpan enabled; stack scanning will visit the object and | 117 // Oilpan enabled; stack scanning will visit the object and |
117 // trace its on-heap fields. | 118 // trace its on-heap fields. |
118 GC_PLUGIN_IGNORE("394615") | 119 GC_PLUGIN_IGNORE("394615") |
119 WorkerGlobalScopeExecutionState* m_globalScopeExecutionState; | 120 WorkerGlobalScopeExecutionState* m_globalScopeExecutionState; |
120 }; | 121 }; |
121 | 122 |
122 } // namespace blink | 123 } // namespace blink |
123 | 124 |
124 #endif // WorkerScriptController_h | 125 #endif // WorkerScriptController_h |
OLD | NEW |