Clean up ScopedEventQueue
authorzandobersek@gmail.com <zandobersek@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 29 Oct 2013 07:42:40 +0000 (07:42 +0000)
committerzandobersek@gmail.com <zandobersek@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 29 Oct 2013 07:42:40 +0000 (07:42 +0000)
commit6bffebf004eb112b462ab43ef8cc916a8f7c8dd4
tree84688961f6ffb3cae0f678ded2d5b902b0220acf
parent8866baf2adf2107879e2f8bf9a09c80ca1402d07
Clean up ScopedEventQueue
https://bugs.webkit.org/show_bug.cgi?id=123408

Reviewed by Darin Adler.

Clean up the ScopedEventQueue implementation. ScopedEventQueue::instance() should return a reference to a
NeverDestroyed<ScopedEventQueue> object. The static ScopedEventQueue::s_instance pointer is removed.

The ScopedEventQueue destructor, the dispatchAllEvents method and the scope level incrementation/decrementation
methods are made private. NeverDestroyed<ScopedEventQueue> and EventQueueScope are made friends of the
ScopedEventQueue class so they can access the constructor and the incrementation/decrementation methods, respectively.

ScopedEventQueue method definitions are reordered to follow the order of their declarations in the header file.
ScopedEventQueue::dispatchAllEvents() now uses std::move to efficiently dispatch and clear all currently queued events.

* dom/EventDispatcher.cpp:
(WebCore::EventDispatcher::dispatchScopedEvent):
* dom/ScopedEventQueue.cpp:
(WebCore::ScopedEventQueue::instance):
(WebCore::ScopedEventQueue::dispatchAllEvents):
* dom/ScopedEventQueue.h:
(WebCore::EventQueueScope::EventQueueScope):
(WebCore::EventQueueScope::~EventQueueScope):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@158182 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/dom/EventDispatcher.cpp
Source/WebCore/dom/ScopedEventQueue.cpp
Source/WebCore/dom/ScopedEventQueue.h