| 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 // "dispatch a progress event named progress about every 50ms or for every | 44 // "dispatch a progress event named progress about every 50ms or for every |
| 45 // byte received, whichever is least frequent". | 45 // byte received, whichever is least frequent". |
| 46 // | 46 // |
| 47 // readystatechange events also go through this class since ProgressEvents and | 47 // readystatechange events also go through this class since ProgressEvents and |
| 48 // readystatechange events affect each other. | 48 // readystatechange events affect each other. |
| 49 // | 49 // |
| 50 // In the comments for this class: | 50 // In the comments for this class: |
| 51 // - "progress" event means an event named "progress" | 51 // - "progress" event means an event named "progress" |
| 52 // - ProgressEvent means an event using the ProgressEvent interface defined in | 52 // - ProgressEvent means an event using the ProgressEvent interface defined in |
| 53 // the spec. | 53 // the spec. |
| 54 class XMLHttpRequestProgressEventThrottle FINAL : public TimerBase { | 54 class XMLHttpRequestProgressEventThrottle final : public TimerBase { |
| 55 DISALLOW_ALLOCATION(); | 55 DISALLOW_ALLOCATION(); |
| 56 public: | 56 public: |
| 57 enum DeferredEventAction { | 57 enum DeferredEventAction { |
| 58 Ignore, | 58 Ignore, |
| 59 Clear, | 59 Clear, |
| 60 Flush, | 60 Flush, |
| 61 }; | 61 }; |
| 62 | 62 |
| 63 explicit XMLHttpRequestProgressEventThrottle(EventTarget*); | 63 explicit XMLHttpRequestProgressEventThrottle(EventTarget*); |
| 64 virtual ~XMLHttpRequestProgressEventThrottle(); | 64 virtual ~XMLHttpRequestProgressEventThrottle(); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 81 | 81 |
| 82 void trace(Visitor*); | 82 void trace(Visitor*); |
| 83 | 83 |
| 84 private: | 84 private: |
| 85 // The main purpose of this class is to throttle the "progress" | 85 // The main purpose of this class is to throttle the "progress" |
| 86 // ProgressEvent dispatching. This class represents such a deferred | 86 // ProgressEvent dispatching. This class represents such a deferred |
| 87 // "progress" ProgressEvent. | 87 // "progress" ProgressEvent. |
| 88 class DeferredEvent; | 88 class DeferredEvent; |
| 89 static const double minimumProgressEventDispatchingIntervalInSeconds; | 89 static const double minimumProgressEventDispatchingIntervalInSeconds; |
| 90 | 90 |
| 91 virtual void fired() OVERRIDE; | 91 virtual void fired() override; |
| 92 void dispatchDeferredEvent(); | 92 void dispatchDeferredEvent(); |
| 93 | 93 |
| 94 // Non-Oilpan, keep a weak pointer to our XMLHttpRequest object as it is | 94 // 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 - | 95 // the one holding us. With Oilpan, a simple strong Member can be used - |
| 96 // this XMLHttpRequestProgressEventThrottle (part) object dies together | 96 // this XMLHttpRequestProgressEventThrottle (part) object dies together |
| 97 // with the XMLHttpRequest object. | 97 // with the XMLHttpRequest object. |
| 98 RawPtrWillBeMember<EventTarget> m_target; | 98 RawPtrWillBeMember<EventTarget> m_target; |
| 99 | 99 |
| 100 // A slot for the deferred "progress" ProgressEvent. When multiple events | 100 // A slot for the deferred "progress" ProgressEvent. When multiple events |
| 101 // arrive, only the last one is stored and others are discarded. | 101 // arrive, only the last one is stored and others are discarded. |
| 102 const OwnPtr<DeferredEvent> m_deferred; | 102 const OwnPtr<DeferredEvent> m_deferred; |
| 103 }; | 103 }; |
| 104 | 104 |
| 105 } // namespace blink | 105 } // namespace blink |
| 106 | 106 |
| 107 #endif // XMLHttpRequestProgressEventThrottle_h | 107 #endif // XMLHttpRequestProgressEventThrottle_h |
| OLD | NEW |