OSDN Git Service

Pull down change 51321 from webkit.org.
authorPatrick Scott <phanna@android.com>
Wed, 9 Dec 2009 13:56:19 +0000 (08:56 -0500)
committerPatrick Scott <phanna@android.com>
Wed, 9 Dec 2009 13:56:19 +0000 (08:56 -0500)
Calls to EventNames() was causing multiple copies of the event names to be
created. This could cause false negatives in hash map lookups.

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

index 578b7d5..930ef3a 100644 (file)
@@ -149,10 +149,11 @@ namespace WebCore {
 
     class EventNames {
         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 fe6c31f..a868134 100644 (file)
@@ -103,7 +103,7 @@ void CachedFrameBase::restore()
     // matches pageshowEvent as in Document::implicitClose()
     m_document->dispatchWindowLoadEvent();
 #endif
-    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 ea46980..96ecc7d 100644 (file)
@@ -291,7 +291,7 @@ bool HTMLFormControlElement::willValidate() const
 bool HTMLFormControlElement::checkValidity()
 {
     if (willValidate() && !isValidFormControlElement()) {
-        dispatchEvent(Event::create(EventNames().invalidEvent, false, true));
+        dispatchEvent(Event::create(eventNames().invalidEvent, false, true));
         return false;
     }
 
index 93ada45..98b8e61 100644 (file)
@@ -529,7 +529,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());
 #ifndef ANDROID_PAGE_CACHE_UNLOAD
                     if (!m_frame->document()->inPageCache())
 #endif
@@ -3703,7 +3703,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 8bc8ec4..64aae8d 100644 (file)
@@ -262,7 +262,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());
     }