| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Julien Chaffraix <jchaffraix@webkit.org> All right | 2 * Copyright (C) 2010 Julien Chaffraix <jchaffraix@webkit.org> All right |
| 3 * reserved. | 3 * reserved. |
| 4 * Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies) | 4 * Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies) |
| 5 * | 5 * |
| 6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
| 7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
| 8 * are met: | 8 * are met: |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 stop(); | 125 stop(); |
| 126 } | 126 } |
| 127 | 127 |
| 128 m_hasDispatchedProgressProgressEvent = false; | 128 m_hasDispatchedProgressProgressEvent = false; |
| 129 if (state == m_target->readyState()) { | 129 if (state == m_target->readyState()) { |
| 130 // We don't dispatch the event when an event handler associated with | 130 // We don't dispatch the event when an event handler associated with |
| 131 // the previously dispatched event changes the readyState (e.g. when | 131 // the previously dispatched event changes the readyState (e.g. when |
| 132 // the event handler calls xhr.abort()). In such cases a | 132 // the event handler calls xhr.abort()). In such cases a |
| 133 // readystatechange should have been already dispatched if necessary. | 133 // readystatechange should have been already dispatched if necessary. |
| 134 probe::AsyncTask asyncTask(m_target->getExecutionContext(), m_target, | 134 probe::AsyncTask asyncTask(m_target->getExecutionContext(), m_target, |
| 135 m_target->isAsync()); | 135 "progress"); |
| 136 asyncTask.setEnabled(m_target->isAsync()); |
| 136 m_target->dispatchEvent(event); | 137 m_target->dispatchEvent(event); |
| 137 } | 138 } |
| 138 } | 139 } |
| 139 | 140 |
| 140 void XMLHttpRequestProgressEventThrottle::dispatchProgressProgressEvent( | 141 void XMLHttpRequestProgressEventThrottle::dispatchProgressProgressEvent( |
| 141 Event* progressEvent) { | 142 Event* progressEvent) { |
| 142 XMLHttpRequest::State state = m_target->readyState(); | 143 XMLHttpRequest::State state = m_target->readyState(); |
| 143 if (m_target->readyState() == XMLHttpRequest::kLoading && | 144 if (m_target->readyState() == XMLHttpRequest::kLoading && |
| 144 m_hasDispatchedProgressProgressEvent) { | 145 m_hasDispatchedProgressProgressEvent) { |
| 145 TRACE_EVENT1("devtools.timeline", "XHRReadyStateChange", "data", | 146 TRACE_EVENT1("devtools.timeline", "XHRReadyStateChange", "data", |
| 146 InspectorXhrReadyStateChangeEvent::data( | 147 InspectorXhrReadyStateChangeEvent::data( |
| 147 m_target->getExecutionContext(), m_target)); | 148 m_target->getExecutionContext(), m_target)); |
| 148 probe::AsyncTask asyncTask(m_target->getExecutionContext(), m_target, | 149 probe::AsyncTask asyncTask(m_target->getExecutionContext(), m_target, |
| 149 m_target->isAsync()); | 150 "progress"); |
| 151 asyncTask.setEnabled(m_target->isAsync()); |
| 150 m_target->dispatchEvent(Event::create(EventTypeNames::readystatechange)); | 152 m_target->dispatchEvent(Event::create(EventTypeNames::readystatechange)); |
| 151 } | 153 } |
| 152 | 154 |
| 153 if (m_target->readyState() != state) | 155 if (m_target->readyState() != state) |
| 154 return; | 156 return; |
| 155 | 157 |
| 156 m_hasDispatchedProgressProgressEvent = true; | 158 m_hasDispatchedProgressProgressEvent = true; |
| 157 probe::AsyncTask asyncTask(m_target->getExecutionContext(), m_target, | 159 probe::AsyncTask asyncTask(m_target->getExecutionContext(), m_target, |
| 158 m_target->isAsync()); | 160 "progress"); |
| 161 asyncTask.setEnabled(m_target->isAsync()); |
| 159 m_target->dispatchEvent(progressEvent); | 162 m_target->dispatchEvent(progressEvent); |
| 160 } | 163 } |
| 161 | 164 |
| 162 void XMLHttpRequestProgressEventThrottle::fired() { | 165 void XMLHttpRequestProgressEventThrottle::fired() { |
| 163 if (!m_deferred.isSet()) { | 166 if (!m_deferred.isSet()) { |
| 164 // No "progress" event was queued since the previous dispatch, we can | 167 // No "progress" event was queued since the previous dispatch, we can |
| 165 // safely stop the timer. | 168 // safely stop the timer. |
| 166 return; | 169 return; |
| 167 } | 170 } |
| 168 | 171 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 185 // over the list of SuspendableObjects to resume them, and any activated JS | 188 // over the list of SuspendableObjects to resume them, and any activated JS |
| 186 // event-handler could insert new SuspendableObjects to the list. | 189 // event-handler could insert new SuspendableObjects to the list. |
| 187 startOneShot(0, BLINK_FROM_HERE); | 190 startOneShot(0, BLINK_FROM_HERE); |
| 188 } | 191 } |
| 189 | 192 |
| 190 DEFINE_TRACE(XMLHttpRequestProgressEventThrottle) { | 193 DEFINE_TRACE(XMLHttpRequestProgressEventThrottle) { |
| 191 visitor->trace(m_target); | 194 visitor->trace(m_target); |
| 192 } | 195 } |
| 193 | 196 |
| 194 } // namespace blink | 197 } // namespace blink |
| OLD | NEW |