OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Julien Chaffraix <jchaffraix@webkit.org> All right reserv
ed. | 2 * Copyright (C) 2010 Julien Chaffraix <jchaffraix@webkit.org> All right reserv
ed. |
3 * Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies) | 3 * Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies) |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 if (m_deferEvents) { | 91 if (m_deferEvents) { |
92 if (m_deferredEvents.size() > 1 && event->type() == EventTypeNames::read
ystatechange && event->type() == m_deferredEvents.last()->type()) { | 92 if (m_deferredEvents.size() > 1 && event->type() == EventTypeNames::read
ystatechange && event->type() == m_deferredEvents.last()->type()) { |
93 // Readystatechange events are state-less so avoid repeating two ide
ntical events in a row on resume. | 93 // Readystatechange events are state-less so avoid repeating two ide
ntical events in a row on resume. |
94 return; | 94 return; |
95 } | 95 } |
96 m_deferredEvents.append(event); | 96 m_deferredEvents.append(event); |
97 } else | 97 } else |
98 m_target->dispatchEvent(event); | 98 m_target->dispatchEvent(event); |
99 } | 99 } |
100 | 100 |
101 void XMLHttpRequestProgressEventThrottle::dispatchEventAndLoadEnd(PassRefPtr<Eve
nt> event) | 101 void XMLHttpRequestProgressEventThrottle::dispatchEventAndLoadEnd(const AtomicSt
ring& type, bool lengthComputable, unsigned long long bytesSent, unsigned long l
ong total) |
102 { | 102 { |
103 ASSERT(event->type() == EventTypeNames::load || event->type() == EventTypeNa
mes::abort || event->type() == EventTypeNames::error || event->type() == EventTy
peNames::timeout); | 103 ASSERT(type == EventTypeNames::load || type == EventTypeNames::abort || type
== EventTypeNames::error || type == EventTypeNames::timeout); |
104 | 104 |
105 dispatchEvent(event); | 105 dispatchEvent(XMLHttpRequestProgressEvent::create(type, lengthComputable, by
tesSent, total)); |
106 dispatchEvent(XMLHttpRequestProgressEvent::create(EventTypeNames::loadend)); | 106 dispatchEvent(XMLHttpRequestProgressEvent::create(EventTypeNames::loadend, l
engthComputable, bytesSent, total)); |
107 } | 107 } |
108 | 108 |
109 bool XMLHttpRequestProgressEventThrottle::flushDeferredProgressEvent() | 109 bool XMLHttpRequestProgressEventThrottle::flushDeferredProgressEvent() |
110 { | 110 { |
111 if (m_deferEvents && m_deferredProgressEvent) { | 111 if (m_deferEvents && m_deferredProgressEvent) { |
112 // Move the progress event to the queue, to get it in the right order on
resume. | 112 // Move the progress event to the queue, to get it in the right order on
resume. |
113 m_deferredEvents.append(m_deferredProgressEvent); | 113 m_deferredEvents.append(m_deferredProgressEvent); |
114 m_deferredProgressEvent = 0; | 114 m_deferredProgressEvent = 0; |
115 return true; | 115 return true; |
116 } | 116 } |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 } | 210 } |
211 | 211 |
212 // Do not dispatch events inline here, since ExecutionContext is iterating o
ver | 212 // Do not dispatch events inline here, since ExecutionContext is iterating o
ver |
213 // the list of active DOM objects to resume them, and any activated JS event
-handler | 213 // the list of active DOM objects to resume them, and any activated JS event
-handler |
214 // could insert new active DOM objects to the list. | 214 // could insert new active DOM objects to the list. |
215 // m_deferEvents is kept true until all deferred events have been dispatched
. | 215 // m_deferEvents is kept true until all deferred events have been dispatched
. |
216 m_dispatchDeferredEventsTimer.startOneShot(0); | 216 m_dispatchDeferredEventsTimer.startOneShot(0); |
217 } | 217 } |
218 | 218 |
219 } // namespace WebCore | 219 } // namespace WebCore |
OLD | NEW |