OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Julien Chaffraix <jchaffraix@webkit.org> | 2 * Copyright (C) 2010 Julien Chaffraix <jchaffraix@webkit.org> |
3 * All right reserved. | 3 * All right reserved. |
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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 // m_lengthComputable, m_loaded and m_total. They'll be used on next | 70 // m_lengthComputable, m_loaded and m_total. They'll be used on next |
71 // fired() call. | 71 // fired() call. |
72 void dispatchProgressEvent(const AtomicString&, bool lengthComputable, unsig
ned long long loaded, unsigned long long total); | 72 void dispatchProgressEvent(const AtomicString&, bool lengthComputable, unsig
ned long long loaded, unsigned long long total); |
73 // Dispatches the given event after operation about the "progress" event | 73 // Dispatches the given event after operation about the "progress" event |
74 // depending on the value of the ProgressEventAction argument. | 74 // depending on the value of the ProgressEventAction argument. |
75 void dispatchReadyStateChangeEvent(PassRefPtrWillBeRawPtr<Event>, DeferredEv
entAction); | 75 void dispatchReadyStateChangeEvent(PassRefPtrWillBeRawPtr<Event>, DeferredEv
entAction); |
76 | 76 |
77 void suspend(); | 77 void suspend(); |
78 void resume(); | 78 void resume(); |
79 | 79 |
80 // Promptly stop this timer once finalizable. | |
81 EAGERLY_FINALIZE(); | |
82 DECLARE_TRACE(); | 80 DECLARE_TRACE(); |
83 | 81 |
84 private: | 82 private: |
85 // The main purpose of this class is to throttle the "progress" | 83 // The main purpose of this class is to throttle the "progress" |
86 // ProgressEvent dispatching. This class represents such a deferred | 84 // ProgressEvent dispatching. This class represents such a deferred |
87 // "progress" ProgressEvent. | 85 // "progress" ProgressEvent. |
88 class DeferredEvent; | 86 class DeferredEvent; |
89 static const double minimumProgressEventDispatchingIntervalInSeconds; | 87 static const double minimumProgressEventDispatchingIntervalInSeconds; |
90 | 88 |
91 virtual void fired() override; | 89 virtual void fired() override; |
92 void dispatchDeferredEvent(); | 90 void dispatchDeferredEvent(); |
93 | 91 |
94 // Non-Oilpan, keep a weak pointer to our XMLHttpRequest object as it is | 92 // Non-Oilpan, keep a weak pointer to our XMLHttpRequest object as it is |
95 // the one holding us. With Oilpan, a simple strong Member can be used - | 93 // the one holding us. With Oilpan, a simple strong Member can be used - |
96 // this XMLHttpRequestProgressEventThrottle (part) object dies together | 94 // this XMLHttpRequestProgressEventThrottle (part) object dies together |
97 // with the XMLHttpRequest object. | 95 // with the XMLHttpRequest object. |
98 RawPtrWillBeMember<EventTarget> m_target; | 96 RawPtrWillBeMember<EventTarget> m_target; |
99 | 97 |
100 // A slot for the deferred "progress" ProgressEvent. When multiple events | 98 // A slot for the deferred "progress" ProgressEvent. When multiple events |
101 // arrive, only the last one is stored and others are discarded. | 99 // arrive, only the last one is stored and others are discarded. |
102 const OwnPtr<DeferredEvent> m_deferred; | 100 const OwnPtr<DeferredEvent> m_deferred; |
103 }; | 101 }; |
104 | 102 |
105 } // namespace blink | 103 } // namespace blink |
106 | 104 |
107 #endif // XMLHttpRequestProgressEventThrottle_h | 105 #endif // XMLHttpRequestProgressEventThrottle_h |
OLD | NEW |