OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 void XMLHttpRequestUpload::dispatchProgressEvent(unsigned long long bytesSent, u
nsigned long long totalBytesToBeSent) | 53 void XMLHttpRequestUpload::dispatchProgressEvent(unsigned long long bytesSent, u
nsigned long long totalBytesToBeSent) |
54 { | 54 { |
55 m_lastBytesSent = bytesSent; | 55 m_lastBytesSent = bytesSent; |
56 m_lastTotalBytesToBeSent = totalBytesToBeSent; | 56 m_lastTotalBytesToBeSent = totalBytesToBeSent; |
57 InspectorInstrumentation::AsyncTask asyncTask(getExecutionContext(), m_xmlHt
tpRequest, m_xmlHttpRequest->isAsync()); | 57 InspectorInstrumentation::AsyncTask asyncTask(getExecutionContext(), m_xmlHt
tpRequest, m_xmlHttpRequest->isAsync()); |
58 dispatchEvent(ProgressEvent::create(EventTypeNames::progress, true, bytesSen
t, totalBytesToBeSent)); | 58 dispatchEvent(ProgressEvent::create(EventTypeNames::progress, true, bytesSen
t, totalBytesToBeSent)); |
59 } | 59 } |
60 | 60 |
61 void XMLHttpRequestUpload::dispatchEventAndLoadEnd(const AtomicString& type, boo
l lengthComputable, unsigned long long bytesSent, unsigned long long total) | 61 void XMLHttpRequestUpload::dispatchEventAndLoadEnd(const AtomicString& type, boo
l lengthComputable, unsigned long long bytesSent, unsigned long long total) |
62 { | 62 { |
63 ASSERT(type == EventTypeNames::load || type == EventTypeNames::abort || type
== EventTypeNames::error || type == EventTypeNames::timeout); | 63 DCHECK(type == EventTypeNames::load || type == EventTypeNames::abort || type
== EventTypeNames::error || type == EventTypeNames::timeout); |
64 InspectorInstrumentation::AsyncTask asyncTask(getExecutionContext(), m_xmlHt
tpRequest, m_xmlHttpRequest->isAsync()); | 64 InspectorInstrumentation::AsyncTask asyncTask(getExecutionContext(), m_xmlHt
tpRequest, m_xmlHttpRequest->isAsync()); |
65 dispatchEvent(ProgressEvent::create(type, lengthComputable, bytesSent, total
)); | 65 dispatchEvent(ProgressEvent::create(type, lengthComputable, bytesSent, total
)); |
66 dispatchEvent(ProgressEvent::create(EventTypeNames::loadend, lengthComputabl
e, bytesSent, total)); | 66 dispatchEvent(ProgressEvent::create(EventTypeNames::loadend, lengthComputabl
e, bytesSent, total)); |
67 } | 67 } |
68 | 68 |
69 void XMLHttpRequestUpload::handleRequestError(const AtomicString& type) | 69 void XMLHttpRequestUpload::handleRequestError(const AtomicString& type) |
70 { | 70 { |
71 bool lengthComputable = m_lastTotalBytesToBeSent > 0 && m_lastBytesSent <= m
_lastTotalBytesToBeSent; | 71 bool lengthComputable = m_lastTotalBytesToBeSent > 0 && m_lastBytesSent <= m
_lastTotalBytesToBeSent; |
72 InspectorInstrumentation::AsyncTask asyncTask(getExecutionContext(), m_xmlHt
tpRequest, m_xmlHttpRequest->isAsync()); | 72 InspectorInstrumentation::AsyncTask asyncTask(getExecutionContext(), m_xmlHt
tpRequest, m_xmlHttpRequest->isAsync()); |
73 dispatchEvent(ProgressEvent::create(EventTypeNames::progress, lengthComputab
le, m_lastBytesSent, m_lastTotalBytesToBeSent)); | 73 dispatchEvent(ProgressEvent::create(EventTypeNames::progress, lengthComputab
le, m_lastBytesSent, m_lastTotalBytesToBeSent)); |
74 dispatchEventAndLoadEnd(type, lengthComputable, m_lastBytesSent, m_lastTotal
BytesToBeSent); | 74 dispatchEventAndLoadEnd(type, lengthComputable, m_lastBytesSent, m_lastTotal
BytesToBeSent); |
75 } | 75 } |
76 | 76 |
77 DEFINE_TRACE(XMLHttpRequestUpload) | 77 DEFINE_TRACE(XMLHttpRequestUpload) |
78 { | 78 { |
79 visitor->trace(m_xmlHttpRequest); | 79 visitor->trace(m_xmlHttpRequest); |
80 XMLHttpRequestEventTarget::trace(visitor); | 80 XMLHttpRequestEventTarget::trace(visitor); |
81 } | 81 } |
82 | 82 |
83 } // namespace blink | 83 } // namespace blink |
OLD | NEW |