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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | Source/core/xml/XMLHttpRequest.cpp » ('j') | Source/core/xml/XMLHttpRequest.cpp » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/xml/XMLHttpRequest.h
diff --git a/Source/core/xml/XMLHttpRequest.h b/Source/core/xml/XMLHttpRequest.h
index 5025564c31942736111080fbf992324ee74ddc31..22029483de2dfb1f1565716715aaa46cd3793a14 100644
--- a/Source/core/xml/XMLHttpRequest.h
+++ b/Source/core/xml/XMLHttpRequest.h
@@ -102,7 +102,7 @@ public:
String statusText() const;
int status() const;
State readyState() const;
- bool withCredentials() const { return m_includeCredentials; }
+ bool withCredentials() const { return getFlag(IsWithCredentials); }
void setWithCredentials(bool, ExceptionState&);
void open(const AtomicString& method, const KURL&, ExceptionState&);
void open(const AtomicString& method, const KURL&, bool async, ExceptionState&);
@@ -159,6 +159,22 @@ private:
Document* document() const;
SecurityOrigin* securityOrigin() const;
+ enum XMLHttpRequestFlags {
+ IsAsync = 1,
+ IsWithCredentials = 1 << 1,
Inactive 2014/06/21 00:40:41 Maybe just "WithCredentials"?
maheshkk 2014/06/23 18:32:16 Done.
+ IsDocumentCreated = 1 << 2,
+ HasError = 1 << 3,
+ IsUploadEventsAllowed = 1 << 4,
+ IsUploadComplete = 1 << 5,
+ IsSameOriginRequest = 1 << 6
+ // 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.
+ };
+
+ inline bool getFlag (XMLHttpRequestFlags mask) const { return m_xhrFlags & mask; }
Inactive 2014/06/21 00:40:41 nit: extra space after getFlag. "inline" is redund
maheshkk 2014/06/23 18:32:16 Done.
+ inline void setFlag(XMLHttpRequestFlags mask) { m_xhrFlags |= mask; }
+ inline void setFlag(bool f, XMLHttpRequestFlags mask) { m_xhrFlags = (m_xhrFlags & ~mask) | (-(int8_t)f & mask); }
+ inline void clearFlag(XMLHttpRequestFlags mask) { m_xhrFlags &= ~mask; }
+
virtual void didSendData(unsigned long long bytesSent, unsigned long long totalBytesToBeSent) OVERRIDE;
virtual void didReceiveResponse(unsigned long identifier, const ResourceResponse&) OVERRIDE;
virtual void didReceiveData(const char* data, int dataLength) OVERRIDE;
@@ -217,12 +233,11 @@ private:
OwnPtrWillBeMember<XMLHttpRequestUpload> m_upload;
+ 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.
KURL m_url;
AtomicString m_method;
HTTPHeaderMap m_requestHeaders;
AtomicString m_mimeTypeOverride;
- bool m_async;
- bool m_includeCredentials;
unsigned long m_timeoutMilliseconds;
RefPtrWillBeMember<Blob> m_responseBlob;
RefPtrWillBeMember<Stream> m_responseStream;
@@ -236,9 +251,6 @@ private:
OwnPtr<TextResourceDecoder> m_decoder;
ScriptString m_responseText;
- // Used to skip m_responseDocument creation if it's done previously. We need
- // this separate flag since m_responseDocument can be 0 for some cases.
- bool m_createdDocument;
RefPtrWillBeMember<Document> m_responseDocument;
RefPtr<SharedBuffer> m_binaryResponseBuilder;
@@ -246,13 +258,6 @@ private:
RefPtr<ArrayBuffer> m_responseArrayBuffer;
- bool m_error;
-
- bool m_uploadEventsAllowed;
- bool m_uploadComplete;
-
- bool m_sameOriginRequest;
-
// Used for onprogress tracking
long long m_receivedLength;
« 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