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 AtomicString responseMIMEType() const; | 162 AtomicString 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 AtomicString getRequestHeader(const AtomicString& name) const; | 170 AtomicString getRequestHeader(const AtomicString& name) const; |
168 void setRequestHeaderInternal(const AtomicString& name, const AtomicString&
value); | 171 void setRequestHeaderInternal(const AtomicString& name, const AtomicString&
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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 | 230 |
227 OwnPtr<TextResourceDecoder> m_decoder; | 231 OwnPtr<TextResourceDecoder> m_decoder; |
228 | 232 |
229 ScriptString m_responseText; | 233 ScriptString m_responseText; |
230 // Used to skip m_responseDocument creation if it's done previously. We need | 234 // Used to skip m_responseDocument creation if it's done previously. We need |
231 // this separate flag since m_responseDocument can be 0 for some cases. | 235 // this separate flag since m_responseDocument can be 0 for some cases. |
232 bool m_createdDocument; | 236 bool m_createdDocument; |
233 RefPtr<Document> m_responseDocument; | 237 RefPtr<Document> m_responseDocument; |
234 | 238 |
235 RefPtr<SharedBuffer> m_binaryResponseBuilder; | 239 RefPtr<SharedBuffer> m_binaryResponseBuilder; |
| 240 long long m_downloadedBlobLength; |
236 RefPtr<ArrayBuffer> m_responseArrayBuffer; | 241 RefPtr<ArrayBuffer> m_responseArrayBuffer; |
237 | 242 |
238 bool m_error; | 243 bool m_error; |
239 | 244 |
240 bool m_uploadEventsAllowed; | 245 bool m_uploadEventsAllowed; |
241 bool m_uploadComplete; | 246 bool m_uploadComplete; |
242 | 247 |
243 bool m_sameOriginRequest; | 248 bool m_sameOriginRequest; |
244 | 249 |
245 // Used for onprogress tracking | 250 // Used for onprogress tracking |
(...skipping 10 matching lines...) Expand all Loading... |
256 | 261 |
257 // An enum corresponding to the allowed string values for the responseType a
ttribute. | 262 // An enum corresponding to the allowed string values for the responseType a
ttribute. |
258 ResponseTypeCode m_responseTypeCode; | 263 ResponseTypeCode m_responseTypeCode; |
259 AsyncMethodRunner<XMLHttpRequest> m_dropProtectionRunner; | 264 AsyncMethodRunner<XMLHttpRequest> m_dropProtectionRunner; |
260 RefPtr<SecurityOrigin> m_securityOrigin; | 265 RefPtr<SecurityOrigin> m_securityOrigin; |
261 }; | 266 }; |
262 | 267 |
263 } // namespace WebCore | 268 } // namespace WebCore |
264 | 269 |
265 #endif // XMLHttpRequest_h | 270 #endif // XMLHttpRequest_h |
OLD | NEW |