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

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

Issue 14246006: Implementing timeout support for XHR (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@timeoutResourceHandle
Patch Set: Timeout support in DocumentThreadableLoader (speculative bot failure fix) Created 7 years, 6 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
« no previous file with comments | « Source/core/loader/ThreadableLoader.h ('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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 65
66 enum ResponseTypeCode { 66 enum ResponseTypeCode {
67 ResponseTypeDefault, 67 ResponseTypeDefault,
68 ResponseTypeText, 68 ResponseTypeText,
69 ResponseTypeDocument, 69 ResponseTypeDocument,
70 ResponseTypeBlob, 70 ResponseTypeBlob,
71 ResponseTypeArrayBuffer 71 ResponseTypeArrayBuffer
72 }; 72 };
73 73
74 virtual void contextDestroyed(); 74 virtual void contextDestroyed();
75 #if ENABLE(XHR_TIMEOUT)
76 virtual void didTimeout(); 75 virtual void didTimeout();
77 #endif
78 virtual bool canSuspend() const; 76 virtual bool canSuspend() const;
79 virtual void suspend(ReasonForSuspension); 77 virtual void suspend(ReasonForSuspension);
80 virtual void resume(); 78 virtual void resume();
81 virtual void stop(); 79 virtual void stop();
82 80
83 virtual const AtomicString& interfaceName() const; 81 virtual const AtomicString& interfaceName() const;
84 virtual ScriptExecutionContext* scriptExecutionContext() const; 82 virtual ScriptExecutionContext* scriptExecutionContext() const;
85 83
86 const KURL& url() const { return m_url; } 84 const KURL& url() const { return m_url; }
87 String statusText(ExceptionCode&) const; 85 String statusText(ExceptionCode&) const;
(...skipping 15 matching lines...) Expand all
103 void abort(); 101 void abort();
104 void setRequestHeader(const AtomicString& name, const String& value, Excepti onCode&); 102 void setRequestHeader(const AtomicString& name, const String& value, Excepti onCode&);
105 void overrideMimeType(const String& override); 103 void overrideMimeType(const String& override);
106 String getAllResponseHeaders(ExceptionCode&) const; 104 String getAllResponseHeaders(ExceptionCode&) const;
107 String getResponseHeader(const AtomicString& name, ExceptionCode&) const; 105 String getResponseHeader(const AtomicString& name, ExceptionCode&) const;
108 ScriptString responseText(ExceptionCode&); 106 ScriptString responseText(ExceptionCode&);
109 Document* responseXML(ExceptionCode&); 107 Document* responseXML(ExceptionCode&);
110 Document* optionalResponseXML() const { return m_responseDocument.get(); } 108 Document* optionalResponseXML() const { return m_responseDocument.get(); }
111 Blob* responseBlob(ExceptionCode&); 109 Blob* responseBlob(ExceptionCode&);
112 Blob* optionalResponseBlob() const { return m_responseBlob.get(); } 110 Blob* optionalResponseBlob() const { return m_responseBlob.get(); }
113 #if ENABLE(XHR_TIMEOUT)
114 unsigned long timeout() const { return m_timeoutMilliseconds; } 111 unsigned long timeout() const { return m_timeoutMilliseconds; }
115 void setTimeout(unsigned long timeout, ExceptionCode&); 112 void setTimeout(unsigned long timeout, ExceptionCode&);
116 #endif
117 113
118 void sendForInspector(ExceptionCode&); 114 void sendForInspector(ExceptionCode&);
119 void sendForInspectorXHRReplay(PassRefPtr<FormData>, ExceptionCode&); 115 void sendForInspectorXHRReplay(PassRefPtr<FormData>, ExceptionCode&);
120 116
121 // Expose HTTP validation methods for other untrusted requests. 117 // Expose HTTP validation methods for other untrusted requests.
122 static bool isAllowedHTTPMethod(const String&); 118 static bool isAllowedHTTPMethod(const String&);
123 static String uppercaseKnownHTTPMethod(const String&); 119 static String uppercaseKnownHTTPMethod(const String&);
124 static bool isAllowedHTTPHeader(const String&); 120 static bool isAllowedHTTPHeader(const String&);
125 121
126 void setResponseType(const String&, ExceptionCode&); 122 void setResponseType(const String&, ExceptionCode&);
(...skipping 12 matching lines...) Expand all
139 135
140 virtual void reportMemoryUsage(MemoryObjectInfo*) const; 136 virtual void reportMemoryUsage(MemoryObjectInfo*) const;
141 137
142 DEFINE_ATTRIBUTE_EVENT_LISTENER(readystatechange); 138 DEFINE_ATTRIBUTE_EVENT_LISTENER(readystatechange);
143 DEFINE_ATTRIBUTE_EVENT_LISTENER(abort); 139 DEFINE_ATTRIBUTE_EVENT_LISTENER(abort);
144 DEFINE_ATTRIBUTE_EVENT_LISTENER(error); 140 DEFINE_ATTRIBUTE_EVENT_LISTENER(error);
145 DEFINE_ATTRIBUTE_EVENT_LISTENER(load); 141 DEFINE_ATTRIBUTE_EVENT_LISTENER(load);
146 DEFINE_ATTRIBUTE_EVENT_LISTENER(loadend); 142 DEFINE_ATTRIBUTE_EVENT_LISTENER(loadend);
147 DEFINE_ATTRIBUTE_EVENT_LISTENER(loadstart); 143 DEFINE_ATTRIBUTE_EVENT_LISTENER(loadstart);
148 DEFINE_ATTRIBUTE_EVENT_LISTENER(progress); 144 DEFINE_ATTRIBUTE_EVENT_LISTENER(progress);
149 #if ENABLE(XHR_TIMEOUT)
150 DEFINE_ATTRIBUTE_EVENT_LISTENER(timeout); 145 DEFINE_ATTRIBUTE_EVENT_LISTENER(timeout);
151 #endif
152 146
153 using RefCounted<XMLHttpRequest>::ref; 147 using RefCounted<XMLHttpRequest>::ref;
154 using RefCounted<XMLHttpRequest>::deref; 148 using RefCounted<XMLHttpRequest>::deref;
155 149
156 private: 150 private:
157 XMLHttpRequest(ScriptExecutionContext*, PassRefPtr<SecurityOrigin>); 151 XMLHttpRequest(ScriptExecutionContext*, PassRefPtr<SecurityOrigin>);
158 152
159 virtual void refEventTarget() { ref(); } 153 virtual void refEventTarget() { ref(); }
160 virtual void derefEventTarget() { deref(); } 154 virtual void derefEventTarget() { deref(); }
161 virtual EventTargetData* eventTargetData(); 155 virtual EventTargetData* eventTargetData();
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 191
198 OwnPtr<XMLHttpRequestUpload> m_upload; 192 OwnPtr<XMLHttpRequestUpload> m_upload;
199 193
200 KURL m_url; 194 KURL m_url;
201 String m_method; 195 String m_method;
202 HTTPHeaderMap m_requestHeaders; 196 HTTPHeaderMap m_requestHeaders;
203 RefPtr<FormData> m_requestEntityBody; 197 RefPtr<FormData> m_requestEntityBody;
204 String m_mimeTypeOverride; 198 String m_mimeTypeOverride;
205 bool m_async; 199 bool m_async;
206 bool m_includeCredentials; 200 bool m_includeCredentials;
207 #if ENABLE(XHR_TIMEOUT)
208 unsigned long m_timeoutMilliseconds; 201 unsigned long m_timeoutMilliseconds;
209 #endif
210 RefPtr<Blob> m_responseBlob; 202 RefPtr<Blob> m_responseBlob;
211 203
212 RefPtr<ThreadableLoader> m_loader; 204 RefPtr<ThreadableLoader> m_loader;
213 State m_state; 205 State m_state;
214 206
215 ResourceResponse m_response; 207 ResourceResponse m_response;
216 String m_responseEncoding; 208 String m_responseEncoding;
217 209
218 RefPtr<TextResourceDecoder> m_decoder; 210 RefPtr<TextResourceDecoder> m_decoder;
219 211
(...skipping 25 matching lines...) Expand all
245 237
246 // An enum corresponding to the allowed string values for the responseType a ttribute. 238 // An enum corresponding to the allowed string values for the responseType a ttribute.
247 ResponseTypeCode m_responseTypeCode; 239 ResponseTypeCode m_responseTypeCode;
248 Timer<XMLHttpRequest> m_protectionTimer; 240 Timer<XMLHttpRequest> m_protectionTimer;
249 RefPtr<SecurityOrigin> m_securityOrigin; 241 RefPtr<SecurityOrigin> m_securityOrigin;
250 }; 242 };
251 243
252 } // namespace WebCore 244 } // namespace WebCore
253 245
254 #endif // XMLHttpRequest_h 246 #endif // XMLHttpRequest_h
OLDNEW
« no previous file with comments | « Source/core/loader/ThreadableLoader.h ('k') | Source/core/xml/XMLHttpRequest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698