| Index: Source/core/workers/WorkerThread.cpp
|
| diff --git a/Source/core/workers/WorkerThread.cpp b/Source/core/workers/WorkerThread.cpp
|
| index 23a36f632a750984eb839a784ea3d6107ca528a3..0a378aa1193e779ac5f8a94637b2e540a71c5e39 100644
|
| --- a/Source/core/workers/WorkerThread.cpp
|
| +++ b/Source/core/workers/WorkerThread.cpp
|
| @@ -32,7 +32,7 @@
|
| #include "bindings/v8/ScriptValue.h"
|
| #include "core/inspector/InspectorInstrumentation.h"
|
| #include "core/platform/ThreadGlobalData.h"
|
| -#include "core/workers/DedicatedWorkerContext.h"
|
| +#include "core/workers/DedicatedWorkerGlobalScope.h"
|
| #include "modules/webdatabase/DatabaseManager.h"
|
| #include "modules/webdatabase/DatabaseTask.h"
|
| #include "public/platform/Platform.h"
|
| @@ -135,20 +135,20 @@ void WorkerThread::workerThread()
|
| {
|
| {
|
| MutexLocker lock(m_threadCreationMutex);
|
| - m_workerContext = createWorkerContext(m_startupData->m_scriptURL, m_startupData->m_userAgent, m_startupData->m_contentSecurityPolicy, m_startupData->m_contentSecurityPolicyType, m_startupData->m_topOrigin.release());
|
| + m_workerGlobalScope = createWorkerGlobalScope(m_startupData->m_scriptURL, m_startupData->m_userAgent, m_startupData->m_contentSecurityPolicy, m_startupData->m_contentSecurityPolicyType, m_startupData->m_topOrigin.release());
|
|
|
| if (m_runLoop.terminated()) {
|
| // The worker was terminated before the thread had a chance to run. Since the context didn't exist yet,
|
| // forbidExecution() couldn't be called from stop().
|
| - m_workerContext->script()->forbidExecution();
|
| + m_workerGlobalScope->script()->forbidExecution();
|
| }
|
| }
|
| // The corresponding call to didStopWorkerRunLoop is in
|
| // ~WorkerScriptController.
|
| WebKit::Platform::current()->didStartWorkerRunLoop(WebKit::WebWorkerRunLoop(&m_runLoop));
|
|
|
| - WorkerScriptController* script = m_workerContext->script();
|
| - InspectorInstrumentation::willEvaluateWorkerScript(workerContext(), m_startupData->m_startMode);
|
| + WorkerScriptController* script = m_workerGlobalScope->script();
|
| + InspectorInstrumentation::willEvaluateWorkerScript(workerGlobalScope(), m_startupData->m_startMode);
|
| script->evaluate(ScriptSourceCode(m_startupData->m_sourceCode, m_startupData->m_scriptURL));
|
| // Free the startup data to cause its member variable deref's happen on the worker's thread (since
|
| // all ref/derefs of these objects are happening on the thread at this point). Note that
|
| @@ -159,11 +159,11 @@ void WorkerThread::workerThread()
|
|
|
| ThreadIdentifier threadID = m_threadID;
|
|
|
| - ASSERT(m_workerContext->hasOneRef());
|
| + ASSERT(m_workerGlobalScope->hasOneRef());
|
|
|
| // The below assignment will destroy the context, which will in turn notify messaging proxy.
|
| // We cannot let any objects survive past thread exit, because no other thread will run GC or otherwise destroy them.
|
| - m_workerContext = 0;
|
| + m_workerGlobalScope = 0;
|
|
|
| // Clean up WebCore::ThreadGlobalData before WTF::WTFThreadData goes away!
|
| threadGlobalData().destroy();
|
| @@ -175,7 +175,7 @@ void WorkerThread::workerThread()
|
| void WorkerThread::runEventLoop()
|
| {
|
| // Does not return until terminated.
|
| - m_runLoop.run(m_workerContext.get());
|
| + m_runLoop.run(m_workerGlobalScope.get());
|
| }
|
|
|
| class WorkerThreadShutdownFinishTask : public ScriptExecutionContext::Task {
|
| @@ -187,11 +187,11 @@ public:
|
|
|
| virtual void performTask(ScriptExecutionContext *context)
|
| {
|
| - ASSERT_WITH_SECURITY_IMPLICATION(context->isWorkerContext());
|
| - WorkerContext* workerContext = static_cast<WorkerContext*>(context);
|
| - workerContext->clearInspector();
|
| + ASSERT_WITH_SECURITY_IMPLICATION(context->isWorkerGlobalScope());
|
| + WorkerGlobalScope* workerGlobalScope = static_cast<WorkerGlobalScope*>(context);
|
| + workerGlobalScope->clearInspector();
|
| // It's not safe to call clearScript until all the cleanup tasks posted by functions initiated by WorkerThreadShutdownStartTask have completed.
|
| - workerContext->clearScript();
|
| + workerGlobalScope->clearScript();
|
| }
|
|
|
| virtual bool isCleanupTask() const { return true; }
|
| @@ -206,20 +206,20 @@ public:
|
|
|
| virtual void performTask(ScriptExecutionContext *context)
|
| {
|
| - ASSERT_WITH_SECURITY_IMPLICATION(context->isWorkerContext());
|
| - WorkerContext* workerContext = static_cast<WorkerContext*>(context);
|
| + ASSERT_WITH_SECURITY_IMPLICATION(context->isWorkerGlobalScope());
|
| + WorkerGlobalScope* workerGlobalScope = static_cast<WorkerGlobalScope*>(context);
|
|
|
| // FIXME: Should we stop the databases as part of stopActiveDOMObjects() below?
|
| DatabaseTaskSynchronizer cleanupSync;
|
| - DatabaseManager::manager().stopDatabases(workerContext, &cleanupSync);
|
| + DatabaseManager::manager().stopDatabases(workerGlobalScope, &cleanupSync);
|
|
|
| - workerContext->stopActiveDOMObjects();
|
| + workerGlobalScope->stopActiveDOMObjects();
|
|
|
| - workerContext->notifyObserversOfStop();
|
| + workerGlobalScope->notifyObserversOfStop();
|
|
|
| // Event listeners would keep DOMWrapperWorld objects alive for too long. Also, they have references to JS objects,
|
| // which become dangling once Heap is destroyed.
|
| - workerContext->removeAllEventListeners();
|
| + workerGlobalScope->removeAllEventListeners();
|
|
|
| // We wait for the database thread to clean up all its stuff so that we
|
| // can do more stringent leak checks as we exit.
|
| @@ -227,7 +227,7 @@ public:
|
|
|
| // Stick a shutdown command at the end of the queue, so that we deal
|
| // with all the cleanup tasks the databases post first.
|
| - workerContext->postTask(WorkerThreadShutdownFinishTask::create());
|
| + workerGlobalScope->postTask(WorkerThreadShutdownFinishTask::create());
|
| }
|
|
|
| virtual bool isCleanupTask() const { return true; }
|
| @@ -239,10 +239,10 @@ void WorkerThread::stop()
|
| MutexLocker lock(m_threadCreationMutex);
|
|
|
| // Ensure that tasks are being handled by thread event loop. If script execution weren't forbidden, a while(1) loop in JS could keep the thread alive forever.
|
| - if (m_workerContext) {
|
| - m_workerContext->script()->scheduleExecutionTermination();
|
| + if (m_workerGlobalScope) {
|
| + m_workerGlobalScope->script()->scheduleExecutionTermination();
|
|
|
| - DatabaseManager::manager().interruptAllDatabasesForContext(m_workerContext.get());
|
| + DatabaseManager::manager().interruptAllDatabasesForContext(m_workerGlobalScope.get());
|
| m_runLoop.postTaskAndTerminate(WorkerThreadShutdownStartTask::create());
|
| return;
|
| }
|
|
|