Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(141)

Side by Side Diff: Source/core/xml/XMLHttpRequest.h

Issue 18883002: Add Streams API support to XMLHttpRequest (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: kinuko's comment Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/fileapi/Stream.cpp ('k') | Source/core/xml/XMLHttpRequest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 28 matching lines...) Expand all
39 39
40 namespace WebCore { 40 namespace WebCore {
41 41
42 class Blob; 42 class Blob;
43 class DOMFormData; 43 class DOMFormData;
44 class Document; 44 class Document;
45 class ExceptionState; 45 class ExceptionState;
46 class ResourceRequest; 46 class ResourceRequest;
47 class SecurityOrigin; 47 class SecurityOrigin;
48 class SharedBuffer; 48 class SharedBuffer;
49 class Stream;
49 class TextResourceDecoder; 50 class TextResourceDecoder;
50 class ThreadableLoader; 51 class ThreadableLoader;
51 52
52 typedef int ExceptionCode; 53 typedef int ExceptionCode;
53 54
54 class XMLHttpRequest : public ScriptWrappable, public RefCounted<XMLHttpRequest> , public XMLHttpRequestEventTarget, private ThreadableLoaderClient, public Activ eDOMObject { 55 class XMLHttpRequest : public ScriptWrappable, public RefCounted<XMLHttpRequest> , public XMLHttpRequestEventTarget, private ThreadableLoaderClient, public Activ eDOMObject {
55 WTF_MAKE_FAST_ALLOCATED; 56 WTF_MAKE_FAST_ALLOCATED;
56 public: 57 public:
57 static PassRefPtr<XMLHttpRequest> create(ScriptExecutionContext*, PassRefPtr <SecurityOrigin> = 0); 58 static PassRefPtr<XMLHttpRequest> create(ScriptExecutionContext*, PassRefPtr <SecurityOrigin> = 0);
58 ~XMLHttpRequest(); 59 ~XMLHttpRequest();
59 60
60 // These exact numeric values are important because JS expects them. 61 // These exact numeric values are important because JS expects them.
61 enum State { 62 enum State {
62 UNSENT = 0, 63 UNSENT = 0,
63 OPENED = 1, 64 OPENED = 1,
64 HEADERS_RECEIVED = 2, 65 HEADERS_RECEIVED = 2,
65 LOADING = 3, 66 LOADING = 3,
66 DONE = 4 67 DONE = 4
67 }; 68 };
68 69
69 enum ResponseTypeCode { 70 enum ResponseTypeCode {
70 ResponseTypeDefault, 71 ResponseTypeDefault,
71 ResponseTypeText, 72 ResponseTypeText,
72 ResponseTypeJSON, 73 ResponseTypeJSON,
73 ResponseTypeDocument, 74 ResponseTypeDocument,
74 ResponseTypeBlob, 75 ResponseTypeBlob,
75 ResponseTypeArrayBuffer 76 ResponseTypeArrayBuffer,
77 ResponseTypeStream
76 }; 78 };
77 79
78 enum DropProtection { 80 enum DropProtection {
79 DropProtectionSync, 81 DropProtectionSync,
80 DropProtectionAsync, 82 DropProtectionAsync,
81 }; 83 };
82 84
83 virtual void contextDestroyed(); 85 virtual void contextDestroyed();
84 virtual void didTimeout(); 86 virtual void didTimeout();
85 virtual bool canSuspend() const; 87 virtual bool canSuspend() const;
(...skipping 23 matching lines...) Expand all
109 void send(ArrayBufferView*, ExceptionState&); 111 void send(ArrayBufferView*, ExceptionState&);
110 void abort(); 112 void abort();
111 void setRequestHeader(const AtomicString& name, const String& value, Excepti onState&); 113 void setRequestHeader(const AtomicString& name, const String& value, Excepti onState&);
112 void overrideMimeType(const String& override); 114 void overrideMimeType(const String& override);
113 String getAllResponseHeaders(ExceptionState&) const; 115 String getAllResponseHeaders(ExceptionState&) const;
114 String getResponseHeader(const AtomicString& name, ExceptionState&) const; 116 String getResponseHeader(const AtomicString& name, ExceptionState&) const;
115 ScriptString responseText(ExceptionState&); 117 ScriptString responseText(ExceptionState&);
116 ScriptString responseJSONSource(); 118 ScriptString responseJSONSource();
117 Document* responseXML(ExceptionState&); 119 Document* responseXML(ExceptionState&);
118 Blob* responseBlob(); 120 Blob* responseBlob();
121 Stream* responseStream();
119 unsigned long timeout() const { return m_timeoutMilliseconds; } 122 unsigned long timeout() const { return m_timeoutMilliseconds; }
120 void setTimeout(unsigned long timeout, ExceptionState&); 123 void setTimeout(unsigned long timeout, ExceptionState&);
121 124
122 void sendForInspectorXHRReplay(PassRefPtr<FormData>, ExceptionState&); 125 void sendForInspectorXHRReplay(PassRefPtr<FormData>, ExceptionState&);
123 126
124 // Expose HTTP validation methods for other untrusted requests. 127 // Expose HTTP validation methods for other untrusted requests.
125 static bool isAllowedHTTPMethod(const String&); 128 static bool isAllowedHTTPMethod(const String&);
126 static String uppercaseKnownHTTPMethod(const String&); 129 static String uppercaseKnownHTTPMethod(const String&);
127 static bool isAllowedHTTPHeader(const String&); 130 static bool isAllowedHTTPHeader(const String&);
128 131
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 192
190 KURL m_url; 193 KURL m_url;
191 String m_method; 194 String m_method;
192 HTTPHeaderMap m_requestHeaders; 195 HTTPHeaderMap m_requestHeaders;
193 RefPtr<FormData> m_requestEntityBody; 196 RefPtr<FormData> m_requestEntityBody;
194 String m_mimeTypeOverride; 197 String m_mimeTypeOverride;
195 bool m_async; 198 bool m_async;
196 bool m_includeCredentials; 199 bool m_includeCredentials;
197 unsigned long m_timeoutMilliseconds; 200 unsigned long m_timeoutMilliseconds;
198 RefPtr<Blob> m_responseBlob; 201 RefPtr<Blob> m_responseBlob;
202 RefPtr<Stream> m_responseStream;
199 203
200 RefPtr<ThreadableLoader> m_loader; 204 RefPtr<ThreadableLoader> m_loader;
201 State m_state; 205 State m_state;
202 206
203 ResourceResponse m_response; 207 ResourceResponse m_response;
204 String m_responseEncoding; 208 String m_responseEncoding;
205 209
206 RefPtr<TextResourceDecoder> m_decoder; 210 RefPtr<TextResourceDecoder> m_decoder;
207 211
208 ScriptString m_responseText; 212 ScriptString m_responseText;
(...skipping 22 matching lines...) Expand all
231 235
232 // An enum corresponding to the allowed string values for the responseType a ttribute. 236 // An enum corresponding to the allowed string values for the responseType a ttribute.
233 ResponseTypeCode m_responseTypeCode; 237 ResponseTypeCode m_responseTypeCode;
234 Timer<XMLHttpRequest> m_protectionTimer; 238 Timer<XMLHttpRequest> m_protectionTimer;
235 RefPtr<SecurityOrigin> m_securityOrigin; 239 RefPtr<SecurityOrigin> m_securityOrigin;
236 }; 240 };
237 241
238 } // namespace WebCore 242 } // namespace WebCore
239 243
240 #endif // XMLHttpRequest_h 244 #endif // XMLHttpRequest_h
OLDNEW
« no previous file with comments | « Source/core/fileapi/Stream.cpp ('k') | Source/core/xml/XMLHttpRequest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698