Title: [111717] trunk/Source/WebCore
Revision
111717
Author
[email protected]
Date
2012-03-22 10:01:48 -0700 (Thu, 22 Mar 2012)

Log Message

Event dispatching in XMLHttpRequestProgressEventThrottle should go through XMLHttpRequestProgressEventThrottle::dispatchEvent
https://bugs.webkit.org/show_bug.cgi?id=46743

Patch by Allan Sandfeld Jensen <[email protected]> on 2012-03-22
Reviewed by Julien Chaffraix
Based on original patch by Anton D'Auria

In preparation for platform-specific queuing of XMLHttpRequest events,
this patch changes all calls to m_target->dispatchEvent to
XMLHttpRequestProgressEventThrottle::dispatchEvent.
Currently, we queue only one progress event on suspend() if we have
throttled progress events. We should be able to queue all XHR events
that can be generated after suspend(), if the platform network layer
continues to receive data.
XMLHttpRequest uses XMLHttpRequestProgressEventThrottle to dispatch only
download events, so this doesn't change behavior of upload events, which
aren't throttled or queued.

* xml/XMLHttpRequest.cpp:
(WebCore::XMLHttpRequest::callReadyStateChangeListener):
* xml/XMLHttpRequestProgressEventThrottle.cpp:
(WebCore::XMLHttpRequestProgressEventThrottle::dispatchReadyStateChangeEvent):
(WebCore::XMLHttpRequestProgressEventThrottle::dispatchEvent):
(WebCore::XMLHttpRequestProgressEventThrottle::flushProgressEvent):
(WebCore::XMLHttpRequestProgressEventThrottle::dispatchPausedEvent):
(WebCore::XMLHttpRequestProgressEventThrottle::fired):
* xml/XMLHttpRequestProgressEventThrottle.h:
(XMLHttpRequestProgressEventThrottle):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (111716 => 111717)


--- trunk/Source/WebCore/ChangeLog	2012-03-22 16:59:46 UTC (rev 111716)
+++ trunk/Source/WebCore/ChangeLog	2012-03-22 17:01:48 UTC (rev 111717)
@@ -1,3 +1,33 @@
+2012-03-22  Allan Sandfeld Jensen  <[email protected]>
+
+        Event dispatching in XMLHttpRequestProgressEventThrottle should go through XMLHttpRequestProgressEventThrottle::dispatchEvent
+        https://bugs.webkit.org/show_bug.cgi?id=46743
+
+        Reviewed by Julien Chaffraix
+        Based on original patch by Anton D'Auria
+
+        In preparation for platform-specific queuing of XMLHttpRequest events,
+        this patch changes all calls to m_target->dispatchEvent to
+        XMLHttpRequestProgressEventThrottle::dispatchEvent.
+        Currently, we queue only one progress event on suspend() if we have
+        throttled progress events. We should be able to queue all XHR events
+        that can be generated after suspend(), if the platform network layer
+        continues to receive data.
+        XMLHttpRequest uses XMLHttpRequestProgressEventThrottle to dispatch only
+        download events, so this doesn't change behavior of upload events, which
+        aren't throttled or queued.
+
+        * xml/XMLHttpRequest.cpp:
+        (WebCore::XMLHttpRequest::callReadyStateChangeListener):
+        * xml/XMLHttpRequestProgressEventThrottle.cpp:
+        (WebCore::XMLHttpRequestProgressEventThrottle::dispatchReadyStateChangeEvent):
+        (WebCore::XMLHttpRequestProgressEventThrottle::dispatchEvent):
+        (WebCore::XMLHttpRequestProgressEventThrottle::flushProgressEvent):
+        (WebCore::XMLHttpRequestProgressEventThrottle::dispatchPausedEvent):
+        (WebCore::XMLHttpRequestProgressEventThrottle::fired):
+        * xml/XMLHttpRequestProgressEventThrottle.h:
+        (XMLHttpRequestProgressEventThrottle):
+
 2012-03-22  Sudarsana Nagineni  <[email protected]>
 
         [EFL] Map BackSpace key code to Unicode value

Modified: trunk/Source/WebCore/xml/XMLHttpRequest.cpp (111716 => 111717)


--- trunk/Source/WebCore/xml/XMLHttpRequest.cpp	2012-03-22 16:59:46 UTC (rev 111716)
+++ trunk/Source/WebCore/xml/XMLHttpRequest.cpp	2012-03-22 17:01:48 UTC (rev 111717)
@@ -389,7 +389,7 @@
     InspectorInstrumentationCookie cookie = InspectorInstrumentation::willChangeXHRReadyState(scriptExecutionContext(), this);
 
     if (m_async || (m_state <= OPENED || m_state == DONE))
-        m_progressEventThrottle.dispatchEvent(XMLHttpRequestProgressEvent::create(eventNames().readystatechangeEvent), m_state == DONE ? FlushProgressEvent : DoNotFlushProgressEvent);
+        m_progressEventThrottle.dispatchReadyStateChangeEvent(XMLHttpRequestProgressEvent::create(eventNames().readystatechangeEvent), m_state == DONE ? FlushProgressEvent : DoNotFlushProgressEvent);
 
     InspectorInstrumentation::didChangeXHRReadyState(cookie);
 

Modified: trunk/Source/WebCore/xml/XMLHttpRequestProgressEventThrottle.cpp (111716 => 111717)


--- trunk/Source/WebCore/xml/XMLHttpRequestProgressEventThrottle.cpp	2012-03-22 16:59:46 UTC (rev 111716)
+++ trunk/Source/WebCore/xml/XMLHttpRequestProgressEventThrottle.cpp	2012-03-22 17:01:48 UTC (rev 111717)
@@ -69,15 +69,20 @@
     m_total = total;
 }
 
-void XMLHttpRequestProgressEventThrottle::dispatchEvent(PassRefPtr<Event> event, ProgressEventAction progressEventAction)
+void XMLHttpRequestProgressEventThrottle::dispatchReadyStateChangeEvent(PassRefPtr<Event> event, ProgressEventAction progressEventAction)
 {
+    if (progressEventAction == FlushProgressEvent)
+        flushProgressEvent();
+
+    dispatchEvent(event);
+}
+
+void XMLHttpRequestProgressEventThrottle::dispatchEvent(PassRefPtr<Event> event)
+{
     ASSERT(!suspended());
     // We should not have any pending events from a previous resume.
     ASSERT(!m_pausedEvent);
 
-    if (progressEventAction == FlushProgressEvent)
-        flushProgressEvent();
-
     m_target->dispatchEvent(event);
 }
 
@@ -101,7 +106,7 @@
     // We stop the timer as this is called when no more events are supposed to occur.
     stop();
 
-    m_target->dispatchEvent(event);
+    dispatchEvent(event);
 }
 
 void XMLHttpRequestProgressEventThrottle::dispatchPausedEvent()
@@ -110,7 +115,7 @@
     if (!m_pausedEvent)
         return;
 
-    m_target->dispatchEvent(m_pausedEvent);
+    dispatchEvent(m_pausedEvent);
     m_pausedEvent = 0;
 }
 
@@ -125,7 +130,7 @@
         return;
     }
 
-    m_target->dispatchEvent(XMLHttpRequestProgressEvent::create(eventNames().progressEvent, m_lengthComputable, m_loaded, m_total));
+    dispatchEvent(XMLHttpRequestProgressEvent::create(eventNames().progressEvent, m_lengthComputable, m_loaded, m_total));
     m_total = 0;
     m_loaded = 0;
 }

Modified: trunk/Source/WebCore/xml/XMLHttpRequestProgressEventThrottle.h (111716 => 111717)


--- trunk/Source/WebCore/xml/XMLHttpRequestProgressEventThrottle.h	2012-03-22 16:59:46 UTC (rev 111716)
+++ trunk/Source/WebCore/xml/XMLHttpRequestProgressEventThrottle.h	2012-03-22 17:01:48 UTC (rev 111717)
@@ -49,7 +49,8 @@
     virtual ~XMLHttpRequestProgressEventThrottle();
 
     void dispatchProgressEvent(bool lengthComputable, unsigned long long loaded, unsigned long long total);
-    void dispatchEvent(PassRefPtr<Event>, ProgressEventAction = DoNotFlushProgressEvent);
+    void dispatchReadyStateChangeEvent(PassRefPtr<Event>, ProgressEventAction = DoNotFlushProgressEvent);
+    void dispatchEvent(PassRefPtr<Event>);
     void dispatchEventAndLoadEnd(PassRefPtr<Event>);
 
     void suspend();
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to