Remove DocumentEventQueue and WorkerEventQueue
https://bugs.webkit.org/show_bug.cgi?id=204841
Reviewed by Sam Weinig.
Delete DocumentEventQueue and WorkerEventQueue since we don't use them after r252824.
* Headers.cmake:
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* dom/Document.h:
* dom/DocumentEventQueue.cpp: Removed.
* dom/DocumentEventQueue.h: Removed.
* page/VisualViewport.cpp:
* rendering/RenderLayer.cpp:
* rendering/RenderListBox.cpp:
* workers/WorkerEventQueue.cpp: Removed.
* workers/WorkerEventQueue.h: Removed.
* worklets/WorkletGlobalScope.h:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@253141 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index 14c9f6e..4936ab6 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,25 @@
+2019-12-04 Ryosuke Niwa <rniwa@webkit.org>
+
+ Remove DocumentEventQueue and WorkerEventQueue
+ https://bugs.webkit.org/show_bug.cgi?id=204841
+
+ Reviewed by Sam Weinig.
+
+ Delete DocumentEventQueue and WorkerEventQueue since we don't use them after r252824.
+
+ * Headers.cmake:
+ * Sources.txt:
+ * WebCore.xcodeproj/project.pbxproj:
+ * dom/Document.h:
+ * dom/DocumentEventQueue.cpp: Removed.
+ * dom/DocumentEventQueue.h: Removed.
+ * page/VisualViewport.cpp:
+ * rendering/RenderLayer.cpp:
+ * rendering/RenderListBox.cpp:
+ * workers/WorkerEventQueue.cpp: Removed.
+ * workers/WorkerEventQueue.h: Removed.
+ * worklets/WorkletGlobalScope.h:
+
2019-12-04 Jack Lee <shihchieh_lee@apple.com>
Nullptr crash in RenderLayoutState::pageLogicalHeight const via RenderGrid::computeIntrinsicLogicalWidths inside RenderMarquee::updateMarqueePosition
diff --git a/Source/WebCore/Headers.cmake b/Source/WebCore/Headers.cmake
index cb4fe1a..882946b 100644
--- a/Source/WebCore/Headers.cmake
+++ b/Source/WebCore/Headers.cmake
@@ -373,7 +373,6 @@
dom/DeviceOrientationData.h
dom/DeviceOrientationOrMotionPermissionState.h
dom/Document.h
- dom/DocumentEventQueue.h
dom/DocumentFragment.h
dom/DocumentFullscreen.h
dom/DocumentIdentifier.h
diff --git a/Source/WebCore/Sources.txt b/Source/WebCore/Sources.txt
index 82da46f..917487e 100644
--- a/Source/WebCore/Sources.txt
+++ b/Source/WebCore/Sources.txt
@@ -868,7 +868,6 @@
dom/DeviceOrientationEvent.cpp
dom/DeviceOrientationOrMotionEvent.cpp
dom/Document.cpp
-dom/DocumentEventQueue.cpp
dom/DocumentFragment.cpp
dom/DocumentMarkerController.cpp
dom/DocumentParser.cpp
@@ -2514,7 +2513,6 @@
workers/Worker.cpp
workers/WorkerConsoleClient.cpp
workers/WorkerEventLoop.cpp
-workers/WorkerEventQueue.cpp
workers/WorkerGlobalScope.cpp
workers/WorkerInspectorProxy.cpp
workers/WorkerLocation.cpp
diff --git a/Source/WebCore/WebCore.xcodeproj/project.pbxproj b/Source/WebCore/WebCore.xcodeproj/project.pbxproj
index f836bfd..6303d7d 100644
--- a/Source/WebCore/WebCore.xcodeproj/project.pbxproj
+++ b/Source/WebCore/WebCore.xcodeproj/project.pbxproj
@@ -3070,8 +3070,6 @@
A31C4E4F16E02AB4002F7957 /* OESTextureHalfFloat.h in Headers */ = {isa = PBXBuildFile; fileRef = A31C4E4E16E02AB4002F7957 /* OESTextureHalfFloat.h */; };
A31C4E5416E02B40002F7957 /* JSOESTextureHalfFloat.h in Headers */ = {isa = PBXBuildFile; fileRef = A31C4E5316E02B40002F7957 /* JSOESTextureHalfFloat.h */; };
A3AF9D8620326861006CAD06 /* UserAgent.h in Headers */ = {isa = PBXBuildFile; fileRef = A3AF9D8220325324006CAD06 /* UserAgent.h */; settings = {ATTRIBUTES = (Private, ); }; };
- A3BB59F41457A40D00AC56FE /* DocumentEventQueue.h in Headers */ = {isa = PBXBuildFile; fileRef = A3BB59F21457A40D00AC56FE /* DocumentEventQueue.h */; settings = {ATTRIBUTES = (Private, ); }; };
- A3E2643114748991005A8588 /* WorkerEventQueue.h in Headers */ = {isa = PBXBuildFile; fileRef = A3E2642F14748991005A8588 /* WorkerEventQueue.h */; settings = {ATTRIBUTES = (Private, ); }; };
A409C985116D0DDD007197BD /* AccessibilityProgressIndicator.h in Headers */ = {isa = PBXBuildFile; fileRef = A409C983116D0DDD007197BD /* AccessibilityProgressIndicator.h */; };
A4226E5C1163D695008B8397 /* JSHTMLProgressElement.h in Headers */ = {isa = PBXBuildFile; fileRef = A4226E5B1163D695008B8397 /* JSHTMLProgressElement.h */; };
A43BF5991149290A00C643CA /* HTMLProgressElement.h in Headers */ = {isa = PBXBuildFile; fileRef = A43BF5971149290A00C643CA /* HTMLProgressElement.h */; };
@@ -11534,11 +11532,7 @@
A3AF9D8220325324006CAD06 /* UserAgent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UserAgent.h; sourceTree = "<group>"; };
A3AF9D8320325691006CAD06 /* UserAgentIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = UserAgentIOS.mm; sourceTree = "<group>"; };
A3AF9D84203256A3006CAD06 /* UserAgentMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = UserAgentMac.mm; sourceTree = "<group>"; };
- A3BB59F11457A40D00AC56FE /* DocumentEventQueue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DocumentEventQueue.cpp; sourceTree = "<group>"; };
- A3BB59F21457A40D00AC56FE /* DocumentEventQueue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DocumentEventQueue.h; sourceTree = "<group>"; };
A3D42A841F33BA3600A64B62 /* LayoutUnit.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LayoutUnit.cpp; sourceTree = "<group>"; };
- A3E2642E14748991005A8588 /* WorkerEventQueue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WorkerEventQueue.cpp; sourceTree = "<group>"; };
- A3E2642F14748991005A8588 /* WorkerEventQueue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WorkerEventQueue.h; sourceTree = "<group>"; };
A409C982116D0DDD007197BD /* AccessibilityProgressIndicator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AccessibilityProgressIndicator.cpp; sourceTree = "<group>"; };
A409C983116D0DDD007197BD /* AccessibilityProgressIndicator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AccessibilityProgressIndicator.h; sourceTree = "<group>"; };
A4226E591163D667008B8397 /* JSHTMLProgressElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLProgressElement.cpp; sourceTree = "<group>"; };
@@ -17856,8 +17850,6 @@
A52B349C1FA416F8008B6246 /* WorkerDebuggerProxy.h */,
9B0ABCA323679ACF00B45085 /* WorkerEventLoop.cpp */,
9B0ABCA423679ACF00B45085 /* WorkerEventLoop.h */,
- A3E2642E14748991005A8588 /* WorkerEventQueue.cpp */,
- A3E2642F14748991005A8588 /* WorkerEventQueue.h */,
2E4346360F546A8200B0F1BA /* WorkerGlobalScope.cpp */,
2E4346370F546A8200B0F1BA /* WorkerGlobalScope.h */,
2E4346380F546A8200B0F1BA /* WorkerGlobalScope.idl */,
@@ -22982,8 +22974,6 @@
A5C974CF11485FF10066F2AB /* KeyEventCocoa.h */,
A5C974D011485FF10066F2AB /* KeyEventCocoa.mm */,
1A4832B21A953BA6008B4DFE /* LocalizedStringsCocoa.mm */,
- CD53555723748E5900A613BD /* MediaToolboxSoftLink.cpp */,
- CD53555623748E5900A613BD /* MediaToolboxSoftLink.h */,
C53D39331C97892D007F3AE9 /* MIMETypeRegistryCocoa.mm */,
A19D93491AA11B1E00B46C24 /* NetworkExtensionContentFilter.h */,
A19D93481AA11B1E00B46C24 /* NetworkExtensionContentFilter.mm */,
@@ -27981,8 +27971,6 @@
A8185F3809765765005826D9 /* Document.h */,
6548E24809E1E04D00AF8020 /* Document.idl */,
8329A4171EC25B2B008ED4BE /* DocumentAndElementEventHandlers.idl */,
- A3BB59F11457A40D00AC56FE /* DocumentEventQueue.cpp */,
- A3BB59F21457A40D00AC56FE /* DocumentEventQueue.h */,
A8185F3709765765005826D9 /* DocumentFragment.cpp */,
A8185F3509765765005826D9 /* DocumentFragment.h */,
1A494ED50A123F1A00FDAFC1 /* DocumentFragment.idl */,
@@ -29598,7 +29586,6 @@
B2F34FE60E82F81400F627CD /* DNS.h in Headers */,
7EE6846F12D26E3800E73215 /* DNSResolveQueueCFNet.h in Headers */,
A8185F4009765766005826D9 /* Document.h in Headers */,
- A3BB59F41457A40D00AC56FE /* DocumentEventQueue.h in Headers */,
A8185F3D09765766005826D9 /* DocumentFragment.h in Headers */,
CD92F5132260FFEE00F87BB3 /* DocumentFullscreen.h in Headers */,
46E1666E1FCC86A200C9710B /* DocumentIdentifier.h in Headers */,
@@ -32962,7 +32949,6 @@
A5B81CCE1FAA44DE0037D1E6 /* WorkerDebuggerAgent.h in Headers */,
A52B349E1FA41703008B6246 /* WorkerDebuggerProxy.h in Headers */,
91E0DDC4230B41F10019E1E3 /* WorkerDOMDebuggerAgent.h in Headers */,
- A3E2643114748991005A8588 /* WorkerEventQueue.h in Headers */,
2E4346490F546A8200B0F1BA /* WorkerGlobalScope.h in Headers */,
41D129CE1F3D0EF600D15E47 /* WorkerGlobalScopeCaches.h in Headers */,
5185FCB41BB4C4E80012898F /* WorkerGlobalScopeIndexedDatabase.h in Headers */,
diff --git a/Source/WebCore/dom/Document.h b/Source/WebCore/dom/Document.h
index e84d8e4..07a96a1 100644
--- a/Source/WebCore/dom/Document.h
+++ b/Source/WebCore/dom/Document.h
@@ -31,7 +31,6 @@
#include "Color.h"
#include "ContainerNode.h"
#include "DisabledAdaptations.h"
-#include "DocumentEventQueue.h"
#include "DocumentIdentifier.h"
#include "DocumentTiming.h"
#include "ElementIdentifier.h"
diff --git a/Source/WebCore/dom/DocumentEventQueue.cpp b/Source/WebCore/dom/DocumentEventQueue.cpp
deleted file mode 100644
index 84ccc83..0000000
--- a/Source/WebCore/dom/DocumentEventQueue.cpp
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * Copyright (C) 2010 Google Inc. All Rights Reserved.
- * Copyright (C) 2013 Apple Inc. All Rights Reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-#include "config.h"
-#include "DocumentEventQueue.h"
-
-#include "DOMWindow.h"
-#include "Document.h"
-#include "Event.h"
-#include "EventNames.h"
-#include "SuspendableTimer.h"
-#include <wtf/Ref.h>
-
-namespace WebCore {
-
-class DocumentEventQueue::Timer final : public SuspendableTimerBase {
-public:
- Timer(DocumentEventQueue& eventQueue)
- : SuspendableTimerBase(&eventQueue.m_document)
- , m_eventQueue(eventQueue)
- {
- }
-
-private:
- void fired() override
- {
- ASSERT(!isSuspended());
- m_eventQueue.pendingEventTimerFired();
- }
-
- const char* activeDOMObjectName() const override { return "DocumentEventQueueTimer"; }
-
- DocumentEventQueue& m_eventQueue;
-};
-
-DocumentEventQueue::DocumentEventQueue(Document& document)
- : m_document(document)
- , m_pendingEventTimer(makeUnique<Timer>(*this))
- , m_isClosed(false)
-{
- m_pendingEventTimer->suspendIfNeeded();
-}
-
-DocumentEventQueue::~DocumentEventQueue() = default;
-
-bool DocumentEventQueue::enqueueEvent(Ref<Event>&& event)
-{
- ASSERT(event->target());
- ASSERT(!m_queuedEvents.contains(event.ptr()));
-
- if (m_isClosed)
- return false;
-
- m_queuedEvents.add(event.ptr());
- if (!m_pendingEventTimer->isActive())
- m_pendingEventTimer->startOneShot(0_s);
- return true;
-}
-
-bool DocumentEventQueue::cancelEvent(Event& event)
-{
- bool found = m_queuedEvents.remove(&event);
- if (m_queuedEvents.isEmpty())
- m_pendingEventTimer->cancel();
- return found;
-}
-
-void DocumentEventQueue::close()
-{
- m_isClosed = true;
- m_pendingEventTimer->cancel();
- m_queuedEvents.clear();
-}
-
-void DocumentEventQueue::pendingEventTimerFired()
-{
- ASSERT(!m_pendingEventTimer->isActive());
- ASSERT(!m_queuedEvents.isEmpty());
-
- m_targetsWithQueuedScrollEvents.clear();
- m_targetsWithQueuedResizeEvents.clear();
-
- // Insert a marker for where we should stop.
- ASSERT(!m_queuedEvents.contains(nullptr));
- m_queuedEvents.add(nullptr);
-
- Ref<Document> protect(m_document);
-
- while (!m_queuedEvents.isEmpty()) {
- RefPtr<Event> event = m_queuedEvents.takeFirst();
- if (!event)
- break;
- dispatchEvent(*event);
- }
-}
-
-void DocumentEventQueue::dispatchEvent(Event& event)
-{
- // FIXME: Why do we have this special case here instead of a virtual function?
- // If it's not safe to call EventTarget::dispatchEvent on a DOMWindow, then we
- // likely have problems elsewhere.
- auto& eventTarget = *event.target();
- if (is<DOMWindow>(eventTarget))
- downcast<DOMWindow>(eventTarget).dispatchEvent(event, nullptr);
- else
- eventTarget.dispatchEvent(event);
-}
-
-}
diff --git a/Source/WebCore/dom/DocumentEventQueue.h b/Source/WebCore/dom/DocumentEventQueue.h
deleted file mode 100644
index 43ae72c..0000000
--- a/Source/WebCore/dom/DocumentEventQueue.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright (C) 2010 Google Inc. All Rights Reserved.
- * Copyright (C) 2013 Apple Inc. All Rights Reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-#pragma once
-
-#include "Event.h"
-#include "EventQueue.h"
-#include <memory>
-#include <wtf/HashSet.h>
-#include <wtf/ListHashSet.h>
-
-namespace WebCore {
-
-class Document;
-class Node;
-
-class DocumentEventQueue final : public EventQueue {
-public:
- explicit DocumentEventQueue(Document&);
- virtual ~DocumentEventQueue();
-
- bool enqueueEvent(Ref<Event>&&) override;
- bool cancelEvent(Event&) override;
- void close() override;
-
-
-private:
- void pendingEventTimerFired();
- void dispatchEvent(Event&);
-
- class Timer;
-
- Document& m_document;
- std::unique_ptr<Timer> m_pendingEventTimer;
- ListHashSet<RefPtr<Event>> m_queuedEvents;
- HashSet<EventTarget*> m_targetsWithQueuedScrollEvents;
- HashSet<EventTarget*> m_targetsWithQueuedResizeEvents;
- bool m_isClosed;
-};
-
-} // namespace WebCore
diff --git a/Source/WebCore/page/VisualViewport.cpp b/Source/WebCore/page/VisualViewport.cpp
index aa91443..3ea1bc2 100644
--- a/Source/WebCore/page/VisualViewport.cpp
+++ b/Source/WebCore/page/VisualViewport.cpp
@@ -29,7 +29,6 @@
#include "ContextDestructionObserver.h"
#include "DOMWindow.h"
#include "Document.h"
-#include "DocumentEventQueue.h"
#include "Event.h"
#include "EventNames.h"
#include "Frame.h"
diff --git a/Source/WebCore/rendering/RenderLayer.cpp b/Source/WebCore/rendering/RenderLayer.cpp
index 588498c..d84ad1a 100644
--- a/Source/WebCore/rendering/RenderLayer.cpp
+++ b/Source/WebCore/rendering/RenderLayer.cpp
@@ -53,7 +53,6 @@
#include "DebugPageOverlays.h"
#include "DeprecatedGlobalSettings.h"
#include "Document.h"
-#include "DocumentEventQueue.h"
#include "DocumentMarkerController.h"
#include "DocumentTimeline.h"
#include "Editor.h"
diff --git a/Source/WebCore/rendering/RenderListBox.cpp b/Source/WebCore/rendering/RenderListBox.cpp
index 9c81d7d..25cd2d3 100644
--- a/Source/WebCore/rendering/RenderListBox.cpp
+++ b/Source/WebCore/rendering/RenderListBox.cpp
@@ -34,7 +34,6 @@
#include "CSSFontSelector.h"
#include "DeprecatedGlobalSettings.h"
#include "Document.h"
-#include "DocumentEventQueue.h"
#include "EventHandler.h"
#include "FocusController.h"
#include "Frame.h"
diff --git a/Source/WebCore/workers/WorkerEventQueue.cpp b/Source/WebCore/workers/WorkerEventQueue.cpp
deleted file mode 100644
index 6903be5..0000000
--- a/Source/WebCore/workers/WorkerEventQueue.cpp
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * Copyright (C) 2010 Google Inc. All Rights Reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "WorkerEventQueue.h"
-
-#include "Event.h"
-#include "EventTarget.h"
-#include "ScriptExecutionContext.h"
-
-namespace WebCore {
-
-WorkerEventQueue::WorkerEventQueue(ScriptExecutionContext& context)
- : m_scriptExecutionContext(context)
-{
-}
-
-WorkerEventQueue::~WorkerEventQueue()
-{
- close();
-}
-
-class WorkerEventQueue::EventDispatcher
-{
- WTF_MAKE_FAST_ALLOCATED;
-public:
- EventDispatcher(RefPtr<Event>&& event, WorkerEventQueue& eventQueue)
- : m_event(WTFMove(event))
- , m_eventQueue(eventQueue)
- {
- }
-
- ~EventDispatcher()
- {
- if (m_event)
- m_eventQueue.m_eventDispatcherMap.remove(m_event.get());
- }
-
- void dispatch()
- {
- if (m_isCancelled)
- return;
- m_eventQueue.m_eventDispatcherMap.remove(m_event.get());
- m_event->target()->dispatchEvent(*m_event);
- m_event = nullptr;
- }
-
- void cancel()
- {
- m_isCancelled = true;
- m_event = nullptr;
- }
-
-private:
- RefPtr<Event> m_event;
- WorkerEventQueue& m_eventQueue;
- bool m_isCancelled { false };
-};
-
-bool WorkerEventQueue::enqueueEvent(Ref<Event>&& event)
-{
- if (m_isClosed)
- return false;
-
- auto* eventPtr = event.ptr();
- auto eventDispatcher = makeUnique<EventDispatcher>(WTFMove(event), *this);
- m_eventDispatcherMap.add(eventPtr, eventDispatcher.get());
- m_scriptExecutionContext.postTask([eventDispatcher = WTFMove(eventDispatcher)] (ScriptExecutionContext&) {
- eventDispatcher->dispatch();
- });
-
- return true;
-}
-
-bool WorkerEventQueue::cancelEvent(Event& event)
-{
- EventDispatcher* task = m_eventDispatcherMap.take(&event);
- if (!task)
- return false;
- task->cancel();
- return true;
-}
-
-void WorkerEventQueue::close()
-{
- m_isClosed = true;
- for (auto& dispatcher : m_eventDispatcherMap.values())
- dispatcher->cancel();
- m_eventDispatcherMap.clear();
-}
-
-} // namespace WebCore
diff --git a/Source/WebCore/workers/WorkerEventQueue.h b/Source/WebCore/workers/WorkerEventQueue.h
deleted file mode 100644
index d8973d5..0000000
--- a/Source/WebCore/workers/WorkerEventQueue.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright (C) 2010 Google Inc. All Rights Reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#pragma once
-
-#include "EventQueue.h"
-#include <wtf/HashMap.h>
-
-namespace WebCore {
-
-class ScriptExecutionContext;
-
-class WorkerEventQueue final : public EventQueue {
- WTF_MAKE_FAST_ALLOCATED;
-public:
- explicit WorkerEventQueue(ScriptExecutionContext&);
- virtual ~WorkerEventQueue();
-
- bool enqueueEvent(Ref<Event>&&) override;
- bool cancelEvent(Event&) override;
- void close() override;
-
-private:
- ScriptExecutionContext& m_scriptExecutionContext;
- bool m_isClosed { false };
-
- class EventDispatcher;
- typedef HashMap<RefPtr<Event>, EventDispatcher*> EventDispatcherMap;
- EventDispatcherMap m_eventDispatcherMap;
-};
-
-} // namespace WebCore
diff --git a/Source/WebCore/worklets/WorkletGlobalScope.h b/Source/WebCore/worklets/WorkletGlobalScope.h
index 0aa12dc..f0aec75 100644
--- a/Source/WebCore/worklets/WorkletGlobalScope.h
+++ b/Source/WebCore/worklets/WorkletGlobalScope.h
@@ -34,7 +34,6 @@
#include "ScriptExecutionContext.h"
#include "ScriptSourceCode.h"
#include "WorkerEventLoop.h"
-#include "WorkerEventQueue.h"
#include <JavaScriptCore/ConsoleMessage.h>
#include <JavaScriptCore/RuntimeFlags.h>
#include <wtf/URL.h>