| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2006, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2004, 2006, 2008 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2005-2007 Alexey Proskuryakov <ap@webkit.org> | 3 * Copyright (C) 2005-2007 Alexey Proskuryakov <ap@webkit.org> |
| 4 * Copyright (C) 2007, 2008 Julien Chaffraix <jchaffraix@webkit.org> | 4 * Copyright (C) 2007, 2008 Julien Chaffraix <jchaffraix@webkit.org> |
| 5 * Copyright (C) 2008, 2011 Google Inc. All rights reserved. | 5 * Copyright (C) 2008, 2011 Google Inc. All rights reserved. |
| 6 * Copyright (C) 2012 Intel Corporation | 6 * Copyright (C) 2012 Intel Corporation |
| 7 * | 7 * |
| 8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
| 9 * modify it under the terms of the GNU Lesser General Public | 9 * modify it under the terms of the GNU Lesser General Public |
| 10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
| (...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 339 return xmlHttpRequest.release(); | 339 return xmlHttpRequest.release(); |
| 340 } | 340 } |
| 341 | 341 |
| 342 XMLHttpRequest::XMLHttpRequest(ExecutionContext* context, PassRefPtr<SecurityOri
gin> securityOrigin) | 342 XMLHttpRequest::XMLHttpRequest(ExecutionContext* context, PassRefPtr<SecurityOri
gin> securityOrigin) |
| 343 : ActiveDOMObject(context) | 343 : ActiveDOMObject(context) |
| 344 , m_timeoutMilliseconds(0) | 344 , m_timeoutMilliseconds(0) |
| 345 , m_state(UNSENT) | 345 , m_state(UNSENT) |
| 346 , m_lengthDownloadedToFile(0) | 346 , m_lengthDownloadedToFile(0) |
| 347 , m_receivedLength(0) | 347 , m_receivedLength(0) |
| 348 , m_exceptionCode(0) | 348 , m_exceptionCode(0) |
| 349 , m_progressEventThrottle(this) | 349 , m_progressEventThrottle(XMLHttpRequestProgressEventThrottle::create(this)) |
| 350 , m_responseTypeCode(ResponseTypeDefault) | 350 , m_responseTypeCode(ResponseTypeDefault) |
| 351 , m_securityOrigin(securityOrigin) | 351 , m_securityOrigin(securityOrigin) |
| 352 , m_eventDispatchRecursionLevel(0) | 352 , m_eventDispatchRecursionLevel(0) |
| 353 , m_async(true) | 353 , m_async(true) |
| 354 , m_includeCredentials(false) | 354 , m_includeCredentials(false) |
| 355 , m_parsedResponse(false) | 355 , m_parsedResponse(false) |
| 356 , m_error(false) | 356 , m_error(false) |
| 357 , m_uploadEventsAllowed(true) | 357 , m_uploadEventsAllowed(true) |
| 358 , m_uploadComplete(false) | 358 , m_uploadComplete(false) |
| 359 , m_sameOriginRequest(true) | 359 , m_sameOriginRequest(true) |
| (...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 666 | 666 |
| 667 if (m_async || (m_state <= OPENED || m_state == DONE)) { | 667 if (m_async || (m_state <= OPENED || m_state == DONE)) { |
| 668 TRACE_EVENT1("devtools.timeline", "XHRReadyStateChange", "data", Inspect
orXhrReadyStateChangeEvent::data(executionContext(), this)); | 668 TRACE_EVENT1("devtools.timeline", "XHRReadyStateChange", "data", Inspect
orXhrReadyStateChangeEvent::data(executionContext(), this)); |
| 669 XMLHttpRequestProgressEventThrottle::DeferredEventAction action = XMLHtt
pRequestProgressEventThrottle::Ignore; | 669 XMLHttpRequestProgressEventThrottle::DeferredEventAction action = XMLHtt
pRequestProgressEventThrottle::Ignore; |
| 670 if (m_state == DONE) { | 670 if (m_state == DONE) { |
| 671 if (m_error) | 671 if (m_error) |
| 672 action = XMLHttpRequestProgressEventThrottle::Clear; | 672 action = XMLHttpRequestProgressEventThrottle::Clear; |
| 673 else | 673 else |
| 674 action = XMLHttpRequestProgressEventThrottle::Flush; | 674 action = XMLHttpRequestProgressEventThrottle::Flush; |
| 675 } | 675 } |
| 676 m_progressEventThrottle.dispatchReadyStateChangeEvent(Event::create(Even
tTypeNames::readystatechange), action); | 676 m_progressEventThrottle->dispatchReadyStateChangeEvent(Event::create(Eve
ntTypeNames::readystatechange), action); |
| 677 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Up
dateCounters", TRACE_EVENT_SCOPE_THREAD, "data", InspectorUpdateCountersEvent::d
ata()); | 677 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Up
dateCounters", TRACE_EVENT_SCOPE_THREAD, "data", InspectorUpdateCountersEvent::d
ata()); |
| 678 } | 678 } |
| 679 | 679 |
| 680 if (m_state == DONE && !m_error) { | 680 if (m_state == DONE && !m_error) { |
| 681 TRACE_EVENT1("devtools.timeline", "XHRLoad", "data", InspectorXhrLoadEve
nt::data(executionContext(), this)); | 681 TRACE_EVENT1("devtools.timeline", "XHRLoad", "data", InspectorXhrLoadEve
nt::data(executionContext(), this)); |
| 682 dispatchProgressEventFromSnapshot(EventTypeNames::load); | 682 dispatchProgressEventFromSnapshot(EventTypeNames::load); |
| 683 dispatchProgressEventFromSnapshot(EventTypeNames::loadend); | 683 dispatchProgressEventFromSnapshot(EventTypeNames::loadend); |
| 684 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Up
dateCounters", TRACE_EVENT_SCOPE_THREAD, "data", InspectorUpdateCountersEvent::d
ata()); | 684 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Up
dateCounters", TRACE_EVENT_SCOPE_THREAD, "data", InspectorUpdateCountersEvent::d
ata()); |
| 685 } | 685 } |
| 686 } | 686 } |
| (...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1215 { | 1215 { |
| 1216 m_requestHeaders.clear(); | 1216 m_requestHeaders.clear(); |
| 1217 } | 1217 } |
| 1218 | 1218 |
| 1219 void XMLHttpRequest::dispatchProgressEvent(const AtomicString& type, long long r
eceivedLength, long long expectedLength) | 1219 void XMLHttpRequest::dispatchProgressEvent(const AtomicString& type, long long r
eceivedLength, long long expectedLength) |
| 1220 { | 1220 { |
| 1221 bool lengthComputable = expectedLength > 0 && receivedLength <= expectedLeng
th; | 1221 bool lengthComputable = expectedLength > 0 && receivedLength <= expectedLeng
th; |
| 1222 unsigned long long loaded = receivedLength >= 0 ? static_cast<unsigned long
long>(receivedLength) : 0; | 1222 unsigned long long loaded = receivedLength >= 0 ? static_cast<unsigned long
long>(receivedLength) : 0; |
| 1223 unsigned long long total = lengthComputable ? static_cast<unsigned long long
>(expectedLength) : 0; | 1223 unsigned long long total = lengthComputable ? static_cast<unsigned long long
>(expectedLength) : 0; |
| 1224 | 1224 |
| 1225 m_progressEventThrottle.dispatchProgressEvent(type, lengthComputable, loaded
, total); | 1225 m_progressEventThrottle->dispatchProgressEvent(type, lengthComputable, loade
d, total); |
| 1226 | 1226 |
| 1227 if (type == EventTypeNames::loadend) | 1227 if (type == EventTypeNames::loadend) |
| 1228 InspectorInstrumentation::didDispatchXHRLoadendEvent(executionContext(),
this); | 1228 InspectorInstrumentation::didDispatchXHRLoadendEvent(executionContext(),
this); |
| 1229 } | 1229 } |
| 1230 | 1230 |
| 1231 void XMLHttpRequest::dispatchProgressEventFromSnapshot(const AtomicString& type) | 1231 void XMLHttpRequest::dispatchProgressEventFromSnapshot(const AtomicString& type) |
| 1232 { | 1232 { |
| 1233 dispatchProgressEvent(type, m_receivedLength, m_response.expectedContentLeng
th()); | 1233 dispatchProgressEvent(type, m_receivedLength, m_response.expectedContentLeng
th()); |
| 1234 } | 1234 } |
| 1235 | 1235 |
| (...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1800 long long receivedLength = m_receivedLength; | 1800 long long receivedLength = m_receivedLength; |
| 1801 | 1801 |
| 1802 if (!internalAbort()) | 1802 if (!internalAbort()) |
| 1803 return; | 1803 return; |
| 1804 | 1804 |
| 1805 handleRequestError(TimeoutError, EventTypeNames::timeout, receivedLength, ex
pectedLength); | 1805 handleRequestError(TimeoutError, EventTypeNames::timeout, receivedLength, ex
pectedLength); |
| 1806 } | 1806 } |
| 1807 | 1807 |
| 1808 void XMLHttpRequest::suspend() | 1808 void XMLHttpRequest::suspend() |
| 1809 { | 1809 { |
| 1810 m_progressEventThrottle.suspend(); | 1810 m_progressEventThrottle->suspend(); |
| 1811 } | 1811 } |
| 1812 | 1812 |
| 1813 void XMLHttpRequest::resume() | 1813 void XMLHttpRequest::resume() |
| 1814 { | 1814 { |
| 1815 m_progressEventThrottle.resume(); | 1815 m_progressEventThrottle->resume(); |
| 1816 } | 1816 } |
| 1817 | 1817 |
| 1818 void XMLHttpRequest::stop() | 1818 void XMLHttpRequest::stop() |
| 1819 { | 1819 { |
| 1820 InspectorInstrumentation::didFailXHRLoading(executionContext(), this, this,
m_method, m_url); | 1820 InspectorInstrumentation::didFailXHRLoading(executionContext(), this, this,
m_method, m_url); |
| 1821 internalAbort(); | 1821 internalAbort(); |
| 1822 } | 1822 } |
| 1823 | 1823 |
| 1824 bool XMLHttpRequest::hasPendingActivity() const | 1824 bool XMLHttpRequest::hasPendingActivity() const |
| 1825 { | 1825 { |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1862 visitor->trace(m_responseDocumentParser); | 1862 visitor->trace(m_responseDocumentParser); |
| 1863 visitor->trace(m_progressEventThrottle); | 1863 visitor->trace(m_progressEventThrottle); |
| 1864 visitor->trace(m_upload); | 1864 visitor->trace(m_upload); |
| 1865 visitor->trace(m_blobLoader); | 1865 visitor->trace(m_blobLoader); |
| 1866 XMLHttpRequestEventTarget::trace(visitor); | 1866 XMLHttpRequestEventTarget::trace(visitor); |
| 1867 DocumentParserClient::trace(visitor); | 1867 DocumentParserClient::trace(visitor); |
| 1868 ActiveDOMObject::trace(visitor); | 1868 ActiveDOMObject::trace(visitor); |
| 1869 } | 1869 } |
| 1870 | 1870 |
| 1871 } // namespace blink | 1871 } // namespace blink |
| OLD | NEW |