OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2003, 2006, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2003, 2006, 2008 Apple Inc. All rights reserved. |
3 * Copyright (C) 2005, 2006 Alexey Proskuryakov <ap@nypop.com> | 3 * Copyright (C) 2005, 2006 Alexey Proskuryakov <ap@nypop.com> |
4 * Copyright (C) 2011 Google Inc. All rights reserved. | 4 * Copyright (C) 2011 Google Inc. All rights reserved. |
5 * Copyright (C) 2012 Intel Corporation | 5 * Copyright (C) 2012 Intel Corporation |
6 * | 6 * |
7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
8 * modify it under the terms of the GNU Lesser General Public | 8 * modify it under the terms of the GNU Lesser General Public |
9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 | 145 |
146 private: | 146 private: |
147 XMLHttpRequest(ExecutionContext*, PassRefPtr<SecurityOrigin>); | 147 XMLHttpRequest(ExecutionContext*, PassRefPtr<SecurityOrigin>); |
148 | 148 |
149 Document* document() const; | 149 Document* document() const; |
150 SecurityOrigin* securityOrigin() const; | 150 SecurityOrigin* securityOrigin() const; |
151 | 151 |
152 virtual void didSendData(unsigned long long bytesSent, unsigned long long to
talBytesToBeSent); | 152 virtual void didSendData(unsigned long long bytesSent, unsigned long long to
talBytesToBeSent); |
153 virtual void didReceiveResponse(unsigned long identifier, const ResourceResp
onse&); | 153 virtual void didReceiveResponse(unsigned long identifier, const ResourceResp
onse&); |
154 virtual void didReceiveData(const char* data, int dataLength); | 154 virtual void didReceiveData(const char* data, int dataLength); |
| 155 // When "blob" is specified as the responseType attribute, didDownloadData |
| 156 // is called instead of didReceiveData. |
| 157 virtual void didDownloadData(int dataLength); |
155 virtual void didFinishLoading(unsigned long identifier, double finishTime); | 158 virtual void didFinishLoading(unsigned long identifier, double finishTime); |
156 virtual void didFail(const ResourceError&); | 159 virtual void didFail(const ResourceError&); |
157 virtual void didFailRedirectCheck(); | 160 virtual void didFailRedirectCheck(); |
158 | 161 |
159 String responseMIMEType() const; | 162 String responseMIMEType() const; |
160 bool responseIsXML() const; | 163 bool responseIsXML() const; |
161 | 164 |
162 bool areMethodAndURLValidForSend(); | 165 bool areMethodAndURLValidForSend(); |
163 | 166 |
164 bool initSend(ExceptionState&); | 167 bool initSend(ExceptionState&); |
165 void sendBytesData(const void*, size_t, ExceptionState&); | 168 void sendBytesData(const void*, size_t, ExceptionState&); |
166 | 169 |
167 String getRequestHeader(const AtomicString& name) const; | 170 String getRequestHeader(const AtomicString& name) const; |
168 void setRequestHeaderInternal(const AtomicString& name, const String& value)
; | 171 void setRequestHeaderInternal(const AtomicString& name, const String& value)
; |
169 | 172 |
| 173 void trackProgress(int dataLength); |
170 // Changes m_state and dispatches a readyStateChange event if new m_state | 174 // Changes m_state and dispatches a readyStateChange event if new m_state |
171 // value is different from last one. | 175 // value is different from last one. |
172 void changeState(State newState); | 176 void changeState(State newState); |
173 void dispatchReadyStateChangeEvent(); | 177 void dispatchReadyStateChangeEvent(); |
174 | 178 |
175 void dropProtectionSoon(); | 179 void dropProtectionSoon(); |
176 void dropProtection(); | 180 void dropProtection(); |
177 // Clears variables used only while the resource is being loaded. | 181 // Clears variables used only while the resource is being loaded. |
178 void clearVariablesForLoading(); | 182 void clearVariablesForLoading(); |
179 // Returns false iff reentry happened and a new load is started. | 183 // Returns false iff reentry happened and a new load is started. |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 | 224 |
221 RefPtr<TextResourceDecoder> m_decoder; | 225 RefPtr<TextResourceDecoder> m_decoder; |
222 | 226 |
223 ScriptString m_responseText; | 227 ScriptString m_responseText; |
224 // Used to skip m_responseDocument creation if it's done previously. We need | 228 // Used to skip m_responseDocument creation if it's done previously. We need |
225 // this separate flag since m_responseDocument can be 0 for some cases. | 229 // this separate flag since m_responseDocument can be 0 for some cases. |
226 mutable bool m_createdDocument; | 230 mutable bool m_createdDocument; |
227 mutable RefPtr<Document> m_responseDocument; | 231 mutable RefPtr<Document> m_responseDocument; |
228 | 232 |
229 RefPtr<SharedBuffer> m_binaryResponseBuilder; | 233 RefPtr<SharedBuffer> m_binaryResponseBuilder; |
| 234 long long m_downloadedBlobLength; |
230 mutable RefPtr<ArrayBuffer> m_responseArrayBuffer; | 235 mutable RefPtr<ArrayBuffer> m_responseArrayBuffer; |
231 | 236 |
232 bool m_error; | 237 bool m_error; |
233 | 238 |
234 bool m_uploadEventsAllowed; | 239 bool m_uploadEventsAllowed; |
235 bool m_uploadComplete; | 240 bool m_uploadComplete; |
236 | 241 |
237 bool m_sameOriginRequest; | 242 bool m_sameOriginRequest; |
238 | 243 |
239 // Used for onprogress tracking | 244 // Used for onprogress tracking |
(...skipping 10 matching lines...) Expand all Loading... |
250 | 255 |
251 // An enum corresponding to the allowed string values for the responseType a
ttribute. | 256 // An enum corresponding to the allowed string values for the responseType a
ttribute. |
252 ResponseTypeCode m_responseTypeCode; | 257 ResponseTypeCode m_responseTypeCode; |
253 AsyncMethodRunner<XMLHttpRequest> m_dropProtectionRunner; | 258 AsyncMethodRunner<XMLHttpRequest> m_dropProtectionRunner; |
254 RefPtr<SecurityOrigin> m_securityOrigin; | 259 RefPtr<SecurityOrigin> m_securityOrigin; |
255 }; | 260 }; |
256 | 261 |
257 } // namespace WebCore | 262 } // namespace WebCore |
258 | 263 |
259 #endif // XMLHttpRequest_h | 264 #endif // XMLHttpRequest_h |
OLD | NEW |