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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 class SecurityOrigin; | 48 class SecurityOrigin; |
49 class SharedBuffer; | 49 class SharedBuffer; |
50 class Stream; | 50 class Stream; |
51 class TextResourceDecoder; | 51 class TextResourceDecoder; |
52 class ThreadableLoader; | 52 class ThreadableLoader; |
53 | 53 |
54 typedef int ExceptionCode; | 54 typedef int ExceptionCode; |
55 | 55 |
56 class XMLHttpRequest FINAL : public RefCountedWillBeRefCountedGarbageCollected<X
MLHttpRequest>, public ScriptWrappable, public XMLHttpRequestEventTarget, privat
e ThreadableLoaderClient, public ActiveDOMObject { | 56 class XMLHttpRequest FINAL : public RefCountedWillBeRefCountedGarbageCollected<X
MLHttpRequest>, public ScriptWrappable, public XMLHttpRequestEventTarget, privat
e ThreadableLoaderClient, public ActiveDOMObject { |
57 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED; | 57 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED; |
58 DEFINE_EVENT_TARGET_REFCOUNTING(RefCountedWillBeRefCountedGarbageCollected<X
MLHttpRequest>); | 58 REFCOUNTED_EVENT_TARGET(XMLHttpRequest); |
| 59 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(XMLHttpRequest); |
59 public: | 60 public: |
60 static PassRefPtrWillBeRawPtr<XMLHttpRequest> create(ExecutionContext*, Pass
RefPtr<SecurityOrigin> = nullptr); | 61 static PassRefPtrWillBeRawPtr<XMLHttpRequest> create(ExecutionContext*, Pass
RefPtr<SecurityOrigin> = nullptr); |
61 virtual ~XMLHttpRequest(); | 62 virtual ~XMLHttpRequest(); |
62 | 63 |
63 // These exact numeric values are important because JS expects them. | 64 // These exact numeric values are important because JS expects them. |
64 enum State { | 65 enum State { |
65 UNSENT = 0, | 66 UNSENT = 0, |
66 OPENED = 1, | 67 OPENED = 1, |
67 HEADERS_RECEIVED = 2, | 68 HEADERS_RECEIVED = 2, |
68 LOADING = 3, | 69 LOADING = 3, |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 // response attribute has custom getter. | 137 // response attribute has custom getter. |
137 ArrayBuffer* responseArrayBuffer(); | 138 ArrayBuffer* responseArrayBuffer(); |
138 | 139 |
139 void setLastSendLineNumber(unsigned lineNumber) { m_lastSendLineNumber = lin
eNumber; } | 140 void setLastSendLineNumber(unsigned lineNumber) { m_lastSendLineNumber = lin
eNumber; } |
140 void setLastSendURL(const String& url) { m_lastSendURL = url; } | 141 void setLastSendURL(const String& url) { m_lastSendURL = url; } |
141 | 142 |
142 XMLHttpRequestUpload* upload(); | 143 XMLHttpRequestUpload* upload(); |
143 | 144 |
144 DEFINE_ATTRIBUTE_EVENT_LISTENER(readystatechange); | 145 DEFINE_ATTRIBUTE_EVENT_LISTENER(readystatechange); |
145 | 146 |
146 void trace(Visitor*); | 147 virtual void trace(Visitor*) OVERRIDE; |
147 | 148 |
148 private: | 149 private: |
149 XMLHttpRequest(ExecutionContext*, PassRefPtr<SecurityOrigin>); | 150 XMLHttpRequest(ExecutionContext*, PassRefPtr<SecurityOrigin>); |
150 | 151 |
151 Document* document() const; | 152 Document* document() const; |
152 SecurityOrigin* securityOrigin() const; | 153 SecurityOrigin* securityOrigin() const; |
153 | 154 |
154 virtual void didSendData(unsigned long long bytesSent, unsigned long long to
talBytesToBeSent) OVERRIDE; | 155 virtual void didSendData(unsigned long long bytesSent, unsigned long long to
talBytesToBeSent) OVERRIDE; |
155 virtual void didReceiveResponse(unsigned long identifier, const ResourceResp
onse&) OVERRIDE; | 156 virtual void didReceiveResponse(unsigned long identifier, const ResourceResp
onse&) OVERRIDE; |
156 virtual void didReceiveData(const char* data, int dataLength) OVERRIDE; | 157 virtual void didReceiveData(const char* data, int dataLength) OVERRIDE; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 void handleDidFailGeneric(); | 202 void handleDidFailGeneric(); |
202 // Handles didFail() call not caused by cancellation or timeout. | 203 // Handles didFail() call not caused by cancellation or timeout. |
203 void handleNetworkError(); | 204 void handleNetworkError(); |
204 // Handles didFail() call triggered by m_loader->cancel(). | 205 // Handles didFail() call triggered by m_loader->cancel(). |
205 void handleDidCancel(); | 206 void handleDidCancel(); |
206 // Handles didFail() call for timeout. | 207 // Handles didFail() call for timeout. |
207 void handleDidTimeout(); | 208 void handleDidTimeout(); |
208 | 209 |
209 void handleRequestError(ExceptionCode, const AtomicString&, long long, long
long); | 210 void handleRequestError(ExceptionCode, const AtomicString&, long long, long
long); |
210 | 211 |
211 OwnPtr<XMLHttpRequestUpload> m_upload; | 212 OwnPtrWillBeMember<XMLHttpRequestUpload> m_upload; |
212 | 213 |
213 KURL m_url; | 214 KURL m_url; |
214 AtomicString m_method; | 215 AtomicString m_method; |
215 HTTPHeaderMap m_requestHeaders; | 216 HTTPHeaderMap m_requestHeaders; |
216 RefPtr<FormData> m_requestEntityBody; | 217 RefPtr<FormData> m_requestEntityBody; |
217 AtomicString m_mimeTypeOverride; | 218 AtomicString m_mimeTypeOverride; |
218 bool m_async; | 219 bool m_async; |
219 bool m_includeCredentials; | 220 bool m_includeCredentials; |
220 unsigned long m_timeoutMilliseconds; | 221 unsigned long m_timeoutMilliseconds; |
221 RefPtrWillBeMember<Blob> m_responseBlob; | 222 RefPtrWillBeMember<Blob> m_responseBlob; |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 | 260 |
260 // An enum corresponding to the allowed string values for the responseType a
ttribute. | 261 // An enum corresponding to the allowed string values for the responseType a
ttribute. |
261 ResponseTypeCode m_responseTypeCode; | 262 ResponseTypeCode m_responseTypeCode; |
262 AsyncMethodRunner<XMLHttpRequest> m_dropProtectionRunner; | 263 AsyncMethodRunner<XMLHttpRequest> m_dropProtectionRunner; |
263 RefPtr<SecurityOrigin> m_securityOrigin; | 264 RefPtr<SecurityOrigin> m_securityOrigin; |
264 }; | 265 }; |
265 | 266 |
266 } // namespace WebCore | 267 } // namespace WebCore |
267 | 268 |
268 #endif // XMLHttpRequest_h | 269 #endif // XMLHttpRequest_h |
OLD | NEW |