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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 | 98 |
99 OwnPtr<gin::IsolateHolder> m_isolateHolder; | 99 OwnPtr<gin::IsolateHolder> m_isolateHolder; |
100 }; | 100 }; |
101 | 101 |
102 WorkerScriptController::~WorkerScriptController() | 102 WorkerScriptController::~WorkerScriptController() |
103 { | 103 { |
104 ThreadState::current()->removeInterruptor(m_interruptor.get()); | 104 ThreadState::current()->removeInterruptor(m_interruptor.get()); |
105 | 105 |
106 RELEASE_ASSERT(m_world->hasOneRef()); | 106 RELEASE_ASSERT(m_world->hasOneRef()); |
107 // ~DOMWrapperWorld() must be called before disposing the isolate. | 107 // ~DOMWrapperWorld() must be called before disposing the isolate. |
108 m_world = 0; | 108 m_world = nullptr; |
109 | 109 |
110 // The corresponding call to didStartWorkerRunLoop is in | 110 // The corresponding call to didStartWorkerRunLoop is in |
111 // WorkerThread::workerThread(). | 111 // WorkerThread::workerThread(). |
112 // See http://webkit.org/b/83104#c14 for why this is here. | 112 // See http://webkit.org/b/83104#c14 for why this is here. |
113 blink::Platform::current()->didStopWorkerRunLoop(blink::WebWorkerRunLoop(&m_
workerGlobalScope.thread()->runLoop())); | 113 blink::Platform::current()->didStopWorkerRunLoop(blink::WebWorkerRunLoop(&m_
workerGlobalScope.thread()->runLoop())); |
114 | 114 |
115 disposeContext(); | 115 disposeContext(); |
116 | 116 |
117 ThreadState::current()->addCleanupTask(IsolateCleanupTask::create(m_isolateH
older.release())); | 117 ThreadState::current()->addCleanupTask(IsolateCleanupTask::create(m_isolateH
older.release())); |
118 } | 118 } |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 void WorkerScriptController::evaluate(const ScriptSourceCode& sourceCode, RefPtr
<ErrorEvent>* errorEvent) | 219 void WorkerScriptController::evaluate(const ScriptSourceCode& sourceCode, RefPtr
<ErrorEvent>* errorEvent) |
220 { | 220 { |
221 if (isExecutionForbidden()) | 221 if (isExecutionForbidden()) |
222 return; | 222 return; |
223 | 223 |
224 WorkerGlobalScopeExecutionState state; | 224 WorkerGlobalScopeExecutionState state; |
225 evaluate(sourceCode.source(), sourceCode.url().string(), sourceCode.startPos
ition(), &state); | 225 evaluate(sourceCode.source(), sourceCode.url().string(), sourceCode.startPos
ition(), &state); |
226 if (state.hadException) { | 226 if (state.hadException) { |
227 if (errorEvent) { | 227 if (errorEvent) { |
228 *errorEvent = m_workerGlobalScope.shouldSanitizeScriptError(state.so
urceURL, NotSharableCrossOrigin) ? | 228 *errorEvent = m_workerGlobalScope.shouldSanitizeScriptError(state.so
urceURL, NotSharableCrossOrigin) ? |
229 ErrorEvent::createSanitizedError(0) : ErrorEvent::create(state.e
rrorMessage, state.sourceURL, state.lineNumber, state.columnNumber, 0); | 229 ErrorEvent::createSanitizedError(nullptr) : ErrorEvent::create(s
tate.errorMessage, state.sourceURL, state.lineNumber, state.columnNumber, nullpt
r); |
230 V8ErrorHandler::storeExceptionOnErrorEventWrapper(errorEvent->get(),
state.exception.v8Value(), isolate()); | 230 V8ErrorHandler::storeExceptionOnErrorEventWrapper(errorEvent->get(),
state.exception.v8Value(), isolate()); |
231 } else { | 231 } else { |
232 ASSERT(!m_workerGlobalScope.shouldSanitizeScriptError(state.sourceUR
L, NotSharableCrossOrigin)); | 232 ASSERT(!m_workerGlobalScope.shouldSanitizeScriptError(state.sourceUR
L, NotSharableCrossOrigin)); |
233 RefPtr<ErrorEvent> event = m_errorEventFromImportedScript ? m_errorE
ventFromImportedScript.release() : ErrorEvent::create(state.errorMessage, state.
sourceURL, state.lineNumber, state.columnNumber, 0); | 233 RefPtr<ErrorEvent> event = m_errorEventFromImportedScript ? m_errorE
ventFromImportedScript.release() : ErrorEvent::create(state.errorMessage, state.
sourceURL, state.lineNumber, state.columnNumber, nullptr); |
234 m_workerGlobalScope.reportException(event, 0, NotSharableCrossOrigin
); | 234 m_workerGlobalScope.reportException(event, nullptr, NotSharableCross
Origin); |
235 } | 235 } |
236 } | 236 } |
237 } | 237 } |
238 | 238 |
239 void WorkerScriptController::scheduleExecutionTermination() | 239 void WorkerScriptController::scheduleExecutionTermination() |
240 { | 240 { |
241 // The mutex provides a memory barrier to ensure that once | 241 // The mutex provides a memory barrier to ensure that once |
242 // termination is scheduled, isExecutionTerminating will | 242 // termination is scheduled, isExecutionTerminating will |
243 // accurately reflect that state when called from another thread. | 243 // accurately reflect that state when called from another thread. |
244 { | 244 { |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 v8::Handle<v8::Object> global = context->Global(); | 287 v8::Handle<v8::Object> global = context->Global(); |
288 global = global->FindInstanceInPrototypeChain(V8WorkerGlobalScope::domTempla
te(isolate, WorkerWorld)); | 288 global = global->FindInstanceInPrototypeChain(V8WorkerGlobalScope::domTempla
te(isolate, WorkerWorld)); |
289 // Return 0 if the current executing context is not the worker context. | 289 // Return 0 if the current executing context is not the worker context. |
290 if (global.IsEmpty()) | 290 if (global.IsEmpty()) |
291 return 0; | 291 return 0; |
292 WorkerGlobalScope* workerGlobalScope = V8WorkerGlobalScope::toNative(global)
; | 292 WorkerGlobalScope* workerGlobalScope = V8WorkerGlobalScope::toNative(global)
; |
293 return workerGlobalScope->script(); | 293 return workerGlobalScope->script(); |
294 } | 294 } |
295 | 295 |
296 } // namespace WebCore | 296 } // namespace WebCore |
OLD | NEW |