2010-12-14 Mihai Parparita <mihaip@chromium.org>
authormihaip@chromium.org <mihaip@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 14 Dec 2010 22:52:24 +0000 (22:52 +0000)
committermihaip@chromium.org <mihaip@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 14 Dec 2010 22:52:24 +0000 (22:52 +0000)
        Reviewed by Dimitri Glazkov.

        Move asynchronous event dispatching out of Document
        https://bugs.webkit.org/show_bug.cgi?id=49785

        Move asynchonous event code out of Document and into a standalone
        EventQueue class (which supports async events for both regular nodes
        and the window object).

        No new tests necessary, since no new functionality is exposed (existing
        layout tests pass).

        * Android.mk:
        * CMakeLists.txt:
        * GNUmakefile.am:
        * WebCore.gypi:
        * WebCore.pro:
        * WebCore.vcproj/WebCore.vcproj:
        * WebCore.xcodeproj/project.pbxproj:
        * dom/Document.cpp:
        (WebCore::Document::Document):
        (WebCore::Document::enqueueWindowEvent):
        (WebCore::Document::enqueueHashchangeEvent):
        * dom/DOMAllInOne.cpp:
        (WebCore::Document::eventQueue):
        * dom/Document.h:
        * dom/EventQueue.cpp: Added.
        (WebCore::EventQueue::EventQueue):
        (WebCore::EventQueue::enqueueEvent):
        (WebCore::EventQueue::pendingEventTimerFired):
        (WebCore::EventQueue::dispatchEvent):
        * dom/EventQueue.h: Added.
        * storage/StorageEventDispatcher.cpp:
        (WebCore::StorageEventDispatcher::dispatch):
2010-12-14  Mihai Parparita  <mihaip@chromium.org>

        Reviewed by Dimitri Glazkov.

        Move asynchronous event dispatching out of Document
        https://bugs.webkit.org/show_bug.cgi?id=49785

        Change enqueueEvent callsite.

        * src/StorageAreaProxy.cpp:
        (WebCore::StorageAreaProxy::storageEvent):

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

16 files changed:
WebCore/Android.mk
WebCore/CMakeLists.txt
WebCore/ChangeLog
WebCore/GNUmakefile.am
WebCore/WebCore.gypi
WebCore/WebCore.pro
WebCore/WebCore.vcproj/WebCore.vcproj
WebCore/WebCore.xcodeproj/project.pbxproj
WebCore/dom/DOMAllInOne.cpp
WebCore/dom/Document.cpp
WebCore/dom/Document.h
WebCore/dom/EventQueue.cpp [new file with mode: 0644]
WebCore/dom/EventQueue.h [new file with mode: 0644]
WebCore/storage/StorageEventDispatcher.cpp
WebKit/chromium/ChangeLog
WebKit/chromium/src/StorageAreaProxy.cpp

index be5145a..11fedfb 100644 (file)
@@ -132,6 +132,7 @@ LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \
        dom/EventContext.cpp \
        dom/EventNames.cpp \
        dom/EventTarget.cpp \
+       dom/EventQueue.cpp \
        dom/ExceptionBase.cpp \
        dom/ExceptionCode.cpp \
        dom/InputElement.cpp \
index 17c735b..334d56a 100644 (file)
@@ -852,6 +852,7 @@ SET(WebCore_SOURCES
     dom/EventContext.cpp
     dom/EventNames.cpp
     dom/EventTarget.cpp
+    dom/EventQueue.cpp
     dom/ExceptionBase.cpp
     dom/ExceptionCode.cpp
     dom/InputElement.cpp
index 32e5c0c..30907d0 100644 (file)
@@ -1,3 +1,40 @@
+2010-12-14  Mihai Parparita  <mihaip@chromium.org>
+
+        Reviewed by Dimitri Glazkov.
+
+        Move asynchronous event dispatching out of Document
+        https://bugs.webkit.org/show_bug.cgi?id=49785
+        
+        Move asynchonous event code out of Document and into a standalone
+        EventQueue class (which supports async events for both regular nodes
+        and the window object).
+
+        No new tests necessary, since no new functionality is exposed (existing
+        layout tests pass).
+
+        * Android.mk:
+        * CMakeLists.txt:
+        * GNUmakefile.am:
+        * WebCore.gypi:
+        * WebCore.pro:
+        * WebCore.vcproj/WebCore.vcproj:
+        * WebCore.xcodeproj/project.pbxproj:
+        * dom/Document.cpp:
+        (WebCore::Document::Document):
+        (WebCore::Document::enqueueWindowEvent):
+        (WebCore::Document::enqueueHashchangeEvent):
+        * dom/DOMAllInOne.cpp:
+        (WebCore::Document::eventQueue):
+        * dom/Document.h:
+        * dom/EventQueue.cpp: Added.
+        (WebCore::EventQueue::EventQueue):
+        (WebCore::EventQueue::enqueueEvent):
+        (WebCore::EventQueue::pendingEventTimerFired):
+        (WebCore::EventQueue::dispatchEvent):
+        * dom/EventQueue.h: Added.
+        * storage/StorageEventDispatcher.cpp:
+        (WebCore::StorageEventDispatcher::dispatch):
+
 2010-12-14  Kyounga Ra  <kyounga.ra@gmail.com>
 
         Reviewed by Adam Barth.
index 5fd2b53..cb36e31 100644 (file)
@@ -1206,6 +1206,8 @@ webcore_sources += \
        WebCore/dom/EventNames.h \
        WebCore/dom/EventTarget.cpp \
        WebCore/dom/EventTarget.h \
+       WebCore/dom/EventQueue.cpp \
+       WebCore/dom/EventQueue.h \
        WebCore/dom/ExceptionBase.cpp \
        WebCore/dom/ExceptionBase.h \
        WebCore/dom/ExceptionCode.cpp \
index 2e7a0ed..df7be09 100644 (file)
             'dom/EventNames.h',
             'dom/EventTarget.cpp',
             'dom/EventTarget.h',
+            'dom/EventQueue.cpp',
+            'dom/EventQueue.h',
             'dom/ExceptionBase.cpp',
             'dom/ExceptionBase.h',
             'dom/ExceptionCode.cpp',
index f970de2..111bc82 100644 (file)
@@ -730,6 +730,7 @@ SOURCES += \
     dom/EventContext.cpp \
     dom/EventNames.cpp \
     dom/EventTarget.cpp \
+    dom/EventQueue.cpp \
     dom/ExceptionBase.cpp \
     dom/ExceptionCode.cpp \
     dom/InputElement.cpp \
index 6a42c69..323e526 100755 (executable)
                                RelativePath="..\dom\EventTarget.h"
                                >
                        </File>
+                 <File
+                               RelativePath="..\dom\EventQueue.cpp"
+                               >
+                               <FileConfiguration
+                                       Name="Debug|Win32"
+                                       ExcludedFromBuild="true"
+                                       >
+                                       <Tool
+                                               Name="VCCLCompilerTool"
+                                       />
+                               </FileConfiguration>
+                               <FileConfiguration
+                                       Name="Release|Win32"
+                                       ExcludedFromBuild="true"
+                                       >
+                                       <Tool
+                                               Name="VCCLCompilerTool"
+                                       />
+                               </FileConfiguration>
+                               <FileConfiguration
+                                       Name="Debug_Internal|Win32"
+                                       ExcludedFromBuild="true"
+                                       >
+                                       <Tool
+                                               Name="VCCLCompilerTool"
+                                       />
+                               </FileConfiguration>
+                               <FileConfiguration
+                                       Name="Debug_Cairo|Win32"
+                                       ExcludedFromBuild="true"
+                                       >
+                                       <Tool
+                                               Name="VCCLCompilerTool"
+                                       />
+                               </FileConfiguration>
+                               <FileConfiguration
+                                       Name="Release_Cairo|Win32"
+                                       ExcludedFromBuild="true"
+                                       >
+                                       <Tool
+                                               Name="VCCLCompilerTool"
+                                       />
+                               </FileConfiguration>
+                               <FileConfiguration
+                                       Name="Debug_All|Win32"
+                                       ExcludedFromBuild="true"
+                                       >
+                                       <Tool
+                                               Name="VCCLCompilerTool"
+                                       />
+                               </FileConfiguration>
+                       </File>
+                       <File
+                               RelativePath="..\dom\EventQueue.h"
+                               >
+                       </File>
                        <File
                                RelativePath="..\dom\ExceptionBase.cpp"
                                >
index ec335ef..fcf3009 100644 (file)
                8AF4E55C11DC5A63000ED3DE /* PerformanceTiming.h in Headers */ = {isa = PBXBuildFile; fileRef = 8AF4E55911DC5A63000ED3DE /* PerformanceTiming.h */; };
                8C6EA61911EF7E0400FD8EE3 /* RuntimeEnabledFeatures.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8C6EA61711EF7E0400FD8EE3 /* RuntimeEnabledFeatures.cpp */; };
                8C6EA61A11EF7E0400FD8EE3 /* RuntimeEnabledFeatures.h in Headers */ = {isa = PBXBuildFile; fileRef = 8C6EA61811EF7E0400FD8EE3 /* RuntimeEnabledFeatures.h */; };
+               8F67561B1288B17B0047ACA3 /* EventQueue.h in Headers */ = {isa = PBXBuildFile; fileRef = 8F6756191288B17B0047ACA3 /* EventQueue.h */; };
+               8F67561C1288B17B0047ACA3 /* EventQueue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8F67561A1288B17B0047ACA3 /* EventQueue.cpp */; };
                8FAC774D119872CB0015AE94 /* JSMainThreadExecState.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8F934D841189F1EE00508D5D /* JSMainThreadExecState.cpp */; };
                9302B0BD0D79F82900C7EE83 /* PageGroup.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9302B0BC0D79F82900C7EE83 /* PageGroup.cpp */; };
                9302B0BF0D79F82C00C7EE83 /* PageGroup.h in Headers */ = {isa = PBXBuildFile; fileRef = 9302B0BE0D79F82C00C7EE83 /* PageGroup.h */; settings = {ATTRIBUTES = (Private, ); }; };
                8AF4E55A11DC5A63000ED3DE /* PerformanceTiming.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = PerformanceTiming.idl; sourceTree = "<group>"; };
                8C6EA61711EF7E0400FD8EE3 /* RuntimeEnabledFeatures.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RuntimeEnabledFeatures.cpp; path = generic/RuntimeEnabledFeatures.cpp; sourceTree = "<group>"; };
                8C6EA61811EF7E0400FD8EE3 /* RuntimeEnabledFeatures.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RuntimeEnabledFeatures.h; path = generic/RuntimeEnabledFeatures.h; sourceTree = "<group>"; };
+               8F6756191288B17B0047ACA3 /* EventQueue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EventQueue.h; sourceTree = "<group>"; };
+               8F67561A1288B17B0047ACA3 /* EventQueue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EventQueue.cpp; sourceTree = "<group>"; };
                8F934D831189F1EE00508D5D /* JSMainThreadExecState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSMainThreadExecState.h; sourceTree = "<group>"; };
                8F934D841189F1EE00508D5D /* JSMainThreadExecState.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSMainThreadExecState.cpp; sourceTree = "<group>"; };
                9302B0BC0D79F82900C7EE83 /* PageGroup.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PageGroup.cpp; sourceTree = "<group>"; };
                                85AFA7410AAF298400E84305 /* EventListener.idl */,
                                939885C108B7E3D100E707C4 /* EventNames.cpp */,
                                939885C208B7E3D100E707C4 /* EventNames.h */,
+                               8F6756191288B17B0047ACA3 /* EventQueue.h */,
+                               8F67561A1288B17B0047ACA3 /* EventQueue.cpp */,
                                E12EDBE90B308E0B002704B6 /* EventTarget.cpp */,
                                E12EDB7A0B308A78002704B6 /* EventTarget.h */,
                                85AFA7420AAF298400E84305 /* EventTarget.idl */,
                                935FBC4509BA00B900E230B1 /* EventListener.h in Headers */,
                                1CA19E160DC255CA0065A994 /* EventLoop.h in Headers */,
                                939885C408B7E3D100E707C4 /* EventNames.h in Headers */,
+                               8F67561B1288B17B0047ACA3 /* EventQueue.h in Headers */,
                                E0FEF372B17C53EAC1C1FBEE /* EventSource.h in Headers */,
                                E12EDB7B0B308A78002704B6 /* EventTarget.h in Headers */,
                                BC60D8F30D2A11E000B9918F /* ExceptionBase.h in Headers */,
                                93C09A7F0B064EEF005ABD4D /* EventHandlerMac.mm in Sources */,
                                1CA19E050DC255950065A994 /* EventLoopMac.mm in Sources */,
                                939885C308B7E3D100E707C4 /* EventNames.cpp in Sources */,
+                               8F67561C1288B17B0047ACA3 /* EventQueue.cpp in Sources */,
                                E0FEF372B27C53EAC1C1FBEE /* EventSource.cpp in Sources */,
                                E12EDBEA0B308E0B002704B6 /* EventTarget.cpp in Sources */,
                                BC60D8F20D2A11E000B9918F /* ExceptionBase.cpp in Sources */,
index dc4e39b..aefc27a 100644 (file)
@@ -71,6 +71,7 @@
 #include "Event.cpp"
 #include "EventContext.cpp"
 #include "EventNames.cpp"
+#include "EventQueue.cpp"
 #include "EventTarget.cpp"
 #include "ExceptionBase.cpp"
 #include "ExceptionCode.cpp"
index 775a2ad..f286d9d 100644 (file)
@@ -59,6 +59,7 @@
 #include "EventHandler.h"
 #include "EventListener.h"
 #include "EventNames.h"
+#include "EventQueue.h"
 #include "ExceptionCode.h"
 #include "FocusController.h"
 #include "FormAssociatedElement.h"
@@ -403,7 +404,7 @@ Document::Document(Frame* frame, const KURL& url, bool isXHTML, bool isHTML, con
     , m_normalWorldWrapperCache(0)
 #endif
     , m_usingGeolocation(false)
-    , m_pendingEventTimer(this, &Document::pendingEventTimerFired)
+    , m_eventQueue(adoptPtr(new EventQueue))
 #if ENABLE(WML)
     , m_containsWMLContent(false)
 #endif
@@ -3473,23 +3474,10 @@ void Document::dispatchWindowLoadEvent()
     domWindow->dispatchLoadEvent();
 }
 
-void Document::enqueueEvent(PassRefPtr<Event> event)
+void Document::enqueueWindowEvent(PassRefPtr<Event> event)
 {
-    m_pendingEventQueue.append(event);
-    if (!m_pendingEventTimer.isActive())
-        m_pendingEventTimer.startOneShot(0);
-}
-
-void Document::pendingEventTimerFired(Timer<Document>*)
-{
-    ASSERT(!m_pendingEventTimer.isActive());
-    Vector<RefPtr<Event> > eventQueue;
-    eventQueue.swap(m_pendingEventQueue);
-
-    typedef Vector<RefPtr<Event> >::const_iterator Iterator;
-    Iterator end = eventQueue.end();
-    for (Iterator it = eventQueue.begin(); it != end; ++it)
-        dispatchWindowEvent(*it);
+    event->setTarget(domWindow());
+    m_eventQueue->enqueueEvent(event);
 }
 
 PassRefPtr<Event> Document::createEvent(const String& eventType, ExceptionCode& ec)
@@ -4751,7 +4739,7 @@ void Document::enqueuePageshowEvent(PageshowEventPersistence persisted)
 
 void Document::enqueueHashchangeEvent(const String& oldURL, const String& newURL)
 {
-    enqueueEvent(HashChangeEvent::create(oldURL, newURL));
+    enqueueWindowEvent(HashChangeEvent::create(oldURL, newURL));
 }
 
 void Document::enqueuePopstateEvent(PassRefPtr<SerializedScriptValue> stateObject)
index 7a8ea78..54aed24 100644 (file)
@@ -76,6 +76,7 @@ class Element;
 class EntityReference;
 class Event;
 class EventListener;
+class EventQueue;
 class FormAssociatedElement;
 class Frame;
 class FrameView;
@@ -1026,10 +1027,11 @@ public:
     bool containsValidityStyleRules() const { return m_containsValidityStyleRules; }
     void setContainsValidityStyleRules() { m_containsValidityStyleRules = true; }
 
-    void enqueueEvent(PassRefPtr<Event>);
+    void enqueueWindowEvent(PassRefPtr<Event>);
     void enqueuePageshowEvent(PageshowEventPersistence);
     void enqueueHashchangeEvent(const String& oldURL, const String& newURL);
     void enqueuePopstateEvent(PassRefPtr<SerializedScriptValue> stateObject);
+    EventQueue* eventQueue() const { return m_eventQueue.get(); }
 
     void addMediaCanStartListener(MediaCanStartListener*);
     void removeMediaCanStartListener(MediaCanStartListener*);
@@ -1128,8 +1130,6 @@ private:
 
     void createStyleSelector();
 
-    void pendingEventTimerFired(Timer<Document>*);
-
     PassRefPtr<NodeList> handleZeroPadding(const HitTestRequest&, HitTestResult&) const;
 
     void loadEventDelayTimerFired(Timer<Document>*);
@@ -1352,9 +1352,8 @@ private:
 #endif
 
     bool m_usingGeolocation;
-
-    Timer<Document> m_pendingEventTimer;
-    Vector<RefPtr<Event> > m_pendingEventQueue;
+    
+    OwnPtr<EventQueue> m_eventQueue;
 
 #if ENABLE(WML)
     bool m_containsWMLContent;
diff --git a/WebCore/dom/EventQueue.cpp b/WebCore/dom/EventQueue.cpp
new file mode 100644 (file)
index 0000000..27cd802
--- /dev/null
@@ -0,0 +1,73 @@
+/*
+ * Copyright (C) 2010 Google Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ *
+ */
+
+#include "config.h"
+#include "EventQueue.h"
+
+#include "DOMWindow.h"
+#include "Document.h"
+#include "Event.h"
+#include "EventNames.h"
+
+namespace WebCore {
+
+EventQueue::EventQueue()
+    : m_pendingEventTimer(this, &EventQueue::pendingEventTimerFired)
+{
+}
+
+void EventQueue::enqueueEvent(PassRefPtr<Event> event)
+{
+    ASSERT(event->target()->toNode() || event->target()->toDOMWindow());
+    m_queuedEvents.append(event);
+    
+    if (!m_pendingEventTimer.isActive())
+        m_pendingEventTimer.startOneShot(0);
+}
+
+void EventQueue::pendingEventTimerFired(Timer<EventQueue>*)
+{
+    ASSERT(!m_pendingEventTimer.isActive());
+
+    Vector<RefPtr<Event> > queuedEvents;
+    queuedEvents.swap(m_queuedEvents);
+
+    for (size_t i = 0; i < queuedEvents.size(); i++)
+        dispatchEvent(queuedEvents[i].release());
+}
+
+void EventQueue::dispatchEvent(PassRefPtr<Event> event)
+{
+    EventTarget* eventTarget = event->target();
+    if (eventTarget->toNode())
+        eventTarget->dispatchEvent(event);
+    else if (eventTarget->toDOMWindow())
+        eventTarget->toDOMWindow()->dispatchEvent(event, 0);
+    else
+        ASSERT_NOT_REACHED();
+}
+
+}
diff --git a/WebCore/dom/EventQueue.h b/WebCore/dom/EventQueue.h
new file mode 100644 (file)
index 0000000..8dd7ec9
--- /dev/null
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2010 Google Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ *
+ */
+
+#ifndef EventQueue_h
+#define EventQueue_h
+
+#include "Timer.h"
+#include <wtf/Noncopyable.h>
+#include <wtf/RefPtr.h>
+#include <wtf/Vector.h>
+
+namespace WebCore {
+
+class Event;
+class Node;
+
+class EventQueue {
+    WTF_MAKE_NONCOPYABLE(EventQueue);
+
+public:
+    EventQueue();
+
+    void enqueueEvent(PassRefPtr<Event>);
+
+private:
+    void pendingEventTimerFired(Timer<EventQueue>*);
+    void dispatchEvent(PassRefPtr<Event>);
+
+    Timer<EventQueue> m_pendingEventTimer;
+    Vector<RefPtr<Event> > m_queuedEvents;
+};
+
+}
+
+#endif // EventQueue_h
index 5833c59..5ce56c6 100644 (file)
@@ -58,7 +58,7 @@ void StorageEventDispatcher::dispatch(const String& key, const String& oldValue,
             ExceptionCode ec = 0;
             Storage* storage = frames[i]->domWindow()->sessionStorage(ec);
             if (!ec)
-                frames[i]->document()->enqueueEvent(StorageEvent::create(eventNames().storageEvent, key, oldValue, newValue, sourceFrame->document()->url(), storage));
+                frames[i]->document()->enqueueWindowEvent(StorageEvent::create(eventNames().storageEvent, key, oldValue, newValue, sourceFrame->document()->url(), storage));
         }
     } else {
         // Send events to every page.
@@ -75,7 +75,7 @@ void StorageEventDispatcher::dispatch(const String& key, const String& oldValue,
             ExceptionCode ec = 0;
             Storage* storage = frames[i]->domWindow()->localStorage(ec);
             if (!ec)
-                frames[i]->document()->enqueueEvent(StorageEvent::create(eventNames().storageEvent, key, oldValue, newValue, sourceFrame->document()->url(), storage));
+                frames[i]->document()->enqueueWindowEvent(StorageEvent::create(eventNames().storageEvent, key, oldValue, newValue, sourceFrame->document()->url(), storage));
         }
     }
 }
index 40325c9..008d901 100644 (file)
@@ -1,3 +1,15 @@
+2010-12-14  Mihai Parparita  <mihaip@chromium.org>
+
+        Reviewed by Dimitri Glazkov.
+
+        Move asynchronous event dispatching out of Document
+        https://bugs.webkit.org/show_bug.cgi?id=49785
+        
+        Change enqueueEvent callsite.
+
+        * src/StorageAreaProxy.cpp:
+        (WebCore::StorageAreaProxy::storageEvent):
+
 2010-12-13  Mike Lawther  <mikelawther@chromium.org>
 
         Reviewed by James Robinson.
index 5311b65..ed89b2c 100644 (file)
@@ -129,7 +129,7 @@ void StorageAreaProxy::storageEvent(const String& key, const String& oldValue, c
             ExceptionCode ec = 0;
             Storage* storage = frames[i]->domWindow()->sessionStorage(ec);
             if (!ec)
-                frames[i]->document()->enqueueEvent(StorageEvent::create(eventNames().storageEvent, key, oldValue, newValue, sourceFrame->document()->url(), storage));
+                frames[i]->document()->enqueueWindowEvent(StorageEvent::create(eventNames().storageEvent, key, oldValue, newValue, sourceFrame->document()->url(), storage));
         }
     } else {
         // Send events to every page.
@@ -146,7 +146,7 @@ void StorageAreaProxy::storageEvent(const String& key, const String& oldValue, c
             ExceptionCode ec = 0;
             Storage* storage = frames[i]->domWindow()->localStorage(ec);
             if (!ec)
-                frames[i]->document()->enqueueEvent(StorageEvent::create(eventNames().storageEvent, key, oldValue, newValue, sourceFrame->document()->url(), storage));
+                frames[i]->document()->enqueueWindowEvent(StorageEvent::create(eventNames().storageEvent, key, oldValue, newValue, sourceFrame->document()->url(), storage));
         }
     }
 }