| 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 13 matching lines...) Expand all Loading... |
| 24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 25 */ | 25 */ |
| 26 | 26 |
| 27 #include "core/xmlhttprequest/XMLHttpRequestProgressEventThrottle.h" | 27 #include "core/xmlhttprequest/XMLHttpRequestProgressEventThrottle.h" |
| 28 | 28 |
| 29 #include "core/EventTypeNames.h" | 29 #include "core/EventTypeNames.h" |
| 30 #include "core/events/ProgressEvent.h" | 30 #include "core/events/ProgressEvent.h" |
| 31 #include "core/inspector/InspectorInstrumentation.h" | 31 #include "core/inspector/InspectorInstrumentation.h" |
| 32 #include "core/inspector/InspectorTraceEvents.h" | 32 #include "core/inspector/InspectorTraceEvents.h" |
| 33 #include "core/xmlhttprequest/XMLHttpRequest.h" | 33 #include "core/xmlhttprequest/XMLHttpRequest.h" |
| 34 #include "public/platform/Platform.h" |
| 35 #include "public/platform/WebScheduler.h" |
| 36 #include "public/platform/WebThread.h" |
| 34 #include "wtf/Assertions.h" | 37 #include "wtf/Assertions.h" |
| 35 #include "wtf/text/AtomicString.h" | 38 #include "wtf/text/AtomicString.h" |
| 36 | 39 |
| 37 namespace blink { | 40 namespace blink { |
| 38 | 41 |
| 39 static const double kMinimumProgressEventDispatchingIntervalInSeconds = .05; //
50 ms per specification. | 42 static const double kMinimumProgressEventDispatchingIntervalInSeconds = .05; //
50 ms per specification. |
| 40 | 43 |
| 41 XMLHttpRequestProgressEventThrottle::DeferredEvent::DeferredEvent() | 44 XMLHttpRequestProgressEventThrottle::DeferredEvent::DeferredEvent() |
| 42 { | 45 { |
| 43 clear(); | 46 clear(); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 64 Event* XMLHttpRequestProgressEventThrottle::DeferredEvent::take() | 67 Event* XMLHttpRequestProgressEventThrottle::DeferredEvent::take() |
| 65 { | 68 { |
| 66 ASSERT(m_isSet); | 69 ASSERT(m_isSet); |
| 67 | 70 |
| 68 Event* event = ProgressEvent::create(EventTypeNames::progress, m_lengthCompu
table, m_loaded, m_total); | 71 Event* event = ProgressEvent::create(EventTypeNames::progress, m_lengthCompu
table, m_loaded, m_total); |
| 69 clear(); | 72 clear(); |
| 70 return event; | 73 return event; |
| 71 } | 74 } |
| 72 | 75 |
| 73 XMLHttpRequestProgressEventThrottle::XMLHttpRequestProgressEventThrottle(XMLHttp
Request* target) | 76 XMLHttpRequestProgressEventThrottle::XMLHttpRequestProgressEventThrottle(XMLHttp
Request* target) |
| 74 : m_target(target) | 77 : TimerBase(Platform::current()->currentThread()->scheduler()->timerTaskRunn
er()) |
| 78 , m_target(target) |
| 75 , m_hasDispatchedProgressProgressEvent(false) | 79 , m_hasDispatchedProgressProgressEvent(false) |
| 76 { | 80 { |
| 77 ASSERT(target); | 81 ASSERT(target); |
| 78 } | 82 } |
| 79 | 83 |
| 80 XMLHttpRequestProgressEventThrottle::~XMLHttpRequestProgressEventThrottle() | 84 XMLHttpRequestProgressEventThrottle::~XMLHttpRequestProgressEventThrottle() |
| 81 { | 85 { |
| 82 } | 86 } |
| 83 | 87 |
| 84 void XMLHttpRequestProgressEventThrottle::dispatchProgressEvent(const AtomicStri
ng& type, bool lengthComputable, unsigned long long loaded, unsigned long long t
otal) | 88 void XMLHttpRequestProgressEventThrottle::dispatchProgressEvent(const AtomicStri
ng& type, bool lengthComputable, unsigned long long loaded, unsigned long long t
otal) |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 // event-handler could insert new active DOM objects to the list. | 175 // event-handler could insert new active DOM objects to the list. |
| 172 startOneShot(0, BLINK_FROM_HERE); | 176 startOneShot(0, BLINK_FROM_HERE); |
| 173 } | 177 } |
| 174 | 178 |
| 175 DEFINE_TRACE(XMLHttpRequestProgressEventThrottle) | 179 DEFINE_TRACE(XMLHttpRequestProgressEventThrottle) |
| 176 { | 180 { |
| 177 visitor->trace(m_target); | 181 visitor->trace(m_target); |
| 178 } | 182 } |
| 179 | 183 |
| 180 } // namespace blink | 184 } // namespace blink |
| OLD | NEW |