Title: [180256] trunk/Source/WebCore
- Revision
- 180256
- Author
- [email protected]
- Date
- 2015-02-17 21:38:43 -0800 (Tue, 17 Feb 2015)
Log Message
Rename ScopedEventQueue::instance() to singleton()
https://bugs.webkit.org/show_bug.cgi?id=141738
Reviewed by Daniel Bates.
Rename ScopedEventQueue::instance() to singleton(), as per coding
style. Also modernize the code a little bit.
* dom/EventDispatcher.cpp:
(WebCore::EventDispatcher::dispatchScopedEvent):
* dom/ScopedEventQueue.cpp:
(WebCore::ScopedEventQueue::singleton):
(WebCore::ScopedEventQueue::dispatchAllEvents):
(WebCore::ScopedEventQueue::incrementScopingLevel):
(WebCore::ScopedEventQueue::decrementScopingLevel):
(WebCore::ScopedEventQueue::ScopedEventQueue): Deleted.
(WebCore::ScopedEventQueue::~ScopedEventQueue): Deleted.
(WebCore::ScopedEventQueue::instance): Deleted.
* dom/ScopedEventQueue.h:
(WebCore::EventQueueScope::EventQueueScope):
(WebCore::EventQueueScope::~EventQueueScope):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (180255 => 180256)
--- trunk/Source/WebCore/ChangeLog 2015-02-18 05:31:21 UTC (rev 180255)
+++ trunk/Source/WebCore/ChangeLog 2015-02-18 05:38:43 UTC (rev 180256)
@@ -1,5 +1,29 @@
2015-02-17 Chris Dumez <[email protected]>
+ Rename ScopedEventQueue::instance() to singleton()
+ https://bugs.webkit.org/show_bug.cgi?id=141738
+
+ Reviewed by Daniel Bates.
+
+ Rename ScopedEventQueue::instance() to singleton(), as per coding
+ style. Also modernize the code a little bit.
+
+ * dom/EventDispatcher.cpp:
+ (WebCore::EventDispatcher::dispatchScopedEvent):
+ * dom/ScopedEventQueue.cpp:
+ (WebCore::ScopedEventQueue::singleton):
+ (WebCore::ScopedEventQueue::dispatchAllEvents):
+ (WebCore::ScopedEventQueue::incrementScopingLevel):
+ (WebCore::ScopedEventQueue::decrementScopingLevel):
+ (WebCore::ScopedEventQueue::ScopedEventQueue): Deleted.
+ (WebCore::ScopedEventQueue::~ScopedEventQueue): Deleted.
+ (WebCore::ScopedEventQueue::instance): Deleted.
+ * dom/ScopedEventQueue.h:
+ (WebCore::EventQueueScope::EventQueueScope):
+ (WebCore::EventQueueScope::~EventQueueScope):
+
+2015-02-17 Chris Dumez <[email protected]>
+
Remove dead code from FontCache
https://bugs.webkit.org/show_bug.cgi?id=141741
Modified: trunk/Source/WebCore/dom/EventDispatcher.cpp (180255 => 180256)
--- trunk/Source/WebCore/dom/EventDispatcher.cpp 2015-02-18 05:31:21 UTC (rev 180255)
+++ trunk/Source/WebCore/dom/EventDispatcher.cpp 2015-02-18 05:38:43 UTC (rev 180256)
@@ -222,7 +222,7 @@
{
// We need to set the target here because it can go away by the time we actually fire the event.
event->setTarget(&eventTargetRespectingTargetRules(node));
- ScopedEventQueue::instance().enqueueEvent(event);
+ ScopedEventQueue::singleton().enqueueEvent(event);
}
void EventDispatcher::dispatchSimulatedClick(Element* element, Event* underlyingEvent, SimulatedClickMouseEventOptions mouseEventOptions, SimulatedClickVisualOptions visualOptions)
Modified: trunk/Source/WebCore/dom/ScopedEventQueue.cpp (180255 => 180256)
--- trunk/Source/WebCore/dom/ScopedEventQueue.cpp 2015-02-18 05:31:21 UTC (rev 180255)
+++ trunk/Source/WebCore/dom/ScopedEventQueue.cpp 2015-02-18 05:38:43 UTC (rev 180256)
@@ -37,19 +37,8 @@
namespace WebCore {
-ScopedEventQueue::ScopedEventQueue()
- : m_scopingLevel(0)
+ScopedEventQueue& ScopedEventQueue::singleton()
{
-}
-
-ScopedEventQueue::~ScopedEventQueue()
-{
- ASSERT(!m_scopingLevel);
- ASSERT(!m_queuedEvents.size());
-}
-
-ScopedEventQueue& ScopedEventQueue::instance()
-{
static NeverDestroyed<ScopedEventQueue> scopedEventQueue;
return scopedEventQueue;
}
@@ -73,19 +62,19 @@
void ScopedEventQueue::dispatchAllEvents()
{
Vector<RefPtr<Event>> queuedEvents = WTF::move(m_queuedEvents);
- for (size_t i = 0; i < queuedEvents.size(); i++)
- dispatchEvent(queuedEvents[i].release());
+ for (auto& queuedEvent : queuedEvents)
+ dispatchEvent(queuedEvent.release());
}
void ScopedEventQueue::incrementScopingLevel()
{
- m_scopingLevel++;
+ ++m_scopingLevel;
}
void ScopedEventQueue::decrementScopingLevel()
{
ASSERT(m_scopingLevel);
- m_scopingLevel--;
+ --m_scopingLevel;
if (!m_scopingLevel)
dispatchAllEvents();
}
Modified: trunk/Source/WebCore/dom/ScopedEventQueue.h (180255 => 180256)
--- trunk/Source/WebCore/dom/ScopedEventQueue.h 2015-02-18 05:31:21 UTC (rev 180255)
+++ trunk/Source/WebCore/dom/ScopedEventQueue.h 2015-02-18 05:38:43 UTC (rev 180256)
@@ -45,12 +45,12 @@
class ScopedEventQueue {
WTF_MAKE_NONCOPYABLE(ScopedEventQueue); WTF_MAKE_FAST_ALLOCATED;
public:
- static ScopedEventQueue& instance();
+ static ScopedEventQueue& singleton();
void enqueueEvent(PassRefPtr<Event>);
private:
- ScopedEventQueue();
- ~ScopedEventQueue();
+ ScopedEventQueue() = default;
+ ~ScopedEventQueue() = delete;
void dispatchEvent(PassRefPtr<Event>) const;
void dispatchAllEvents();
@@ -58,7 +58,7 @@
void decrementScopingLevel();
Vector<RefPtr<Event>> m_queuedEvents;
- unsigned m_scopingLevel;
+ unsigned m_scopingLevel { 0 };
friend class WTF::NeverDestroyed<WebCore::ScopedEventQueue>;
friend class EventQueueScope;
@@ -67,8 +67,8 @@
class EventQueueScope {
WTF_MAKE_NONCOPYABLE(EventQueueScope);
public:
- EventQueueScope() { ScopedEventQueue::instance().incrementScopingLevel(); }
- ~EventQueueScope() { ScopedEventQueue::instance().decrementScopingLevel(); }
+ EventQueueScope() { ScopedEventQueue::singleton().incrementScopingLevel(); }
+ ~EventQueueScope() { ScopedEventQueue::singleton().decrementScopingLevel(); }
};
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes