Change incorrect calls to the constructor "EventNames()" to the correct accessor
authorsnej@chromium.org <snej@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 23 Nov 2009 22:25:22 +0000 (22:25 +0000)
committersnej@chromium.org <snej@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 23 Nov 2009 22:25:22 +0000 (22:25 +0000)
"eventNames()". This saves ~100 AtomicString lookups each time.
https://bugs.webkit.org/show_bug.cgi?id=31811

Reviewed by Geoffrey Garen.

* dom/EventNames.h:  Make constructor private to prevent this from happening again.
* history/CachedFrame.cpp:
(WebCore::CachedFrameBase::restore):  EventNames() --> eventNames()
* html/HTMLFormControlElement.cpp:
(WebCore::HTMLFormControlElement::checkValidity):  EventNames() --> eventNames()
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::stopLoading):  EventNames() --> eventNames()
(WebCore::FrameLoader::pageHidden):  EventNames() --> eventNames()
* page/DOMWindow.cpp:
(WebCore::DOMWindow::dispatchAllPendingUnloadEvents):  EventNames() --> eventNames()

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@51321 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog
WebCore/dom/EventNames.h
WebCore/history/CachedFrame.cpp
WebCore/html/HTMLFormControlElement.cpp
WebCore/loader/FrameLoader.cpp
WebCore/page/DOMWindow.cpp

index 006e6b808be712d845e452d20f850431c7e9cf91..16f7296a87ad8986690caee2e0655b72280695f3 100644 (file)
@@ -1,3 +1,22 @@
+2009-11-23  Jens Alfke  <snej@chromium.org>
+
+        Reviewed by Geoffrey Garen.
+
+        Change incorrect calls to the constructor "EventNames()" to the correct accessor
+        "eventNames()". This saves ~100 AtomicString lookups each time.
+        https://bugs.webkit.org/show_bug.cgi?id=31811
+
+        * dom/EventNames.h:  Make constructor private to prevent this from happening again.
+        * history/CachedFrame.cpp:
+        (WebCore::CachedFrameBase::restore):  EventNames() --> eventNames()
+        * html/HTMLFormControlElement.cpp:
+        (WebCore::HTMLFormControlElement::checkValidity):  EventNames() --> eventNames()
+        * loader/FrameLoader.cpp:
+        (WebCore::FrameLoader::stopLoading):  EventNames() --> eventNames()
+        (WebCore::FrameLoader::pageHidden):  EventNames() --> eventNames()
+        * page/DOMWindow.cpp:
+        (WebCore::DOMWindow::dispatchAllPendingUnloadEvents):  EventNames() --> eventNames()
+
 2009-11-23  Adam Langley  <agl@google.com>
 
         Reviewed by Dmitry Titov.
index 380f74f6237fffe06db860fd4f7a118b4c7ab7d2..ffa5a2ea34163e69750599b25e01b8d1866f58b6 100644 (file)
@@ -149,10 +149,11 @@ namespace WebCore {
 
     class EventNames : public Noncopyable {
         int dummy; // Needed to make initialization macro work.
-
-    public:
+        // Private to prevent accidental call to EventNames() instead of eventNames()
         EventNames();
+        friend class ThreadGlobalData;
 
+    public:
         #define DOM_EVENT_NAMES_DECLARE(name) AtomicString name##Event;
         DOM_EVENT_NAMES_FOR_EACH(DOM_EVENT_NAMES_DECLARE)
         #undef DOM_EVENT_NAMES_DECLARE
index 16c7087fc5a82776ff1e7d7302286b9e3ee8322a..50cf189895c8849aad4a3e0e7acfff194c754709 100644 (file)
@@ -99,7 +99,7 @@ void CachedFrameBase::restore()
     for (unsigned i = 0; i < m_childFrames.size(); ++i)
         m_childFrames[i]->open();
 
-    m_document->dispatchWindowEvent(PageTransitionEvent::create(EventNames().pageshowEvent, true), m_document);
+    m_document->dispatchWindowEvent(PageTransitionEvent::create(eventNames().pageshowEvent, true), m_document);
 }
 
 CachedFrame::CachedFrame(Frame* frame)
index 154654384a8c338e6f1e1d96a0edc7bee2c88fe8..2531c48b6a1895bf7845170d51a6e23d985fbafc 100644 (file)
@@ -296,7 +296,7 @@ String HTMLFormControlElement::validationMessage()
 bool HTMLFormControlElement::checkValidity()
 {
     if (willValidate() && !isValidFormControlElement()) {
-        dispatchEvent(Event::create(EventNames().invalidEvent, false, true));
+        dispatchEvent(Event::create(eventNames().invalidEvent, false, true));
         return false;
     }
 
index eaca42c3b888e8e8cd14132326d132163312a802..3867e8ce23171c0f4cbb1bee1faee0ea231382ed 100644 (file)
@@ -512,7 +512,7 @@ void FrameLoader::stopLoading(UnloadEventPolicy unloadEventPolicy, DatabasePolic
                 m_unloadEventBeingDispatched = true;
                 if (m_frame->domWindow()) {
                     if (unloadEventPolicy == UnloadEventPolicyUnloadAndPageHide)
-                        m_frame->domWindow()->dispatchEvent(PageTransitionEvent::create(EventNames().pagehideEvent, m_frame->document()->inPageCache()), m_frame->document());
+                        m_frame->domWindow()->dispatchEvent(PageTransitionEvent::create(eventNames().pagehideEvent, m_frame->document()->inPageCache()), m_frame->document());
                     if (!m_frame->document()->inPageCache())
                         m_frame->domWindow()->dispatchEvent(Event::create(eventNames().unloadEvent, false, false), m_frame->domWindow()->document());
                 }
@@ -3616,7 +3616,7 @@ void FrameLoader::pageHidden()
 {
     m_unloadEventBeingDispatched = true;
     if (m_frame->domWindow())
-        m_frame->domWindow()->dispatchEvent(PageTransitionEvent::create(EventNames().pagehideEvent, true), m_frame->document());
+        m_frame->domWindow()->dispatchEvent(PageTransitionEvent::create(eventNames().pagehideEvent, true), m_frame->document());
     m_unloadEventBeingDispatched = false;
 
     // Send pagehide event for subframes as well
index f08427e5cdc40a83949939c8be9c5c514925adad..08b24a63cbd1f3469ae0341009d525fd5166a1e5 100644 (file)
@@ -263,7 +263,7 @@ void DOMWindow::dispatchAllPendingUnloadEvents()
         if (!set.contains(window))
             continue;
 
-        window->dispatchEvent(PageTransitionEvent::create(EventNames().pagehideEvent, false), window->document());
+        window->dispatchEvent(PageTransitionEvent::create(eventNames().pagehideEvent, false), window->document());
         window->dispatchEvent(Event::create(eventNames().unloadEvent, false, false), window->document());
     }