summaryrefslogtreecommitdiff
path: root/Source/WebCore/dom/ScopedEventQueue.h
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebCore/dom/ScopedEventQueue.h')
-rw-r--r--Source/WebCore/dom/ScopedEventQueue.h26
1 files changed, 11 insertions, 15 deletions
diff --git a/Source/WebCore/dom/ScopedEventQueue.h b/Source/WebCore/dom/ScopedEventQueue.h
index 90465e626..8a9dcad6a 100644
--- a/Source/WebCore/dom/ScopedEventQueue.h
+++ b/Source/WebCore/dom/ScopedEventQueue.h
@@ -28,12 +28,10 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef ScopedEventQueue_h
-#define ScopedEventQueue_h
+#pragma once
#include <wtf/NeverDestroyed.h>
#include <wtf/Noncopyable.h>
-#include <wtf/PassRefPtr.h>
#include <wtf/RefPtr.h>
#include <wtf/Vector.h>
@@ -45,20 +43,20 @@ class EventQueueScope;
class ScopedEventQueue {
WTF_MAKE_NONCOPYABLE(ScopedEventQueue); WTF_MAKE_FAST_ALLOCATED;
public:
- static ScopedEventQueue& instance();
- void enqueueEvent(PassRefPtr<Event>);
+ static ScopedEventQueue& singleton();
+ void enqueueEvent(Ref<Event>&&);
private:
- ScopedEventQueue();
- ~ScopedEventQueue();
+ ScopedEventQueue() = default;
+ ~ScopedEventQueue() = delete;
- void dispatchEvent(PassRefPtr<Event>) const;
+ void dispatchEvent(Event&) const;
void dispatchAllEvents();
void incrementScopingLevel();
void decrementScopingLevel();
- Vector<RefPtr<Event>> m_queuedEvents;
- unsigned m_scopingLevel;
+ Vector<Ref<Event>> m_queuedEvents;
+ unsigned m_scopingLevel { 0 };
friend class WTF::NeverDestroyed<WebCore::ScopedEventQueue>;
friend class EventQueueScope;
@@ -67,10 +65,8 @@ private:
class EventQueueScope {
WTF_MAKE_NONCOPYABLE(EventQueueScope);
public:
- EventQueueScope() { ScopedEventQueue::instance().incrementScopingLevel(); }
- ~EventQueueScope() { ScopedEventQueue::instance().decrementScopingLevel(); }
+ EventQueueScope() { ScopedEventQueue::singleton().incrementScopingLevel(); }
+ ~EventQueueScope() { ScopedEventQueue::singleton().decrementScopingLevel(); }
};
-}
-
-#endif // ScopedEventQueue_h
+} // namespace WebCore