Ignore:
Timestamp:
Mar 22, 2012, 10:01:48 AM (13 years ago)
Author:
[email protected]
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):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/xml/XMLHttpRequestProgressEventThrottle.cpp

    r103502 r111717  
    7070}
    7171
    72 void XMLHttpRequestProgressEventThrottle::dispatchEvent(PassRefPtr<Event> event, ProgressEventAction progressEventAction)
     72void XMLHttpRequestProgressEventThrottle::dispatchReadyStateChangeEvent(PassRefPtr<Event> event, ProgressEventAction progressEventAction)
     73{
     74    if (progressEventAction == FlushProgressEvent)
     75        flushProgressEvent();
     76
     77    dispatchEvent(event);
     78}
     79
     80void XMLHttpRequestProgressEventThrottle::dispatchEvent(PassRefPtr<Event> event)
    7381{
    7482    ASSERT(!suspended());
    7583    // We should not have any pending events from a previous resume.
    7684    ASSERT(!m_pausedEvent);
    77 
    78     if (progressEventAction == FlushProgressEvent)
    79         flushProgressEvent();
    8085
    8186    m_target->dispatchEvent(event);
     
    102107    stop();
    103108
    104     m_target->dispatchEvent(event);
     109    dispatchEvent(event);
    105110}
    106111
     
    111116        return;
    112117
    113     m_target->dispatchEvent(m_pausedEvent);
     118    dispatchEvent(m_pausedEvent);
    114119    m_pausedEvent = 0;
    115120}
     
    126131    }
    127132
    128     m_target->dispatchEvent(XMLHttpRequestProgressEvent::create(eventNames().progressEvent, m_lengthComputable, m_loaded, m_total));
     133    dispatchEvent(XMLHttpRequestProgressEvent::create(eventNames().progressEvent, m_lengthComputable, m_loaded, m_total));
    129134    m_total = 0;
    130135    m_loaded = 0;
Note: See TracChangeset for help on using the changeset viewer.