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

Unified Diff: third_party/WebKit/WebCore/dom/WorkerMessagingProxy.cpp

Issue 20076: WebKit merge 40500:40539 [WebKit side] (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 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/WebCore/dom/WorkerMessagingProxy.cpp
===================================================================
--- third_party/WebKit/WebCore/dom/WorkerMessagingProxy.cpp (revision 9118)
+++ third_party/WebKit/WebCore/dom/WorkerMessagingProxy.cpp (working copy)
@@ -33,14 +33,14 @@
#include "DOMWindow.h"
#include "Document.h"
#include "MessageEvent.h"
+#include "ScriptExecutionContext.h"
#include "Worker.h"
#include "WorkerContext.h"
-#include "WorkerTask.h"
#include "WorkerThread.h"
namespace WebCore {
-class MessageWorkerContextTask : public WorkerTask {
+class MessageWorkerContextTask : public ScriptExecutionContext::Task {
public:
static PassRefPtr<MessageWorkerContextTask> create(const String& message)
{
@@ -53,8 +53,11 @@
{
}
- virtual void performTask(WorkerContext* context)
+ virtual void performTask(ScriptExecutionContext* scriptContext)
{
+ ASSERT(scriptContext->isWorkerContext());
+ WorkerContext* context = static_cast<WorkerContext*>(scriptContext);
+
RefPtr<Event> evt = MessageEvent::create(m_message, "", "", 0, 0);
if (context->onmessage()) {
@@ -213,17 +216,22 @@
void WorkerMessagingProxy::postMessageToWorkerContext(const String& message)
{
+ postTaskToWorkerContext(MessageWorkerContextTask::create(message));
+}
+
+void WorkerMessagingProxy::postTaskToWorkerContext(PassRefPtr<ScriptExecutionContext::Task> task)
+{
if (m_askedToTerminate)
return;
if (m_workerThread) {
++m_unconfirmedMessageCount;
- m_workerThread->runLoop().postTask(MessageWorkerContextTask::create(message));
+ m_workerThread->runLoop().postTask(task);
} else
- m_queuedEarlyTasks.append(MessageWorkerContextTask::create(message));
+ m_queuedEarlyTasks.append(task);
}
-void WorkerMessagingProxy::postTaskToParentContext(PassRefPtr<ScriptExecutionContext::Task> task)
+void WorkerMessagingProxy::postTaskToWorkerObject(PassRefPtr<ScriptExecutionContext::Task> task)
{
m_scriptExecutionContext->postTask(task);
}
@@ -257,7 +265,7 @@
if (m_workerThread)
terminate();
else
- workerContextDestroyedInternal(); // It never existed, just do our cleanup.
+ workerContextDestroyedInternal();
}
void WorkerMessagingProxy::workerContextDestroyed()
@@ -270,6 +278,7 @@
{
// WorkerContextDestroyedTask 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_workerThread = 0;
if (!m_workerObject)
delete this;
}
« no previous file with comments | « third_party/WebKit/WebCore/dom/WorkerMessagingProxy.h ('k') | third_party/WebKit/WebCore/dom/WorkerRunLoop.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698