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

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: Created 7 years, 5 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 27 matching lines...) Expand all
38 #include "wtf/text/StringBuilder.h" 38 #include "wtf/text/StringBuilder.h"
39 39
40 namespace WebCore { 40 namespace WebCore {
41 41
42 class Blob; 42 class Blob;
43 class Document; 43 class Document;
44 class DOMFormData; 44 class DOMFormData;
45 class ResourceRequest; 45 class ResourceRequest;
46 class SecurityOrigin; 46 class SecurityOrigin;
47 class SharedBuffer; 47 class SharedBuffer;
48 class Stream;
48 class TextResourceDecoder; 49 class TextResourceDecoder;
49 class ThreadableLoader; 50 class ThreadableLoader;
50 51
51 class XMLHttpRequest : public ScriptWrappable, public RefCounted<XMLHttpRequest> , public EventTarget, private ThreadableLoaderClient, public ActiveDOMObject { 52 class XMLHttpRequest : public ScriptWrappable, public RefCounted<XMLHttpRequest> , public EventTarget, private ThreadableLoaderClient, public ActiveDOMObject {
52 WTF_MAKE_FAST_ALLOCATED; 53 WTF_MAKE_FAST_ALLOCATED;
53 public: 54 public:
54 static PassRefPtr<XMLHttpRequest> create(ScriptExecutionContext*, PassRefPtr <SecurityOrigin> = 0); 55 static PassRefPtr<XMLHttpRequest> create(ScriptExecutionContext*, PassRefPtr <SecurityOrigin> = 0);
55 ~XMLHttpRequest(); 56 ~XMLHttpRequest();
56 57
57 // These exact numeric values are important because JS expects them. 58 // These exact numeric values are important because JS expects them.
58 enum State { 59 enum State {
59 UNSENT = 0, 60 UNSENT = 0,
60 OPENED = 1, 61 OPENED = 1,
61 HEADERS_RECEIVED = 2, 62 HEADERS_RECEIVED = 2,
62 LOADING = 3, 63 LOADING = 3,
63 DONE = 4 64 DONE = 4
64 }; 65 };
65 66
66 enum ResponseTypeCode { 67 enum ResponseTypeCode {
67 ResponseTypeDefault, 68 ResponseTypeDefault,
68 ResponseTypeText, 69 ResponseTypeText,
69 ResponseTypeDocument, 70 ResponseTypeDocument,
70 ResponseTypeBlob, 71 ResponseTypeBlob,
71 ResponseTypeArrayBuffer 72 ResponseTypeArrayBuffer,
73 ResponseTypeStream
72 }; 74 };
73 75
74 virtual void contextDestroyed(); 76 virtual void contextDestroyed();
75 virtual void didTimeout(); 77 virtual void didTimeout();
76 virtual bool canSuspend() const; 78 virtual bool canSuspend() const;
77 virtual void suspend(ReasonForSuspension); 79 virtual void suspend(ReasonForSuspension);
78 virtual void resume(); 80 virtual void resume();
79 virtual void stop(); 81 virtual void stop();
80 82
81 virtual const AtomicString& interfaceName() const; 83 virtual const AtomicString& interfaceName() const;
(...skipping 19 matching lines...) Expand all
101 void abort(); 103 void abort();
102 void setRequestHeader(const AtomicString& name, const String& value, Excepti onCode&); 104 void setRequestHeader(const AtomicString& name, const String& value, Excepti onCode&);
103 void overrideMimeType(const String& override); 105 void overrideMimeType(const String& override);
104 String getAllResponseHeaders(ExceptionCode&) const; 106 String getAllResponseHeaders(ExceptionCode&) const;
105 String getResponseHeader(const AtomicString& name, ExceptionCode&) const; 107 String getResponseHeader(const AtomicString& name, ExceptionCode&) const;
106 ScriptString responseText(ExceptionCode&); 108 ScriptString responseText(ExceptionCode&);
107 Document* responseXML(ExceptionCode&); 109 Document* responseXML(ExceptionCode&);
108 Document* optionalResponseXML() const { return m_responseDocument.get(); } 110 Document* optionalResponseXML() const { return m_responseDocument.get(); }
109 Blob* responseBlob(ExceptionCode&); 111 Blob* responseBlob(ExceptionCode&);
110 Blob* optionalResponseBlob() const { return m_responseBlob.get(); } 112 Blob* optionalResponseBlob() const { return m_responseBlob.get(); }
113 Stream* responseStream(ExceptionCode&);
111 unsigned long timeout() const { return m_timeoutMilliseconds; } 114 unsigned long timeout() const { return m_timeoutMilliseconds; }
112 void setTimeout(unsigned long timeout, ExceptionCode&); 115 void setTimeout(unsigned long timeout, ExceptionCode&);
113 116
114 void sendForInspectorXHRReplay(PassRefPtr<FormData>, ExceptionCode&); 117 void sendForInspectorXHRReplay(PassRefPtr<FormData>, ExceptionCode&);
115 118
116 // Expose HTTP validation methods for other untrusted requests. 119 // Expose HTTP validation methods for other untrusted requests.
117 static bool isAllowedHTTPMethod(const String&); 120 static bool isAllowedHTTPMethod(const String&);
118 static String uppercaseKnownHTTPMethod(const String&); 121 static String uppercaseKnownHTTPMethod(const String&);
119 static bool isAllowedHTTPHeader(const String&); 122 static bool isAllowedHTTPHeader(const String&);
120 123
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 195
193 KURL m_url; 196 KURL m_url;
194 String m_method; 197 String m_method;
195 HTTPHeaderMap m_requestHeaders; 198 HTTPHeaderMap m_requestHeaders;
196 RefPtr<FormData> m_requestEntityBody; 199 RefPtr<FormData> m_requestEntityBody;
197 String m_mimeTypeOverride; 200 String m_mimeTypeOverride;
198 bool m_async; 201 bool m_async;
199 bool m_includeCredentials; 202 bool m_includeCredentials;
200 unsigned long m_timeoutMilliseconds; 203 unsigned long m_timeoutMilliseconds;
201 RefPtr<Blob> m_responseBlob; 204 RefPtr<Blob> m_responseBlob;
205 RefPtr<Stream> m_responseStream;
202 206
203 RefPtr<ThreadableLoader> m_loader; 207 RefPtr<ThreadableLoader> m_loader;
204 State m_state; 208 State m_state;
205 209
206 ResourceResponse m_response; 210 ResourceResponse m_response;
207 String m_responseEncoding; 211 String m_responseEncoding;
208 212
209 RefPtr<TextResourceDecoder> m_decoder; 213 RefPtr<TextResourceDecoder> m_decoder;
210 214
211 ScriptString m_responseText; 215 ScriptString m_responseText;
(...skipping 24 matching lines...) Expand all
236 240
237 // An enum corresponding to the allowed string values for the responseType a ttribute. 241 // An enum corresponding to the allowed string values for the responseType a ttribute.
238 ResponseTypeCode m_responseTypeCode; 242 ResponseTypeCode m_responseTypeCode;
239 Timer<XMLHttpRequest> m_protectionTimer; 243 Timer<XMLHttpRequest> m_protectionTimer;
240 RefPtr<SecurityOrigin> m_securityOrigin; 244 RefPtr<SecurityOrigin> m_securityOrigin;
241 }; 245 };
242 246
243 } // namespace WebCore 247 } // namespace WebCore
244 248
245 #endif // XMLHttpRequest_h 249 #endif // XMLHttpRequest_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698