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

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

Issue 1728803002: Rename WorkerThread to WorkerScript Base URL: https://chromium.googlesource.com/chromium/src.git@workerscript-controller
Patch Set: Created 4 years, 10 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
Index: third_party/WebKit/Source/core/workers/WorkerMessagingProxy.cpp
diff --git a/third_party/WebKit/Source/core/workers/WorkerMessagingProxy.cpp b/third_party/WebKit/Source/core/workers/WorkerMessagingProxy.cpp
index 039a4f3aadfad6eef5c52801ea19a94ce69b3617..ac8b5c0256e3ea942cfd5bc6e151532bf18f58fd 100644
--- a/third_party/WebKit/Source/core/workers/WorkerMessagingProxy.cpp
+++ b/third_party/WebKit/Source/core/workers/WorkerMessagingProxy.cpp
@@ -46,7 +46,7 @@
#include "core/workers/WorkerClients.h"
#include "core/workers/WorkerInspectorProxy.h"
#include "core/workers/WorkerObjectProxy.h"
-#include "core/workers/WorkerThreadStartupData.h"
+#include "core/workers/WorkerScriptStartupData.h"
#include "platform/heap/Handle.h"
#include "wtf/Functional.h"
#include "wtf/MainThread.h"
@@ -77,14 +77,14 @@ WorkerMessagingProxy::WorkerMessagingProxy(InProcessWorkerBase* workerObject, Pa
, m_workerObject(workerObject)
, m_mayBeDestroyed(false)
, m_unconfirmedMessageCount(0)
- , m_workerThreadHadPendingActivity(false)
+ , m_workerScriptHadPendingActivity(false)
, m_askedToTerminate(false)
, m_workerInspectorProxy(WorkerInspectorProxy::create())
, m_workerClients(workerClients)
{
ASSERT(m_workerObject);
ASSERT((m_executionContext->isDocument() && isMainThread())
- || (m_executionContext->isWorkerGlobalScope() && toWorkerGlobalScope(m_executionContext.get())->thread()->isCurrentThread()));
+ || (m_executionContext->isWorkerGlobalScope() && toWorkerGlobalScope(m_executionContext.get())->workerScript()->isCurrentThread()));
m_workerInspectorProxy->setWorkerGlobalScopeProxy(this);
}
@@ -92,13 +92,13 @@ WorkerMessagingProxy::~WorkerMessagingProxy()
{
ASSERT(!m_workerObject);
ASSERT((m_executionContext->isDocument() && isMainThread())
- || (m_executionContext->isWorkerGlobalScope() && toWorkerGlobalScope(m_executionContext.get())->thread()->isCurrentThread()));
+ || (m_executionContext->isWorkerGlobalScope() && toWorkerGlobalScope(m_executionContext.get())->workerScript()->isCurrentThread()));
if (m_loaderProxy)
m_loaderProxy->detachProvider(this);
m_workerInspectorProxy->setWorkerGlobalScopeProxy(nullptr);
}
-void WorkerMessagingProxy::startWorkerGlobalScope(const KURL& scriptURL, const String& userAgent, const String& sourceCode, WorkerThreadStartMode startMode)
+void WorkerMessagingProxy::startWorkerGlobalScope(const KURL& scriptURL, const String& userAgent, const String& sourceCode, WorkerScriptStartMode startMode)
{
// FIXME: This need to be revisited when we support nested worker one day
ASSERT(m_executionContext->isDocument());
@@ -112,14 +112,14 @@ void WorkerMessagingProxy::startWorkerGlobalScope(const KURL& scriptURL, const S
ContentSecurityPolicy* csp = m_workerObject->contentSecurityPolicy() ? m_workerObject->contentSecurityPolicy() : document->contentSecurityPolicy();
ASSERT(csp);
- OwnPtr<WorkerThreadStartupData> startupData = WorkerThreadStartupData::create(scriptURL, userAgent, sourceCode, nullptr, startMode, csp->headers(), starterOrigin, m_workerClients.release());
+ OwnPtr<WorkerScriptStartupData> startupData = WorkerScriptStartupData::create(scriptURL, userAgent, sourceCode, nullptr, startMode, csp->headers(), starterOrigin, m_workerClients.release());
double originTime = document->loader() ? document->loader()->timing().referenceMonotonicTime() : monotonicallyIncreasingTime();
m_loaderProxy = WorkerLoaderProxy::create(this);
- RefPtr<WorkerThread> thread = createWorkerThread(originTime);
- thread->start(startupData.release());
- workerThreadCreated(thread);
- m_workerInspectorProxy->workerThreadCreated(m_executionContext.get(), m_workerThread.get(), scriptURL);
+ RefPtr<WorkerScript> workerScript = createWorkerScript(originTime);
+ workerScript->start(startupData.release());
+ workerScriptCreated(workerScript);
+ m_workerInspectorProxy->workerScriptCreated(m_executionContext.get(), m_workerScript.get(), scriptURL);
}
void WorkerMessagingProxy::postMessageToWorkerObject(PassRefPtr<SerializedScriptValue> message, PassOwnPtr<MessagePortChannelArray> channels)
@@ -137,9 +137,9 @@ void WorkerMessagingProxy::postMessageToWorkerGlobalScope(PassRefPtr<SerializedS
return;
OwnPtr<ExecutionContextTask> task = createCrossThreadTask(&processMessageOnWorkerGlobalScope, message, channels, AllowCrossThreadAccess(&workerObjectProxy()));
- if (m_workerThread) {
+ if (m_workerScript) {
++m_unconfirmedMessageCount;
- m_workerThread->postTask(BLINK_FROM_HERE, task.release());
+ m_workerScript->postTask(BLINK_FROM_HERE, task.release());
} else {
m_queuedEarlyTasks.append(task.release());
}
@@ -150,8 +150,8 @@ bool WorkerMessagingProxy::postTaskToWorkerGlobalScope(PassOwnPtr<ExecutionConte
if (m_askedToTerminate)
return false;
- ASSERT(m_workerThread);
- m_workerThread->postTask(BLINK_FROM_HERE, task);
+ ASSERT(m_workerScript);
+ m_workerScript->postTask(BLINK_FROM_HERE, task);
return true;
}
@@ -191,17 +191,17 @@ void WorkerMessagingProxy::reportConsoleMessage(MessageSource source, MessageLev
frame->console().addMessage(consoleMessage.release());
}
-void WorkerMessagingProxy::workerThreadCreated(PassRefPtr<WorkerThread> workerThread)
+void WorkerMessagingProxy::workerScriptCreated(PassRefPtr<WorkerScript> workerScript)
{
ASSERT(!m_askedToTerminate);
- m_workerThread = workerThread;
+ m_workerScript = workerScript;
ASSERT(!m_unconfirmedMessageCount);
m_unconfirmedMessageCount = m_queuedEarlyTasks.size();
- m_workerThreadHadPendingActivity = true; // Worker initialization means a pending activity.
+ m_workerScriptHadPendingActivity = true; // Worker initialization means a pending activity.
for (auto& earlyTasks : m_queuedEarlyTasks)
- m_workerThread->postTask(BLINK_FROM_HERE, earlyTasks.release());
+ m_workerScript->postTask(BLINK_FROM_HERE, earlyTasks.release());
m_queuedEarlyTasks.clear();
}
@@ -218,18 +218,18 @@ void WorkerMessagingProxy::workerObjectDestroyed()
void WorkerMessagingProxy::workerObjectDestroyedInternal()
{
m_mayBeDestroyed = true;
- if (m_workerThread)
+ if (m_workerScript)
terminateWorkerGlobalScope();
else
- workerThreadTerminated();
+ workerScriptTerminated();
}
-void WorkerMessagingProxy::workerThreadTerminated()
+void WorkerMessagingProxy::workerScriptTerminated()
{
// This method 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 = nullptr;
+ m_workerScript = nullptr;
terminateInternally();
if (m_mayBeDestroyed)
delete this;
@@ -241,8 +241,8 @@ void WorkerMessagingProxy::terminateWorkerGlobalScope()
return;
m_askedToTerminate = true;
- if (m_workerThread)
- m_workerThread->terminate();
+ if (m_workerScript)
+ m_workerScript->terminate();
terminateInternally();
}
@@ -281,17 +281,17 @@ void WorkerMessagingProxy::confirmMessageFromWorkerObject(bool hasPendingActivit
void WorkerMessagingProxy::reportPendingActivity(bool hasPendingActivity)
{
- m_workerThreadHadPendingActivity = hasPendingActivity;
+ m_workerScriptHadPendingActivity = hasPendingActivity;
}
bool WorkerMessagingProxy::hasPendingActivity() const
{
- return (m_unconfirmedMessageCount || m_workerThreadHadPendingActivity) && !m_askedToTerminate;
+ return (m_unconfirmedMessageCount || m_workerScriptHadPendingActivity) && !m_askedToTerminate;
}
void WorkerMessagingProxy::terminateInternally()
{
- m_workerInspectorProxy->workerThreadTerminated();
+ m_workerInspectorProxy->workerScriptTerminated();
// FIXME: This need to be revisited when we support nested worker one day
ASSERT(m_executionContext->isDocument());

Powered by Google App Engine
This is Rietveld 408576698