Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Side by Side Diff: third_party/WebKit/Source/bindings/core/v8/GlobalScopeScriptController.cpp

Issue 1510603005: [Do not submit] Worklet implementation. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: A basic CompositorWorklet implementation. Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 12 matching lines...) Expand all
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
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 #include "config.h" 31 #include "config.h"
32 32
33 #include "bindings/core/v8/WorkerScriptController.h" 33 #include "bindings/core/v8/GlobalScopeScriptController.h"
34 34
35 #include "bindings/core/v8/ScriptSourceCode.h" 35 #include "bindings/core/v8/ScriptSourceCode.h"
36 #include "bindings/core/v8/ScriptValue.h" 36 #include "bindings/core/v8/ScriptValue.h"
37 #include "bindings/core/v8/V8DedicatedWorkerGlobalScope.h" 37 #include "bindings/core/v8/V8DedicatedWorkerGlobalScope.h"
38 #include "bindings/core/v8/V8ErrorHandler.h" 38 #include "bindings/core/v8/V8ErrorHandler.h"
39 #include "bindings/core/v8/V8Initializer.h" 39 #include "bindings/core/v8/V8Initializer.h"
40 #include "bindings/core/v8/V8ObjectConstructor.h" 40 #include "bindings/core/v8/V8ObjectConstructor.h"
41 #include "bindings/core/v8/V8ScriptRunner.h" 41 #include "bindings/core/v8/V8ScriptRunner.h"
42 #include "bindings/core/v8/V8SharedWorkerGlobalScope.h" 42 #include "bindings/core/v8/V8SharedWorkerGlobalScope.h"
43 #include "bindings/core/v8/V8WorkerGlobalScope.h" 43 #include "bindings/core/v8/V8WorkerGlobalScope.h"
44 #include "bindings/core/v8/WrapperTypeInfo.h" 44 #include "bindings/core/v8/WrapperTypeInfo.h"
45 #include "core/events/ErrorEvent.h" 45 #include "core/events/ErrorEvent.h"
46 #include "core/frame/DOMTimer.h" 46 #include "core/frame/DOMTimer.h"
47 #include "core/inspector/ScriptCallStack.h" 47 #include "core/inspector/ScriptCallStack.h"
48 #include "core/inspector/WorkerThreadDebugger.h" 48 #include "core/inspector/WorkerThreadDebugger.h"
49 #include "core/workers/AbstractGlobalScope.h"
49 #include "core/workers/SharedWorkerGlobalScope.h" 50 #include "core/workers/SharedWorkerGlobalScope.h"
50 #include "core/workers/WorkerGlobalScope.h"
51 #include "core/workers/WorkerObjectProxy.h" 51 #include "core/workers/WorkerObjectProxy.h"
52 #include "core/workers/WorkerThread.h"
53 #include "platform/heap/ThreadState.h" 52 #include "platform/heap/ThreadState.h"
54 #include "public/platform/Platform.h" 53 #include "public/platform/Platform.h"
55 #include <v8.h> 54 #include <v8.h>
56 55
57 namespace blink { 56 namespace blink {
58 57
59 class WorkerScriptController::WorkerGlobalScopeExecutionState final { 58 class GlobalScopeScriptController::GlobalScopeExecutionState final {
60 STACK_ALLOCATED(); 59 STACK_ALLOCATED();
61 public: 60 public:
62 explicit WorkerGlobalScopeExecutionState(WorkerScriptController* controller) 61 explicit GlobalScopeExecutionState(GlobalScopeScriptController* controller)
63 : hadException(false) 62 : hadException(false)
64 , lineNumber(0) 63 , lineNumber(0)
65 , columnNumber(0) 64 , columnNumber(0)
66 , m_controller(controller) 65 , m_controller(controller)
67 , m_outerState(controller->m_globalScopeExecutionState) 66 , m_outerState(controller->m_globalScopeExecutionState)
68 { 67 {
69 m_controller->m_globalScopeExecutionState = this; 68 m_controller->m_globalScopeExecutionState = this;
70 } 69 }
71 70
72 ~WorkerGlobalScopeExecutionState() 71 ~GlobalScopeExecutionState()
73 { 72 {
74 m_controller->m_globalScopeExecutionState = m_outerState; 73 m_controller->m_globalScopeExecutionState = m_outerState;
75 } 74 }
76 75
77 DEFINE_INLINE_TRACE() 76 DEFINE_INLINE_TRACE()
78 { 77 {
79 visitor->trace(m_errorEventFromImportedScript); 78 visitor->trace(m_errorEventFromImportedScript);
80 visitor->trace(m_controller); 79 visitor->trace(m_controller);
81 } 80 }
82 81
83 bool hadException; 82 bool hadException;
84 String errorMessage; 83 String errorMessage;
85 int lineNumber; 84 int lineNumber;
86 int columnNumber; 85 int columnNumber;
87 String sourceURL; 86 String sourceURL;
88 ScriptValue exception; 87 ScriptValue exception;
89 RefPtrWillBeMember<ErrorEvent> m_errorEventFromImportedScript; 88 RefPtrWillBeMember<ErrorEvent> m_errorEventFromImportedScript;
90 89
91 // A WorkerGlobalScopeExecutionState context is stack allocated by 90 // A GlobalScopeExecutionState context is stack allocated by
92 // WorkerScriptController::evaluate(), with the contoller using it 91 // GlobalScopeScriptController::evaluate(), with the contoller using it
93 // during script evaluation. To handle nested evaluate() uses, 92 // during script evaluation. To handle nested evaluate() uses,
94 // WorkerGlobalScopeExecutionStates are chained together; 93 // GlobalScopeExecutionStates are chained together;
95 // |m_outerState| keeps a pointer to the context object one level out 94 // |m_outerState| keeps a pointer to the context object one level out
96 // (or 0, if outermost.) Upon return from evaluate(), the 95 // (or 0, if outermost.) Upon return from evaluate(), the
97 // WorkerScriptController's WorkerGlobalScopeExecutionState is popped 96 // GlobalScopeScriptController's GlobalScopeExecutionState is popped
98 // and the previous one restored (see above dtor.) 97 // and the previous one restored (see above dtor.)
99 // 98 //
100 // With Oilpan, |m_outerState| isn't traced. It'll be "up the stack" 99 // With Oilpan, |m_outerState| isn't traced. It'll be "up the stack"
101 // and its fields will be traced when scanning the stack. 100 // and its fields will be traced when scanning the stack.
102 RawPtrWillBeMember<WorkerScriptController> m_controller; 101 RawPtrWillBeMember<GlobalScopeScriptController> m_controller;
103 WorkerGlobalScopeExecutionState* m_outerState; 102 GlobalScopeExecutionState* m_outerState;
104 }; 103 };
105 104
106 PassOwnPtrWillBeRawPtr<WorkerScriptController> WorkerScriptController::create(Wo rkerGlobalScope* workerGlobalScope, v8::Isolate* isolate) 105 GlobalScopeScriptController::GlobalScopeScriptController(AbstractGlobalScope* ab stractGlobalScope, v8::Isolate* isolate)
107 { 106 : m_abstractGlobalScope(abstractGlobalScope)
108 return adoptPtrWillBeNoop(new WorkerScriptController(workerGlobalScope, isol ate));
109 }
110
111 WorkerScriptController::WorkerScriptController(WorkerGlobalScope* workerGlobalSc ope, v8::Isolate* isolate)
112 : m_workerGlobalScope(workerGlobalScope)
113 , m_executionForbidden(false) 107 , m_executionForbidden(false)
114 , m_executionScheduledToTerminate(false) 108 , m_executionScheduledToTerminate(false)
115 , m_rejectedPromises(RejectedPromises::create()) 109 , m_rejectedPromises(RejectedPromises::create())
116 , m_globalScopeExecutionState(0) 110 , m_globalScopeExecutionState(0)
117 { 111 {
118 ASSERT(isolate); 112 ASSERT(isolate);
119 m_world = DOMWrapperWorld::create(isolate, WorkerWorldId); 113 m_world = DOMWrapperWorld::create(isolate, WorkerWorldId);
120 } 114 }
121 115
122 WorkerScriptController::~WorkerScriptController() 116 GlobalScopeScriptController::~GlobalScopeScriptController()
123 { 117 {
124 ASSERT(!m_rejectedPromises); 118 ASSERT(!m_rejectedPromises);
125 } 119 }
126 120
127 void WorkerScriptController::dispose() 121 void GlobalScopeScriptController::dispose()
128 { 122 {
129 m_rejectedPromises->dispose(); 123 m_rejectedPromises->dispose();
130 m_rejectedPromises.release(); 124 m_rejectedPromises.release();
131 125
132 m_world->dispose(); 126 m_world->dispose();
133 127
134 // The corresponding call to didStartRunLoop() is in WorkerThread::initializ e(). 128 // The corresponding call to didStartRunLoop() is in WorkerThread::initializ e().
135 // See http://webkit.org/b/83104#c14 for why this is here. 129 // See http://webkit.org/b/83104#c14 for why this is here.
136 m_workerGlobalScope->thread()->didStopRunLoop(); 130 m_abstractGlobalScope->didStopRunLoop();
137 131
138 if (isContextInitialized()) 132 if (isContextInitialized())
139 m_scriptState->disposePerContextData(); 133 m_scriptState->disposePerContextData();
140 } 134 }
141 135
142 bool WorkerScriptController::initializeContextIfNeeded() 136 bool GlobalScopeScriptController::initializeContextIfNeeded()
143 { 137 {
144 v8::HandleScope handleScope(isolate()); 138 v8::HandleScope handleScope(isolate());
145 139
146 if (isContextInitialized()) 140 if (isContextInitialized())
147 return true; 141 return true;
148 142
149 v8::Local<v8::Context> context = v8::Context::New(isolate()); 143 v8::Local<v8::Context> context = v8::Context::New(isolate());
150 if (context.IsEmpty()) 144 if (context.IsEmpty())
151 return false; 145 return false;
152 146
153 m_scriptState = ScriptState::create(context, m_world); 147 m_scriptState = ScriptState::create(context, m_world);
154 148
155 ScriptState::Scope scope(m_scriptState.get()); 149 ScriptState::Scope scope(m_scriptState.get());
156 150
157 // Name new context for debugging. 151 // Name new context for debugging.
158 WorkerThreadDebugger::setContextDebugData(context); 152 WorkerThreadDebugger::setContextDebugData(context);
159 153
160 // Create a new JS object and use it as the prototype for the shadow global object. 154 // Create a new JS object and use it as the prototype for the shadow global object.
161 const WrapperTypeInfo* wrapperTypeInfo = m_workerGlobalScope->wrapperTypeInf o(); 155 const WrapperTypeInfo* wrapperTypeInfo = wrapperTypeInfoForGlobalScope();
162 v8::Local<v8::Function> workerGlobalScopeConstructor = m_scriptState->perCon textData()->constructorForType(wrapperTypeInfo); 156
163 if (workerGlobalScopeConstructor.IsEmpty()) 157 v8::Local<v8::Function> abstractGlobalScopeConstructor = m_scriptState->perC ontextData()->constructorForType(wrapperTypeInfo);
158 if (abstractGlobalScopeConstructor.IsEmpty())
164 return false; 159 return false;
165 v8::Local<v8::Object> jsWorkerGlobalScope; 160
166 if (!V8ObjectConstructor::newInstance(isolate(), workerGlobalScopeConstructo r).ToLocal(&jsWorkerGlobalScope)) { 161 v8::Local<v8::Object> jsGlobalScope;
162 if (!V8ObjectConstructor::newInstance(isolate(), abstractGlobalScopeConstruc tor).ToLocal(&jsGlobalScope)) {
167 m_scriptState->disposePerContextData(); 163 m_scriptState->disposePerContextData();
168 return false; 164 return false;
169 } 165 }
170 166
171 jsWorkerGlobalScope = V8DOMWrapper::associateObjectWithWrapper(isolate(), m_ workerGlobalScope, wrapperTypeInfo, jsWorkerGlobalScope); 167 jsGlobalScope = associateGlobalScopeWithWrapper(isolate(), wrapperTypeInfo, jsGlobalScope);
172 168
173 // Insert the object instance as the prototype of the shadow object. 169 // Insert the object instance as the prototype of the shadow object.
174 v8::Local<v8::Object> globalObject = v8::Local<v8::Object>::Cast(m_scriptSta te->context()->Global()->GetPrototype()); 170 v8::Local<v8::Object> globalObject = v8::Local<v8::Object>::Cast(m_scriptSta te->context()->Global()->GetPrototype());
175 return v8CallBoolean(globalObject->SetPrototype(context, jsWorkerGlobalScope )); 171 return v8CallBoolean(globalObject->SetPrototype(context, jsGlobalScope));
176 } 172 }
177 173
178 v8::Isolate* WorkerScriptController::isolate() const 174 v8::Isolate* GlobalScopeScriptController::isolate() const
179 { 175 {
180 return m_workerGlobalScope->thread()->isolate(); 176 return m_abstractGlobalScope->isolate();
181 } 177 }
182 178
183 ScriptValue WorkerScriptController::evaluate(const String& script, const String& fileName, const TextPosition& scriptStartPosition, CachedMetadataHandler* cache Handler, V8CacheOptions v8CacheOptions) 179 ScriptValue GlobalScopeScriptController::evaluate(const String& script, const St ring& fileName, const TextPosition& scriptStartPosition, CachedMetadataHandler* cacheHandler, V8CacheOptions v8CacheOptions)
184 { 180 {
185 if (!initializeContextIfNeeded()) 181 if (!initializeContextIfNeeded())
186 return ScriptValue(); 182 return ScriptValue();
187 183
188 ScriptState::Scope scope(m_scriptState.get()); 184 ScriptState::Scope scope(m_scriptState.get());
189 185
190 if (!m_disableEvalPending.isEmpty()) { 186 if (!m_disableEvalPending.isEmpty()) {
191 m_scriptState->context()->AllowCodeGenerationFromStrings(false); 187 m_scriptState->context()->AllowCodeGenerationFromStrings(false);
192 m_scriptState->context()->SetErrorMessageForCodeGenerationFromStrings(v8 String(isolate(), m_disableEvalPending)); 188 m_scriptState->context()->SetErrorMessageForCodeGenerationFromStrings(v8 String(isolate(), m_disableEvalPending));
193 m_disableEvalPending = String(); 189 m_disableEvalPending = String();
194 } 190 }
195 191
196 v8::TryCatch block(isolate()); 192 v8::TryCatch block(isolate());
197 193
198 v8::Local<v8::Script> compiledScript; 194 v8::Local<v8::Script> compiledScript;
199 v8::MaybeLocal<v8::Value> maybeResult; 195 v8::MaybeLocal<v8::Value> maybeResult;
200 if (v8Call(V8ScriptRunner::compileScript(script, fileName, String(), scriptS tartPosition, isolate(), cacheHandler, SharableCrossOrigin, v8CacheOptions), com piledScript, block)) 196 if (v8Call(V8ScriptRunner::compileScript(script, fileName, String(), scriptS tartPosition, isolate(), cacheHandler, SharableCrossOrigin, v8CacheOptions), com piledScript, block))
201 maybeResult = V8ScriptRunner::runCompiledScript(isolate(), compiledScrip t, m_workerGlobalScope); 197 maybeResult = V8ScriptRunner::runCompiledScript(isolate(), compiledScrip t, m_abstractGlobalScope);
202 198
203 if (!block.CanContinue()) { 199 if (!block.CanContinue()) {
204 forbidExecution(); 200 forbidExecution();
205 return ScriptValue(); 201 return ScriptValue();
206 } 202 }
207 203
208 if (block.HasCaught()) { 204 if (block.HasCaught()) {
209 v8::Local<v8::Message> message = block.Message(); 205 v8::Local<v8::Message> message = block.Message();
210 m_globalScopeExecutionState->hadException = true; 206 m_globalScopeExecutionState->hadException = true;
211 m_globalScopeExecutionState->errorMessage = toCoreString(message->Get()) ; 207 m_globalScopeExecutionState->errorMessage = toCoreString(message->Get()) ;
(...skipping 13 matching lines...) Expand all
225 m_globalScopeExecutionState->hadException = false; 221 m_globalScopeExecutionState->hadException = false;
226 } 222 }
227 223
228 v8::Local<v8::Value> result; 224 v8::Local<v8::Value> result;
229 if (!maybeResult.ToLocal(&result) || result->IsUndefined()) 225 if (!maybeResult.ToLocal(&result) || result->IsUndefined())
230 return ScriptValue(); 226 return ScriptValue();
231 227
232 return ScriptValue(m_scriptState.get(), result); 228 return ScriptValue(m_scriptState.get(), result);
233 } 229 }
234 230
235 bool WorkerScriptController::evaluate(const ScriptSourceCode& sourceCode, RefPtr WillBeRawPtr<ErrorEvent>* errorEvent, CachedMetadataHandler* cacheHandler, V8Cac heOptions v8CacheOptions) 231 bool GlobalScopeScriptController::evaluate(const ScriptSourceCode& sourceCode, R efPtrWillBeRawPtr<ErrorEvent>* errorEvent, CachedMetadataHandler* cacheHandler, V8CacheOptions v8CacheOptions)
236 { 232 {
237 if (isExecutionForbidden()) 233 if (isExecutionForbidden())
238 return false; 234 return false;
239 235
240 WorkerGlobalScopeExecutionState state(this); 236 GlobalScopeExecutionState state(this);
241 evaluate(sourceCode.source(), sourceCode.url().string(), sourceCode.startPos ition(), cacheHandler, v8CacheOptions); 237 evaluate(sourceCode.source(), sourceCode.url().string(), sourceCode.startPos ition(), cacheHandler, v8CacheOptions);
242 if (isExecutionForbidden()) 238 if (isExecutionForbidden())
243 return false; 239 return false;
244 if (state.hadException) { 240 if (state.hadException) {
245 if (errorEvent) { 241 if (errorEvent) {
246 if (state.m_errorEventFromImportedScript) { 242 if (state.m_errorEventFromImportedScript) {
247 // Propagate inner error event outwards. 243 // Propagate inner error event outwards.
248 *errorEvent = state.m_errorEventFromImportedScript.release(); 244 *errorEvent = state.m_errorEventFromImportedScript.release();
249 return false; 245 return false;
250 } 246 }
251 if (m_workerGlobalScope->shouldSanitizeScriptError(state.sourceURL, NotSharableCrossOrigin)) 247 if (m_abstractGlobalScope->shouldSanitizeScriptError(state.sourceURL , NotSharableCrossOrigin))
252 *errorEvent = ErrorEvent::createSanitizedError(m_world.get()); 248 *errorEvent = ErrorEvent::createSanitizedError(m_world.get());
253 else 249 else
254 *errorEvent = ErrorEvent::create(state.errorMessage, state.sourc eURL, state.lineNumber, state.columnNumber, m_world.get()); 250 *errorEvent = ErrorEvent::create(state.errorMessage, state.sourc eURL, state.lineNumber, state.columnNumber, m_world.get());
255 V8ErrorHandler::storeExceptionOnErrorEventWrapper(m_scriptState.get( ), errorEvent->get(), state.exception.v8Value(), m_scriptState->context()->Globa l()); 251 V8ErrorHandler::storeExceptionOnErrorEventWrapper(m_scriptState.get( ), errorEvent->get(), state.exception.v8Value(), m_scriptState->context()->Globa l());
256 } else { 252 } else {
257 ASSERT(!m_workerGlobalScope->shouldSanitizeScriptError(state.sourceU RL, NotSharableCrossOrigin)); 253 ASSERT(!m_abstractGlobalScope->shouldSanitizeScriptError(state.sourc eURL, NotSharableCrossOrigin));
258 RefPtrWillBeRawPtr<ErrorEvent> event = nullptr; 254 RefPtrWillBeRawPtr<ErrorEvent> event = nullptr;
259 if (state.m_errorEventFromImportedScript) 255 if (state.m_errorEventFromImportedScript)
260 event = state.m_errorEventFromImportedScript.release(); 256 event = state.m_errorEventFromImportedScript.release();
261 else 257 else
262 event = ErrorEvent::create(state.errorMessage, state.sourceURL, state.lineNumber, state.columnNumber, m_world.get()); 258 event = ErrorEvent::create(state.errorMessage, state.sourceURL, state.lineNumber, state.columnNumber, m_world.get());
263 m_workerGlobalScope->reportException(event, 0, nullptr, NotSharableC rossOrigin); 259 m_abstractGlobalScope->reportException(event, 0, nullptr, NotSharabl eCrossOrigin);
264 } 260 }
265 return false; 261 return false;
266 } 262 }
267 return true; 263 return true;
268 } 264 }
269 265
270 void WorkerScriptController::willScheduleExecutionTermination() 266 void GlobalScopeScriptController::willScheduleExecutionTermination()
271 { 267 {
272 // The mutex provides a memory barrier to ensure that once 268 // The mutex provides a memory barrier to ensure that once
273 // termination is scheduled, isExecutionTerminating will 269 // termination is scheduled, isExecutionTerminating will
274 // accurately reflect that state when called from another thread. 270 // accurately reflect that state when called from another thread.
275 MutexLocker locker(m_scheduledTerminationMutex); 271 MutexLocker locker(m_scheduledTerminationMutex);
276 m_executionScheduledToTerminate = true; 272 m_executionScheduledToTerminate = true;
277 } 273 }
278 274
279 bool WorkerScriptController::isExecutionTerminating() const 275 bool GlobalScopeScriptController::isExecutionTerminating() const
280 { 276 {
281 // See comments in willScheduleExecutionTermination regarding mutex usage. 277 // See comments in willScheduleExecutionTermination regarding mutex usage.
282 MutexLocker locker(m_scheduledTerminationMutex); 278 MutexLocker locker(m_scheduledTerminationMutex);
283 return m_executionScheduledToTerminate; 279 return m_executionScheduledToTerminate;
284 } 280 }
285 281
286 void WorkerScriptController::forbidExecution() 282 void GlobalScopeScriptController::forbidExecution()
287 { 283 {
288 ASSERT(m_workerGlobalScope->isContextThread()); 284 ASSERT(m_abstractGlobalScope->isContextThread());
289 m_executionForbidden = true; 285 m_executionForbidden = true;
290 } 286 }
291 287
292 bool WorkerScriptController::isExecutionForbidden() const 288 bool GlobalScopeScriptController::isExecutionForbidden() const
293 { 289 {
294 ASSERT(m_workerGlobalScope->isContextThread()); 290 ASSERT(m_abstractGlobalScope->isContextThread());
295 return m_executionForbidden; 291 return m_executionForbidden;
296 } 292 }
297 293
298 void WorkerScriptController::disableEval(const String& errorMessage) 294 void GlobalScopeScriptController::disableEval(const String& errorMessage)
299 { 295 {
300 m_disableEvalPending = errorMessage; 296 m_disableEvalPending = errorMessage;
301 } 297 }
302 298
303 void WorkerScriptController::rethrowExceptionFromImportedScript(PassRefPtrWillBe RawPtr<ErrorEvent> errorEvent, ExceptionState& exceptionState) 299 void GlobalScopeScriptController::rethrowExceptionFromImportedScript(PassRefPtrW illBeRawPtr<ErrorEvent> errorEvent, ExceptionState& exceptionState)
304 { 300 {
305 const String& errorMessage = errorEvent->message(); 301 const String& errorMessage = errorEvent->message();
306 if (m_globalScopeExecutionState) 302 if (m_globalScopeExecutionState)
307 m_globalScopeExecutionState->m_errorEventFromImportedScript = errorEvent ; 303 m_globalScopeExecutionState->m_errorEventFromImportedScript = errorEvent ;
308 exceptionState.rethrowV8Exception(V8ThrowException::createGeneralError(isola te(), errorMessage)); 304 exceptionState.rethrowV8Exception(V8ThrowException::createGeneralError(isola te(), errorMessage));
309 } 305 }
310 306
311 DEFINE_TRACE(WorkerScriptController) 307 DEFINE_TRACE(GlobalScopeScriptController)
312 { 308 {
313 visitor->trace(m_workerGlobalScope); 309 visitor->trace(m_abstractGlobalScope);
314 visitor->trace(m_rejectedPromises); 310 visitor->trace(m_rejectedPromises);
315 } 311 }
316 312
317 } // namespace blink 313 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698