Commit 0e2b86c3 authored by commit-queue@webkit.org's avatar commit-queue@webkit.org
Browse files

Event dispatching in XMLHttpRequestProgressEventThrottle should go through...

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

Patch by Allan Sandfeld Jensen <allan.jensen@nokia.com> 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):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@111717 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 737cfd83
2012-03-22 Allan Sandfeld Jensen <allan.jensen@nokia.com>
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 <sudarsana.nagineni@linux.intel.com>
 
[EFL] Map BackSpace key code to Unicode value
......@@ -389,7 +389,7 @@ void XMLHttpRequest::callReadyStateChangeListener()
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);
......
......@@ -69,15 +69,20 @@ void XMLHttpRequestProgressEventThrottle::dispatchProgressEvent(bool lengthCompu
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 @@ void XMLHttpRequestProgressEventThrottle::flushProgressEvent()
// 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 @@ void XMLHttpRequestProgressEventThrottle::dispatchPausedEvent()
if (!m_pausedEvent)
return;
m_target->dispatchEvent(m_pausedEvent);
dispatchEvent(m_pausedEvent);
m_pausedEvent = 0;
}
......@@ -125,7 +130,7 @@ void XMLHttpRequestProgressEventThrottle::fired()
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;
}
......
......@@ -49,7 +49,8 @@ public:
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();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment