Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(61)

Side by Side Diff: third_party/WebKit/Source/core/xmlhttprequest/ProgressEventThrottle.h

Issue 1690503002: Rename XMLHttpRequestProgressEventThrottle to ProgressEventThrottle (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
11 * notice, this list of conditions and the following disclaimer in the 11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution. 12 * documentation and/or other materials provided with the distribution.
13 * 13 *
14 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 14 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
15 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 15 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
16 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 16 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
17 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 17 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
18 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 18 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
19 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 19 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
20 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
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 #ifndef XMLHttpRequestProgressEventThrottle_h 27 #ifndef ProgressEventThrottle_h
28 #define XMLHttpRequestProgressEventThrottle_h 28 #define ProgressEventThrottle_h
29 29
30 #include "platform/Timer.h" 30 #include "platform/Timer.h"
31 #include "platform/heap/Handle.h" 31 #include "platform/heap/Handle.h"
32 #include "wtf/Forward.h" 32 #include "wtf/Forward.h"
33 #include "wtf/PassRefPtr.h" 33 #include "wtf/PassRefPtr.h"
34 34
35 namespace blink { 35 namespace blink {
36 36
37 class Event; 37 class Event;
38 class XMLHttpRequest; 38 class XMLHttpRequest;
39 39
40 // This class implements the XHR2 ProgressEvent dispatching: 40 // This class implements the XHR2 ProgressEvent dispatching:
41 // "dispatch a progress event named progress about every 50ms or for every 41 // "dispatch a progress event named progress about every 50ms or for every
42 // byte received, whichever is least frequent". 42 // byte received, whichever is least frequent".
43 // 43 //
44 // readystatechange events also go through this class since ProgressEvents and 44 // readystatechange events also go through this class since ProgressEvents and
45 // readystatechange events affect each other. 45 // readystatechange events affect each other.
46 // 46 //
47 // In the comments for this class: 47 // In the comments for this class:
48 // - "progress" event means an event named "progress" 48 // - "progress" event means an event named "progress"
49 // - ProgressEvent means an event using the ProgressEvent interface defined in 49 // - ProgressEvent means an event using the ProgressEvent interface defined in
50 // the spec. 50 // the spec.
51 class XMLHttpRequestProgressEventThrottle final : public GarbageCollectedFinaliz ed<XMLHttpRequestProgressEventThrottle>, public TimerBase { 51 class ProgressEventThrottle final : public GarbageCollectedFinalized<ProgressEve ntThrottle>, public TimerBase {
52 public: 52 public:
53 static XMLHttpRequestProgressEventThrottle* create(XMLHttpRequest* eventTarg et) 53 static ProgressEventThrottle* create(XMLHttpRequest* eventTarget)
54 { 54 {
55 return new XMLHttpRequestProgressEventThrottle(eventTarget); 55 return new ProgressEventThrottle(eventTarget);
56 } 56 }
57 ~XMLHttpRequestProgressEventThrottle() override; 57 ~ProgressEventThrottle() override;
58 58
59 enum DeferredEventAction { 59 enum DeferredEventAction {
60 Ignore, 60 Ignore,
61 Clear, 61 Clear,
62 Flush, 62 Flush,
63 }; 63 };
64 64
65 // Dispatches a ProgressEvent. 65 // Dispatches a ProgressEvent.
66 // 66 //
67 // Special treatment for events named "progress" is implemented to dispatch 67 // Special treatment for events named "progress" is implemented to dispatch
(...skipping 10 matching lines...) Expand all
78 void dispatchReadyStateChangeEvent(PassRefPtrWillBeRawPtr<Event>, DeferredEv entAction); 78 void dispatchReadyStateChangeEvent(PassRefPtrWillBeRawPtr<Event>, DeferredEv entAction);
79 79
80 void suspend(); 80 void suspend();
81 void resume(); 81 void resume();
82 82
83 // Need to promptly stop this timer when it is deemed finalizable. 83 // Need to promptly stop this timer when it is deemed finalizable.
84 EAGERLY_FINALIZE(); 84 EAGERLY_FINALIZE();
85 DECLARE_TRACE(); 85 DECLARE_TRACE();
86 86
87 private: 87 private:
88 explicit XMLHttpRequestProgressEventThrottle(XMLHttpRequest*); 88 explicit ProgressEventThrottle(XMLHttpRequest*);
89 89
90 // Dispatches a "progress" progress event and usually a readyStateChange 90 // Dispatches a "progress" progress event and usually a readyStateChange
91 // event as well. 91 // event as well.
92 void dispatchProgressProgressEvent(PassRefPtrWillBeRawPtr<Event>); 92 void dispatchProgressProgressEvent(PassRefPtrWillBeRawPtr<Event>);
93 93
94 // The main purpose of this class is to throttle the "progress" 94 // The main purpose of this class is to throttle the "progress"
95 // ProgressEvent dispatching. This class represents such a deferred 95 // ProgressEvent dispatching. This class represents such a deferred
96 // "progress" ProgressEvent. 96 // "progress" ProgressEvent.
97 class DeferredEvent { 97 class DeferredEvent {
98 public: 98 public:
(...skipping 21 matching lines...) Expand all
120 // arrive, only the last one is stored and others are discarded. 120 // arrive, only the last one is stored and others are discarded.
121 DeferredEvent m_deferred; 121 DeferredEvent m_deferred;
122 122
123 // True if any "progress" progress event has been dispatched since 123 // True if any "progress" progress event has been dispatched since
124 // |m_target|'s readyState changed. 124 // |m_target|'s readyState changed.
125 bool m_hasDispatchedProgressProgressEvent; 125 bool m_hasDispatchedProgressProgressEvent;
126 }; 126 };
127 127
128 } // namespace blink 128 } // namespace blink
129 129
130 #endif // XMLHttpRequestProgressEventThrottle_h 130 #endif // ProgressEventThrottle_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/core.gypi ('k') | third_party/WebKit/Source/core/xmlhttprequest/ProgressEventThrottle.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698