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

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

Issue 346033003: [XHR] Move bools to end of class declaration for better padding (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 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 | « no previous file | Source/core/xml/XMLHttpRequest.cpp » ('j') | Source/core/xml/XMLHttpRequest.cpp » ('J')
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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 virtual void resume() OVERRIDE; 95 virtual void resume() OVERRIDE;
96 virtual void stop() OVERRIDE; 96 virtual void stop() OVERRIDE;
97 97
98 virtual const AtomicString& interfaceName() const OVERRIDE; 98 virtual const AtomicString& interfaceName() const OVERRIDE;
99 virtual ExecutionContext* executionContext() const OVERRIDE; 99 virtual ExecutionContext* executionContext() const OVERRIDE;
100 100
101 const KURL& url() const { return m_url; } 101 const KURL& url() const { return m_url; }
102 String statusText() const; 102 String statusText() const;
103 int status() const; 103 int status() const;
104 State readyState() const; 104 State readyState() const;
105 bool withCredentials() const { return m_includeCredentials; } 105 bool withCredentials() const { return getFlag(IsWithCredentials); }
106 void setWithCredentials(bool, ExceptionState&); 106 void setWithCredentials(bool, ExceptionState&);
107 void open(const AtomicString& method, const KURL&, ExceptionState&); 107 void open(const AtomicString& method, const KURL&, ExceptionState&);
108 void open(const AtomicString& method, const KURL&, bool async, ExceptionStat e&); 108 void open(const AtomicString& method, const KURL&, bool async, ExceptionStat e&);
109 void open(const AtomicString& method, const KURL&, bool async, const String& user, ExceptionState&); 109 void open(const AtomicString& method, const KURL&, bool async, const String& user, ExceptionState&);
110 void open(const AtomicString& method, const KURL&, bool async, const String& user, const String& password, ExceptionState&); 110 void open(const AtomicString& method, const KURL&, bool async, const String& user, const String& password, ExceptionState&);
111 void send(ExceptionState&); 111 void send(ExceptionState&);
112 void send(Document*, ExceptionState&); 112 void send(Document*, ExceptionState&);
113 void send(const String&, ExceptionState&); 113 void send(const String&, ExceptionState&);
114 void send(Blob*, ExceptionState&); 114 void send(Blob*, ExceptionState&);
115 void send(DOMFormData*, ExceptionState&); 115 void send(DOMFormData*, ExceptionState&);
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 DEFINE_ATTRIBUTE_EVENT_LISTENER(readystatechange); 152 DEFINE_ATTRIBUTE_EVENT_LISTENER(readystatechange);
153 153
154 virtual void trace(Visitor*) OVERRIDE; 154 virtual void trace(Visitor*) OVERRIDE;
155 155
156 private: 156 private:
157 XMLHttpRequest(ExecutionContext*, PassRefPtr<SecurityOrigin>); 157 XMLHttpRequest(ExecutionContext*, PassRefPtr<SecurityOrigin>);
158 158
159 Document* document() const; 159 Document* document() const;
160 SecurityOrigin* securityOrigin() const; 160 SecurityOrigin* securityOrigin() const;
161 161
162 enum XMLHttpRequestFlags {
163 IsAsync = 1,
164 IsWithCredentials = 1 << 1,
Inactive 2014/06/21 00:40:41 Maybe just "WithCredentials"?
maheshkk 2014/06/23 18:32:16 Done.
165 IsDocumentCreated = 1 << 2,
166 HasError = 1 << 3,
167 IsUploadEventsAllowed = 1 << 4,
168 IsUploadComplete = 1 << 5,
169 IsSameOriginRequest = 1 << 6
170 // 1 bit remainig. If added more then increase the size of m_xhrFlags.
Inactive 2014/06/21 00:40:41 typo: "remaining"
maheshkk 2014/06/23 18:32:16 Done.
171 };
172
173 inline bool getFlag (XMLHttpRequestFlags mask) const { return m_xhrFlags & m ask; }
Inactive 2014/06/21 00:40:41 nit: extra space after getFlag. "inline" is redund
maheshkk 2014/06/23 18:32:16 Done.
174 inline void setFlag(XMLHttpRequestFlags mask) { m_xhrFlags |= mask; }
175 inline void setFlag(bool f, XMLHttpRequestFlags mask) { m_xhrFlags = (m_xhrF lags & ~mask) | (-(int8_t)f & mask); }
176 inline void clearFlag(XMLHttpRequestFlags mask) { m_xhrFlags &= ~mask; }
177
162 virtual void didSendData(unsigned long long bytesSent, unsigned long long to talBytesToBeSent) OVERRIDE; 178 virtual void didSendData(unsigned long long bytesSent, unsigned long long to talBytesToBeSent) OVERRIDE;
163 virtual void didReceiveResponse(unsigned long identifier, const ResourceResp onse&) OVERRIDE; 179 virtual void didReceiveResponse(unsigned long identifier, const ResourceResp onse&) OVERRIDE;
164 virtual void didReceiveData(const char* data, int dataLength) OVERRIDE; 180 virtual void didReceiveData(const char* data, int dataLength) OVERRIDE;
165 // When responseType is set to "blob", didDownloadData() is called instead 181 // When responseType is set to "blob", didDownloadData() is called instead
166 // of didReceiveData(). 182 // of didReceiveData().
167 virtual void didDownloadData(int dataLength) OVERRIDE; 183 virtual void didDownloadData(int dataLength) OVERRIDE;
168 virtual void didFinishLoading(unsigned long identifier, double finishTime) O VERRIDE; 184 virtual void didFinishLoading(unsigned long identifier, double finishTime) O VERRIDE;
169 virtual void didFail(const ResourceError&) OVERRIDE; 185 virtual void didFail(const ResourceError&) OVERRIDE;
170 virtual void didFailRedirectCheck() OVERRIDE; 186 virtual void didFailRedirectCheck() OVERRIDE;
171 187
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 void handleNetworkError(); 226 void handleNetworkError();
211 // Handles didFail() call triggered by m_loader->cancel(). 227 // Handles didFail() call triggered by m_loader->cancel().
212 void handleDidCancel(); 228 void handleDidCancel();
213 // Handles didFail() call for timeout. 229 // Handles didFail() call for timeout.
214 void handleDidTimeout(); 230 void handleDidTimeout();
215 231
216 void handleRequestError(ExceptionCode, const AtomicString&, long long, long long); 232 void handleRequestError(ExceptionCode, const AtomicString&, long long, long long);
217 233
218 OwnPtrWillBeMember<XMLHttpRequestUpload> m_upload; 234 OwnPtrWillBeMember<XMLHttpRequestUpload> m_upload;
219 235
236 u_int8_t m_xhrFlags;
Inactive 2014/06/21 00:40:41 I think we usually use "uint8_t".
Inactive 2014/06/21 00:51:20 Also, considering the small number of flags, I thi
maheshkk 2014/06/21 01:58:41 As flags are less than 8, I think you are right. I
maheshkk 2014/06/23 18:32:16 Done.
220 KURL m_url; 237 KURL m_url;
221 AtomicString m_method; 238 AtomicString m_method;
222 HTTPHeaderMap m_requestHeaders; 239 HTTPHeaderMap m_requestHeaders;
223 AtomicString m_mimeTypeOverride; 240 AtomicString m_mimeTypeOverride;
224 bool m_async;
225 bool m_includeCredentials;
226 unsigned long m_timeoutMilliseconds; 241 unsigned long m_timeoutMilliseconds;
227 RefPtrWillBeMember<Blob> m_responseBlob; 242 RefPtrWillBeMember<Blob> m_responseBlob;
228 RefPtrWillBeMember<Stream> m_responseStream; 243 RefPtrWillBeMember<Stream> m_responseStream;
229 244
230 RefPtr<ThreadableLoader> m_loader; 245 RefPtr<ThreadableLoader> m_loader;
231 State m_state; 246 State m_state;
232 247
233 ResourceResponse m_response; 248 ResourceResponse m_response;
234 String m_responseEncoding; 249 String m_responseEncoding;
235 250
236 OwnPtr<TextResourceDecoder> m_decoder; 251 OwnPtr<TextResourceDecoder> m_decoder;
237 252
238 ScriptString m_responseText; 253 ScriptString m_responseText;
239 // Used to skip m_responseDocument creation if it's done previously. We need
240 // this separate flag since m_responseDocument can be 0 for some cases.
241 bool m_createdDocument;
242 RefPtrWillBeMember<Document> m_responseDocument; 254 RefPtrWillBeMember<Document> m_responseDocument;
243 255
244 RefPtr<SharedBuffer> m_binaryResponseBuilder; 256 RefPtr<SharedBuffer> m_binaryResponseBuilder;
245 long long m_downloadedBlobLength; 257 long long m_downloadedBlobLength;
246 258
247 RefPtr<ArrayBuffer> m_responseArrayBuffer; 259 RefPtr<ArrayBuffer> m_responseArrayBuffer;
248 260
249 bool m_error;
250
251 bool m_uploadEventsAllowed;
252 bool m_uploadComplete;
253
254 bool m_sameOriginRequest;
255
256 // Used for onprogress tracking 261 // Used for onprogress tracking
257 long long m_receivedLength; 262 long long m_receivedLength;
258 263
259 unsigned m_lastSendLineNumber; 264 unsigned m_lastSendLineNumber;
260 String m_lastSendURL; 265 String m_lastSendURL;
261 // An exception to throw in synchronous mode. It's set when failure 266 // An exception to throw in synchronous mode. It's set when failure
262 // notification is received from m_loader and thrown at the end of send() if 267 // notification is received from m_loader and thrown at the end of send() if
263 // any. 268 // any.
264 ExceptionCode m_exceptionCode; 269 ExceptionCode m_exceptionCode;
265 270
266 XMLHttpRequestProgressEventThrottle m_progressEventThrottle; 271 XMLHttpRequestProgressEventThrottle m_progressEventThrottle;
267 272
268 // An enum corresponding to the allowed string values for the responseType a ttribute. 273 // An enum corresponding to the allowed string values for the responseType a ttribute.
269 ResponseTypeCode m_responseTypeCode; 274 ResponseTypeCode m_responseTypeCode;
270 AsyncMethodRunner<XMLHttpRequest> m_dropProtectionRunner; 275 AsyncMethodRunner<XMLHttpRequest> m_dropProtectionRunner;
271 RefPtr<SecurityOrigin> m_securityOrigin; 276 RefPtr<SecurityOrigin> m_securityOrigin;
272 }; 277 };
273 278
274 } // namespace WebCore 279 } // namespace WebCore
275 280
276 #endif // XMLHttpRequest_h 281 #endif // XMLHttpRequest_h
OLDNEW
« no previous file with comments | « no previous file | Source/core/xml/XMLHttpRequest.cpp » ('j') | Source/core/xml/XMLHttpRequest.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698