Unreviewed. Restabilize non-unified build.
[WebKit-https.git] / Source / WebCore / workers / Worker.cpp
index 22101ac..e38eee3 100644 (file)
@@ -40,6 +40,7 @@
 #include "WorkerScriptLoader.h"
 #include "WorkerThread.h"
 #include <JavaScriptCore/IdentifiersFactory.h>
+#include <JavaScriptCore/ScriptCallStack.h>
 #include <wtf/HashSet.h>
 #include <wtf/IsoMallocInlines.h>
 #include <wtf/MainThread.h>
@@ -68,7 +69,7 @@ inline Worker::Worker(ScriptExecutionContext& context, JSC::RuntimeFlags runtime
     , m_identifier("worker:" + Inspector::IdentifiersFactory::createIdentifier())
     , m_contextProxy(WorkerGlobalScopeProxy::create(*this))
     , m_runtimeFlags(runtimeFlags)
-    , m_eventQueue(*this)
+    , m_eventQueue(GenericEventQueue::create(*this))
 {
     static bool addedListener;
     if (!addedListener) {
@@ -146,7 +147,7 @@ ExceptionOr<void> Worker::postMessage(JSC::ExecState& state, JSC::JSValue messag
 void Worker::terminate()
 {
     m_contextProxy.terminateWorkerGlobalScope();
-    m_eventQueue.cancelAllEvents();
+    m_eventQueue->cancelAllEvents();
 }
 
 bool Worker::canSuspendForDocumentSuspension() const
@@ -154,16 +155,6 @@ bool Worker::canSuspendForDocumentSuspension() const
     return true;
 }
 
-void Worker::suspend(ReasonForSuspension)
-{
-    m_eventQueue.suspend();
-}
-
-void Worker::resume()
-{
-    m_eventQueue.resume();
-}
-
 const char* Worker::activeDOMObjectName() const
 {
     return "Worker";
@@ -172,12 +163,11 @@ const char* Worker::activeDOMObjectName() const
 void Worker::stop()
 {
     terminate();
-    m_eventQueue.close();
 }
 
 bool Worker::hasPendingActivity() const
 {
-    return m_contextProxy.hasPendingActivity() || ActiveDOMObject::hasPendingActivity() || m_eventQueue.hasPendingEvents();
+    return m_contextProxy.hasPendingActivity() || ActiveDOMObject::hasPendingActivity() || m_eventQueue->hasPendingEvents();
 }
 
 void Worker::notifyNetworkStateChange(bool isOnLine)
@@ -217,12 +207,12 @@ void Worker::notifyFinished()
 
 void Worker::enqueueEvent(Ref<Event>&& event)
 {
-    m_eventQueue.enqueueEvent(WTFMove(event));
+    m_eventQueue->enqueueEvent(WTFMove(event));
 }
 
 void Worker::dispatchEvent(Event& event)
 {
-    RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(!m_eventQueue.isSuspended());
+    RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(!m_eventQueue->isSuspended());
 
     AbstractWorker::dispatchEvent(event);
     if (is<ErrorEvent>(event) && !event.defaultPrevented() && event.isTrusted() && scriptExecutionContext()) {