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

Side by Side Diff: third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequestProgressEventThrottle.cpp

Issue 1686483002: Oilpan: Remove most WillBe types from the code base (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> 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 52
53 void XMLHttpRequestProgressEventThrottle::DeferredEvent::clear() 53 void XMLHttpRequestProgressEventThrottle::DeferredEvent::clear()
54 { 54 {
55 m_isSet = false; 55 m_isSet = false;
56 56
57 m_lengthComputable = false; 57 m_lengthComputable = false;
58 m_loaded = 0; 58 m_loaded = 0;
59 m_total = 0; 59 m_total = 0;
60 } 60 }
61 61
62 PassRefPtrWillBeRawPtr<Event> XMLHttpRequestProgressEventThrottle::DeferredEvent ::take() 62 RawPtr<Event> XMLHttpRequestProgressEventThrottle::DeferredEvent::take()
63 { 63 {
64 ASSERT(m_isSet); 64 ASSERT(m_isSet);
65 65
66 RefPtrWillBeRawPtr<Event> event = XMLHttpRequestProgressEvent::create(EventT ypeNames::progress, m_lengthComputable, m_loaded, m_total); 66 RawPtr<Event> event = XMLHttpRequestProgressEvent::create(EventTypeNames::pr ogress, m_lengthComputable, m_loaded, m_total);
67 clear(); 67 clear();
68 return event.release(); 68 return event.release();
69 } 69 }
70 70
71 const double XMLHttpRequestProgressEventThrottle::minimumProgressEventDispatchin gIntervalInSeconds = .05; // 50 ms per specification. 71 const double XMLHttpRequestProgressEventThrottle::minimumProgressEventDispatchin gIntervalInSeconds = .05; // 50 ms per specification.
72 72
73 XMLHttpRequestProgressEventThrottle::XMLHttpRequestProgressEventThrottle(XMLHttp Request* target) 73 XMLHttpRequestProgressEventThrottle::XMLHttpRequestProgressEventThrottle(XMLHttp Request* target)
74 : m_target(target) 74 : m_target(target)
75 , m_hasDispatchedProgressProgressEvent(false) 75 , m_hasDispatchedProgressProgressEvent(false)
76 { 76 {
(...skipping 14 matching lines...) Expand all
91 } 91 }
92 92
93 if (isActive()) { 93 if (isActive()) {
94 m_deferred.set(lengthComputable, loaded, total); 94 m_deferred.set(lengthComputable, loaded, total);
95 } else { 95 } else {
96 dispatchProgressProgressEvent(XMLHttpRequestProgressEvent::create(EventT ypeNames::progress, lengthComputable, loaded, total)); 96 dispatchProgressProgressEvent(XMLHttpRequestProgressEvent::create(EventT ypeNames::progress, lengthComputable, loaded, total));
97 startOneShot(minimumProgressEventDispatchingIntervalInSeconds, BLINK_FRO M_HERE); 97 startOneShot(minimumProgressEventDispatchingIntervalInSeconds, BLINK_FRO M_HERE);
98 } 98 }
99 } 99 }
100 100
101 void XMLHttpRequestProgressEventThrottle::dispatchReadyStateChangeEvent(PassRefP trWillBeRawPtr<Event> event, DeferredEventAction action) 101 void XMLHttpRequestProgressEventThrottle::dispatchReadyStateChangeEvent(RawPtr<E vent> event, DeferredEventAction action)
102 { 102 {
103 XMLHttpRequest::State state = m_target->readyState(); 103 XMLHttpRequest::State state = m_target->readyState();
104 // Given that ResourceDispatcher doesn't deliver an event when suspended, 104 // Given that ResourceDispatcher doesn't deliver an event when suspended,
105 // we don't have to worry about event dispatching while suspended. 105 // we don't have to worry about event dispatching while suspended.
106 if (action == Flush) { 106 if (action == Flush) {
107 if (m_deferred.isSet()) 107 if (m_deferred.isSet())
108 dispatchProgressProgressEvent(m_deferred.take()); 108 dispatchProgressProgressEvent(m_deferred.take());
109 109
110 stop(); 110 stop();
111 } else if (action == Clear) { 111 } else if (action == Clear) {
112 m_deferred.clear(); 112 m_deferred.clear();
113 stop(); 113 stop();
114 } 114 }
115 115
116 m_hasDispatchedProgressProgressEvent = false; 116 m_hasDispatchedProgressProgressEvent = false;
117 if (state == m_target->readyState()) { 117 if (state == m_target->readyState()) {
118 // We don't dispatch the event when an event handler associated with 118 // We don't dispatch the event when an event handler associated with
119 // the previously dispatched event changes the readyState (e.g. when 119 // the previously dispatched event changes the readyState (e.g. when
120 // the event handler calls xhr.abort()). In such cases a 120 // the event handler calls xhr.abort()). In such cases a
121 // readystatechange should have been already dispatched if necessary. 121 // readystatechange should have been already dispatched if necessary.
122 m_target->dispatchEvent(event); 122 m_target->dispatchEvent(event);
123 } 123 }
124 } 124 }
125 125
126 void XMLHttpRequestProgressEventThrottle::dispatchProgressProgressEvent(PassRefP trWillBeRawPtr<Event> progressEvent) 126 void XMLHttpRequestProgressEventThrottle::dispatchProgressProgressEvent(RawPtr<E vent> progressEvent)
127 { 127 {
128 XMLHttpRequest::State state = m_target->readyState(); 128 XMLHttpRequest::State state = m_target->readyState();
129 if (m_target->readyState() == XMLHttpRequest::LOADING && m_hasDispatchedProg ressProgressEvent) { 129 if (m_target->readyState() == XMLHttpRequest::LOADING && m_hasDispatchedProg ressProgressEvent) {
130 TRACE_EVENT1("devtools.timeline", "XHRReadyStateChange", "data", Inspect orXhrReadyStateChangeEvent::data(m_target->executionContext(), m_target)); 130 TRACE_EVENT1("devtools.timeline", "XHRReadyStateChange", "data", Inspect orXhrReadyStateChangeEvent::data(m_target->executionContext(), m_target));
131 m_target->dispatchEvent(Event::create(EventTypeNames::readystatechange)) ; 131 m_target->dispatchEvent(Event::create(EventTypeNames::readystatechange)) ;
132 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Up dateCounters", TRACE_EVENT_SCOPE_THREAD, "data", InspectorUpdateCountersEvent::d ata()); 132 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Up dateCounters", TRACE_EVENT_SCOPE_THREAD, "data", InspectorUpdateCountersEvent::d ata());
133 } 133 }
134 134
135 if (m_target->readyState() != state) 135 if (m_target->readyState() != state)
136 return; 136 return;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 // event-handler could insert new active DOM objects to the list. 168 // event-handler could insert new active DOM objects to the list.
169 startOneShot(0, BLINK_FROM_HERE); 169 startOneShot(0, BLINK_FROM_HERE);
170 } 170 }
171 171
172 DEFINE_TRACE(XMLHttpRequestProgressEventThrottle) 172 DEFINE_TRACE(XMLHttpRequestProgressEventThrottle)
173 { 173 {
174 visitor->trace(m_target); 174 visitor->trace(m_target);
175 } 175 }
176 176
177 } // namespace blink 177 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698