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

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: Fix Created 7 years, 4 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
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 EventTarget, private ThreadableLoaderClient, public ActiveDOMObject { 55 class XMLHttpRequest : public ScriptWrappable, public RefCounted<XMLHttpRequest> , public EventTarget, private ThreadableLoaderClient, public ActiveDOMObject {
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 ResponseTypeDocument, 73 ResponseTypeDocument,
73 ResponseTypeBlob, 74 ResponseTypeBlob,
74 ResponseTypeArrayBuffer 75 ResponseTypeArrayBuffer,
76 ResponseTypeStream
75 }; 77 };
76 78
77 virtual void contextDestroyed(); 79 virtual void contextDestroyed();
78 virtual void didTimeout(); 80 virtual void didTimeout();
79 virtual bool canSuspend() const; 81 virtual bool canSuspend() const;
80 virtual void suspend(ReasonForSuspension); 82 virtual void suspend(ReasonForSuspension);
81 virtual void resume(); 83 virtual void resume();
82 virtual void stop(); 84 virtual void stop();
83 85
84 virtual const AtomicString& interfaceName() const; 86 virtual const AtomicString& interfaceName() const;
(...skipping 17 matching lines...) Expand all
102 void send(ArrayBuffer*, ExceptionState&); 104 void send(ArrayBuffer*, ExceptionState&);
103 void send(ArrayBufferView*, ExceptionState&); 105 void send(ArrayBufferView*, ExceptionState&);
104 void abort(); 106 void abort();
105 void setRequestHeader(const AtomicString& name, const String& value, Excepti onState&); 107 void setRequestHeader(const AtomicString& name, const String& value, Excepti onState&);
106 void overrideMimeType(const String& override); 108 void overrideMimeType(const String& override);
107 String getAllResponseHeaders(ExceptionState&) const; 109 String getAllResponseHeaders(ExceptionState&) const;
108 String getResponseHeader(const AtomicString& name, ExceptionState&) const; 110 String getResponseHeader(const AtomicString& name, ExceptionState&) const;
109 ScriptString responseText(ExceptionState&); 111 ScriptString responseText(ExceptionState&);
110 Document* responseXML(ExceptionState&); 112 Document* responseXML(ExceptionState&);
111 Blob* responseBlob(ExceptionState&); 113 Blob* responseBlob(ExceptionState&);
114 Stream* responseStream(ExceptionState&);
112 unsigned long timeout() const { return m_timeoutMilliseconds; } 115 unsigned long timeout() const { return m_timeoutMilliseconds; }
113 void setTimeout(unsigned long timeout, ExceptionState&); 116 void setTimeout(unsigned long timeout, ExceptionState&);
114 117
115 void sendForInspectorXHRReplay(PassRefPtr<FormData>, ExceptionState&); 118 void sendForInspectorXHRReplay(PassRefPtr<FormData>, ExceptionState&);
116 119
117 // Expose HTTP validation methods for other untrusted requests. 120 // Expose HTTP validation methods for other untrusted requests.
118 static bool isAllowedHTTPMethod(const String&); 121 static bool isAllowedHTTPMethod(const String&);
119 static String uppercaseKnownHTTPMethod(const String&); 122 static String uppercaseKnownHTTPMethod(const String&);
120 static bool isAllowedHTTPHeader(const String&); 123 static bool isAllowedHTTPHeader(const String&);
121 124
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 194
192 KURL m_url; 195 KURL m_url;
193 String m_method; 196 String m_method;
194 HTTPHeaderMap m_requestHeaders; 197 HTTPHeaderMap m_requestHeaders;
195 RefPtr<FormData> m_requestEntityBody; 198 RefPtr<FormData> m_requestEntityBody;
196 String m_mimeTypeOverride; 199 String m_mimeTypeOverride;
197 bool m_async; 200 bool m_async;
198 bool m_includeCredentials; 201 bool m_includeCredentials;
199 unsigned long m_timeoutMilliseconds; 202 unsigned long m_timeoutMilliseconds;
200 RefPtr<Blob> m_responseBlob; 203 RefPtr<Blob> m_responseBlob;
204 RefPtr<Stream> m_responseStream;
201 205
202 RefPtr<ThreadableLoader> m_loader; 206 RefPtr<ThreadableLoader> m_loader;
203 State m_state; 207 State m_state;
204 208
205 ResourceResponse m_response; 209 ResourceResponse m_response;
206 String m_responseEncoding; 210 String m_responseEncoding;
207 211
208 RefPtr<TextResourceDecoder> m_decoder; 212 RefPtr<TextResourceDecoder> m_decoder;
209 213
210 ScriptString m_responseText; 214 ScriptString m_responseText;
(...skipping 24 matching lines...) Expand all
235 239
236 // An enum corresponding to the allowed string values for the responseType a ttribute. 240 // An enum corresponding to the allowed string values for the responseType a ttribute.
237 ResponseTypeCode m_responseTypeCode; 241 ResponseTypeCode m_responseTypeCode;
238 Timer<XMLHttpRequest> m_protectionTimer; 242 Timer<XMLHttpRequest> m_protectionTimer;
239 RefPtr<SecurityOrigin> m_securityOrigin; 243 RefPtr<SecurityOrigin> m_securityOrigin;
240 }; 244 };
241 245
242 } // namespace WebCore 246 } // namespace WebCore
243 247
244 #endif // XMLHttpRequest_h 248 #endif // XMLHttpRequest_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698