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

Unified Diff: third_party/WebKit/WebCore/dom/WorkerContext.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
« no previous file with comments | « third_party/WebKit/WebCore/dom/WorkerContext.h ('k') | third_party/WebKit/WebCore/dom/WorkerContext.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/WebCore/dom/WorkerContext.cpp
===================================================================
--- third_party/WebKit/WebCore/dom/WorkerContext.cpp (revision 9118)
+++ third_party/WebKit/WebCore/dom/WorkerContext.cpp (working copy)
@@ -31,6 +31,7 @@
#include "WorkerContext.h"
#include "ActiveDOMObject.h"
+#include "DOMTimer.h"
#include "DOMWindow.h"
#include "Event.h"
#include "EventException.h"
@@ -40,7 +41,6 @@
#include "WorkerLocation.h"
#include "WorkerMessagingProxy.h"
#include "WorkerNavigator.h"
-#include "WorkerTask.h"
#include "WorkerThread.h"
#include <wtf/RefPtr.h>
@@ -111,18 +111,16 @@
m_thread->messagingProxy()->postWorkerException(errorMessage, lineNumber, sourceURL);
}
-static void addMessageTask(ScriptExecutionContext* context, MessageDestination destination, MessageSource source, MessageLevel level, const String& message, unsigned lineNumber, const String& sourceURL)
+static void addMessageTask(ScriptExecutionContext* context, WorkerMessagingProxy* messagingProxy, MessageDestination destination, MessageSource source, MessageLevel level, const String& message, unsigned lineNumber, const String& sourceURL)
{
+ if (messagingProxy->askedToTerminate())
+ return;
context->addMessage(destination, source, level, message, lineNumber, sourceURL);
}
void WorkerContext::addMessage(MessageDestination destination, MessageSource source, MessageLevel level, const String& message, unsigned lineNumber, const String& sourceURL)
{
- // createCallbackTask has to be a separate statement from postTaskToParentContext to make the destructor
- // for message.copy() get called before postTaskToParentContext. (If they are one statement, the destructor
- // gets called after postTaskToParentContext which causes a race condition.)
- RefPtr<Task> task = createCallbackTask(m_thread->messagingProxy(), &addMessageTask, destination, source, level, message.copy(), lineNumber, sourceURL.copy());
- postTaskToParentContext(task.release());
+ postTaskToWorkerObject(createCallbackTask(&addMessageTask, m_thread->messagingProxy(), destination, source, level, message, lineNumber, sourceURL));
}
void WorkerContext::resourceRetrievedByXMLHttpRequest(unsigned long, const ScriptString&)
@@ -187,35 +185,24 @@
return !event->defaultPrevented();
}
-class ScriptExecutionContextTaskWorkerTask : public WorkerTask {
-public:
- static PassRefPtr<ScriptExecutionContextTaskWorkerTask> create(PassRefPtr<ScriptExecutionContext::Task> task)
- {
- return adoptRef(new ScriptExecutionContextTaskWorkerTask(task));
- }
+void WorkerContext::postTask(PassRefPtr<Task> task)
+{
+ thread()->runLoop().postTask(task);
+}
-private:
- ScriptExecutionContextTaskWorkerTask(PassRefPtr<ScriptExecutionContext::Task> task)
- : m_task(task)
- {
- }
+void WorkerContext::postTaskToWorkerObject(PassRefPtr<Task> task)
+{
+ thread()->messagingProxy()->postTaskToWorkerObject(task);
+}
- virtual void performTask(WorkerContext* context)
- {
- m_task->performTask(context);
- }
-
- RefPtr<ScriptExecutionContext::Task> m_task;
-};
-
-void WorkerContext::postTask(PassRefPtr<Task> task)
+int WorkerContext::installTimeout(ScheduledAction* action, int timeout, bool singleShot)
{
- thread()->runLoop().postTask(ScriptExecutionContextTaskWorkerTask::create(task));
+ return DOMTimer::install(scriptExecutionContext(), action, timeout, singleShot);
}
-void WorkerContext::postTaskToParentContext(PassRefPtr<Task> task)
+void WorkerContext::removeTimeout(int timeoutId)
{
- thread()->messagingProxy()->postTaskToParentContext(task);
+ DOMTimer::removeById(scriptExecutionContext(), timeoutId);
}
} // namespace WebCore
« no previous file with comments | « third_party/WebKit/WebCore/dom/WorkerContext.h ('k') | third_party/WebKit/WebCore/dom/WorkerContext.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698