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

Unified Diff: Source/core/workers/WorkerMessagingProxy.cpp

Issue 17648006: Rename WorkerContext to WorkerGlobalScope (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase on master Created 7 years, 6 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/workers/WorkerMessagingProxy.h ('k') | Source/core/workers/WorkerObjectProxy.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/workers/WorkerMessagingProxy.cpp
diff --git a/Source/core/workers/WorkerMessagingProxy.cpp b/Source/core/workers/WorkerMessagingProxy.cpp
index 139adbdfc724f84b317dbb371f2bc32443927a9f..7af0c0a43e9f4ddb5aa6ca813b5058395d475cdb 100644
--- a/Source/core/workers/WorkerMessagingProxy.cpp
+++ b/Source/core/workers/WorkerMessagingProxy.cpp
@@ -45,22 +45,22 @@
#include "core/page/DOMWindow.h"
#include "core/page/PageGroup.h"
#include "core/platform/NotImplemented.h"
-#include "core/workers/DedicatedWorkerContext.h"
+#include "core/workers/DedicatedWorkerGlobalScope.h"
#include "core/workers/DedicatedWorkerThread.h"
#include "core/workers/Worker.h"
#include <wtf/MainThread.h>
namespace WebCore {
-class MessageWorkerContextTask : public ScriptExecutionContext::Task {
+class MessageWorkerGlobalScopeTask : public ScriptExecutionContext::Task {
public:
- static PassOwnPtr<MessageWorkerContextTask> create(PassRefPtr<SerializedScriptValue> message, PassOwnPtr<MessagePortChannelArray> channels)
+ static PassOwnPtr<MessageWorkerGlobalScopeTask> create(PassRefPtr<SerializedScriptValue> message, PassOwnPtr<MessagePortChannelArray> channels)
{
- return adoptPtr(new MessageWorkerContextTask(message, channels));
+ return adoptPtr(new MessageWorkerGlobalScopeTask(message, channels));
}
private:
- MessageWorkerContextTask(PassRefPtr<SerializedScriptValue> message, PassOwnPtr<MessagePortChannelArray> channels)
+ MessageWorkerGlobalScopeTask(PassRefPtr<SerializedScriptValue> message, PassOwnPtr<MessagePortChannelArray> channels)
: m_message(message)
, m_channels(channels)
{
@@ -68,8 +68,8 @@ private:
virtual void performTask(ScriptExecutionContext* scriptContext)
{
- ASSERT_WITH_SECURITY_IMPLICATION(scriptContext->isWorkerContext());
- DedicatedWorkerContext* context = static_cast<DedicatedWorkerContext*>(scriptContext);
+ ASSERT_WITH_SECURITY_IMPLICATION(scriptContext->isWorkerGlobalScope());
+ DedicatedWorkerGlobalScope* context = static_cast<DedicatedWorkerGlobalScope*>(scriptContext);
OwnPtr<MessagePortArray> ports = MessagePort::entanglePorts(*scriptContext, m_channels.release());
context->dispatchEvent(MessageEvent::create(ports.release(), m_message));
context->thread()->workerObjectProxy().confirmMessageFromWorkerObject(context->hasPendingActivity());
@@ -147,22 +147,22 @@ private:
WorkerMessagingProxy* m_messagingProxy;
};
-class WorkerContextDestroyedTask : public ScriptExecutionContext::Task {
+class WorkerGlobalScopeDestroyedTask : public ScriptExecutionContext::Task {
public:
- static PassOwnPtr<WorkerContextDestroyedTask> create(WorkerMessagingProxy* messagingProxy)
+ static PassOwnPtr<WorkerGlobalScopeDestroyedTask> create(WorkerMessagingProxy* messagingProxy)
{
- return adoptPtr(new WorkerContextDestroyedTask(messagingProxy));
+ return adoptPtr(new WorkerGlobalScopeDestroyedTask(messagingProxy));
}
private:
- WorkerContextDestroyedTask(WorkerMessagingProxy* messagingProxy)
+ WorkerGlobalScopeDestroyedTask(WorkerMessagingProxy* messagingProxy)
: m_messagingProxy(messagingProxy)
{
}
virtual void performTask(ScriptExecutionContext*)
{
- m_messagingProxy->workerContextDestroyedInternal();
+ m_messagingProxy->workerGlobalScopeDestroyedInternal();
}
WorkerMessagingProxy* m_messagingProxy;
@@ -183,7 +183,7 @@ private:
virtual void performTask(ScriptExecutionContext*)
{
- m_messagingProxy->terminateWorkerContext();
+ m_messagingProxy->terminateWorkerGlobalScope();
}
WorkerMessagingProxy* m_messagingProxy;
@@ -230,7 +230,7 @@ private:
virtual void performTask(ScriptExecutionContext*)
{
- if (WorkerContextProxy::PageInspector* pageInspector = m_messagingProxy->m_pageInspector)
+ if (WorkerGlobalScopeProxy::PageInspector* pageInspector = m_messagingProxy->m_pageInspector)
pageInspector->dispatchMessageFromWorker(m_message);
}
@@ -249,17 +249,17 @@ WorkerMessagingProxy::WorkerMessagingProxy(Worker* workerObject)
{
ASSERT(m_workerObject);
ASSERT((m_scriptExecutionContext->isDocument() && isMainThread())
- || (m_scriptExecutionContext->isWorkerContext() && static_cast<WorkerContext*>(m_scriptExecutionContext.get())->thread()->isCurrentThread()));
+ || (m_scriptExecutionContext->isWorkerGlobalScope() && static_cast<WorkerGlobalScope*>(m_scriptExecutionContext.get())->thread()->isCurrentThread()));
}
WorkerMessagingProxy::~WorkerMessagingProxy()
{
ASSERT(!m_workerObject);
ASSERT((m_scriptExecutionContext->isDocument() && isMainThread())
- || (m_scriptExecutionContext->isWorkerContext() && static_cast<WorkerContext*>(m_scriptExecutionContext.get())->thread()->isCurrentThread()));
+ || (m_scriptExecutionContext->isWorkerGlobalScope() && static_cast<WorkerGlobalScope*>(m_scriptExecutionContext.get())->thread()->isCurrentThread()));
}
-void WorkerMessagingProxy::startWorkerContext(const KURL& scriptURL, const String& userAgent, const String& sourceCode, WorkerThreadStartMode startMode)
+void WorkerMessagingProxy::startWorkerGlobalScope(const KURL& scriptURL, const String& userAgent, const String& sourceCode, WorkerThreadStartMode startMode)
{
// FIXME: This need to be revisited when we support nested worker one day
ASSERT(m_scriptExecutionContext->isDocument());
@@ -267,7 +267,7 @@ void WorkerMessagingProxy::startWorkerContext(const KURL& scriptURL, const Strin
RefPtr<DedicatedWorkerThread> thread = DedicatedWorkerThread::create(scriptURL, userAgent, sourceCode, *this, *this, startMode, document->contentSecurityPolicy()->deprecatedHeader(), document->contentSecurityPolicy()->deprecatedHeaderType(), document->topOrigin(), document->loader()->timing()->referenceMonotonicTime());
workerThreadCreated(thread);
thread->start();
- InspectorInstrumentation::didStartWorkerContext(m_scriptExecutionContext.get(), this, scriptURL);
+ InspectorInstrumentation::didStartWorkerGlobalScope(m_scriptExecutionContext.get(), this, scriptURL);
}
void WorkerMessagingProxy::postMessageToWorkerObject(PassRefPtr<SerializedScriptValue> message, PassOwnPtr<MessagePortChannelArray> channels)
@@ -275,19 +275,19 @@ void WorkerMessagingProxy::postMessageToWorkerObject(PassRefPtr<SerializedScript
m_scriptExecutionContext->postTask(MessageWorkerTask::create(message, channels, this));
}
-void WorkerMessagingProxy::postMessageToWorkerContext(PassRefPtr<SerializedScriptValue> message, PassOwnPtr<MessagePortChannelArray> channels)
+void WorkerMessagingProxy::postMessageToWorkerGlobalScope(PassRefPtr<SerializedScriptValue> message, PassOwnPtr<MessagePortChannelArray> channels)
{
if (m_askedToTerminate)
return;
if (m_workerThread) {
++m_unconfirmedMessageCount;
- m_workerThread->runLoop().postTask(MessageWorkerContextTask::create(message, channels));
+ m_workerThread->runLoop().postTask(MessageWorkerGlobalScopeTask::create(message, channels));
} else
- m_queuedEarlyTasks.append(MessageWorkerContextTask::create(message, channels));
+ m_queuedEarlyTasks.append(MessageWorkerGlobalScopeTask::create(message, channels));
}
-bool WorkerMessagingProxy::postTaskForModeToWorkerContext(PassOwnPtr<ScriptExecutionContext::Task> task, const String& mode)
+bool WorkerMessagingProxy::postTaskForModeToWorkerGlobalScope(PassOwnPtr<ScriptExecutionContext::Task> task, const String& mode)
{
if (m_askedToTerminate)
return false;
@@ -350,30 +350,30 @@ void WorkerMessagingProxy::workerObjectDestroyedInternal(ScriptExecutionContext*
{
proxy->m_mayBeDestroyed = true;
if (proxy->m_workerThread)
- proxy->terminateWorkerContext();
+ proxy->terminateWorkerGlobalScope();
else
- proxy->workerContextDestroyedInternal();
+ proxy->workerGlobalScopeDestroyedInternal();
}
-static void connectToWorkerContextInspectorTask(ScriptExecutionContext* context, bool)
+static void connectToWorkerGlobalScopeInspectorTask(ScriptExecutionContext* context, bool)
{
- ASSERT_WITH_SECURITY_IMPLICATION(context->isWorkerContext());
- static_cast<WorkerContext*>(context)->workerInspectorController()->connectFrontend();
+ ASSERT_WITH_SECURITY_IMPLICATION(context->isWorkerGlobalScope());
+ static_cast<WorkerGlobalScope*>(context)->workerInspectorController()->connectFrontend();
}
-void WorkerMessagingProxy::connectToInspector(WorkerContextProxy::PageInspector* pageInspector)
+void WorkerMessagingProxy::connectToInspector(WorkerGlobalScopeProxy::PageInspector* pageInspector)
{
if (m_askedToTerminate)
return;
ASSERT(!m_pageInspector);
m_pageInspector = pageInspector;
- m_workerThread->runLoop().postTaskForMode(createCallbackTask(connectToWorkerContextInspectorTask, true), WorkerDebuggerAgent::debuggerTaskMode);
+ m_workerThread->runLoop().postTaskForMode(createCallbackTask(connectToWorkerGlobalScopeInspectorTask, true), WorkerDebuggerAgent::debuggerTaskMode);
}
-static void disconnectFromWorkerContextInspectorTask(ScriptExecutionContext* context, bool)
+static void disconnectFromWorkerGlobalScopeInspectorTask(ScriptExecutionContext* context, bool)
{
- ASSERT_WITH_SECURITY_IMPLICATION(context->isWorkerContext());
- static_cast<WorkerContext*>(context)->workerInspectorController()->disconnectFrontend();
+ ASSERT_WITH_SECURITY_IMPLICATION(context->isWorkerGlobalScope());
+ static_cast<WorkerGlobalScope*>(context)->workerInspectorController()->disconnectFrontend();
}
void WorkerMessagingProxy::disconnectFromInspector()
@@ -381,13 +381,13 @@ void WorkerMessagingProxy::disconnectFromInspector()
m_pageInspector = 0;
if (m_askedToTerminate)
return;
- m_workerThread->runLoop().postTaskForMode(createCallbackTask(disconnectFromWorkerContextInspectorTask, true), WorkerDebuggerAgent::debuggerTaskMode);
+ m_workerThread->runLoop().postTaskForMode(createCallbackTask(disconnectFromWorkerGlobalScopeInspectorTask, true), WorkerDebuggerAgent::debuggerTaskMode);
}
static void dispatchOnInspectorBackendTask(ScriptExecutionContext* context, const String& message)
{
- ASSERT_WITH_SECURITY_IMPLICATION(context->isWorkerContext());
- static_cast<WorkerContext*>(context)->workerInspectorController()->dispatchMessageFromFrontend(message);
+ ASSERT_WITH_SECURITY_IMPLICATION(context->isWorkerGlobalScope());
+ static_cast<WorkerGlobalScope*>(context)->workerInspectorController()->dispatchMessageFromFrontend(message);
}
void WorkerMessagingProxy::sendMessageToInspector(const String& message)
@@ -398,32 +398,32 @@ void WorkerMessagingProxy::sendMessageToInspector(const String& message)
WorkerDebuggerAgent::interruptAndDispatchInspectorCommands(m_workerThread.get());
}
-void WorkerMessagingProxy::workerContextDestroyed()
+void WorkerMessagingProxy::workerGlobalScopeDestroyed()
{
- m_scriptExecutionContext->postTask(WorkerContextDestroyedTask::create(this));
- // Will execute workerContextDestroyedInternal() on context's thread.
+ m_scriptExecutionContext->postTask(WorkerGlobalScopeDestroyedTask::create(this));
+ // Will execute workerGlobalScopeDestroyedInternal() on context's thread.
}
-void WorkerMessagingProxy::workerContextClosed()
+void WorkerMessagingProxy::workerGlobalScopeClosed()
{
- // Executes terminateWorkerContext() on parent context's thread.
+ // Executes terminateWorkerGlobalScope() on parent context's thread.
m_scriptExecutionContext->postTask(WorkerTerminateTask::create(this));
}
-void WorkerMessagingProxy::workerContextDestroyedInternal()
+void WorkerMessagingProxy::workerGlobalScopeDestroyedInternal()
{
- // WorkerContextDestroyedTask is always the last to be performed, so the proxy is not needed for communication
+ // WorkerGlobalScopeDestroyedTask is always the last to be performed, so the proxy is not needed for communication
// in either side any more. However, the Worker object may still exist, and it assumes that the proxy exists, too.
m_askedToTerminate = true;
m_workerThread = 0;
- InspectorInstrumentation::workerContextTerminated(m_scriptExecutionContext.get(), this);
+ InspectorInstrumentation::workerGlobalScopeTerminated(m_scriptExecutionContext.get(), this);
if (m_mayBeDestroyed)
delete this;
}
-void WorkerMessagingProxy::terminateWorkerContext()
+void WorkerMessagingProxy::terminateWorkerGlobalScope()
{
if (m_askedToTerminate)
return;
@@ -432,7 +432,7 @@ void WorkerMessagingProxy::terminateWorkerContext()
if (m_workerThread)
m_workerThread->stop();
- InspectorInstrumentation::workerContextTerminated(m_scriptExecutionContext.get(), this);
+ InspectorInstrumentation::workerGlobalScopeTerminated(m_scriptExecutionContext.get(), this);
}
void WorkerMessagingProxy::postMessageToPageInspector(const String& message)
« no previous file with comments | « Source/core/workers/WorkerMessagingProxy.h ('k') | Source/core/workers/WorkerObjectProxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698