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

Side by Side Diff: third_party/WebKit/Source/platform/loader/fetch/ResourceLoaderOptions.h

Issue 2920663002: Class/struct layout optimization for blink Resource related classes (Closed)
Patch Set: Created 3 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 21 matching lines...) Expand all
32 #define ResourceLoaderOptions_h 32 #define ResourceLoaderOptions_h
33 33
34 #include "platform/CrossThreadCopier.h" 34 #include "platform/CrossThreadCopier.h"
35 #include "platform/loader/fetch/FetchInitiatorInfo.h" 35 #include "platform/loader/fetch/FetchInitiatorInfo.h"
36 #include "platform/loader/fetch/IntegrityMetadata.h" 36 #include "platform/loader/fetch/IntegrityMetadata.h"
37 #include "platform/weborigin/SecurityOrigin.h" 37 #include "platform/weborigin/SecurityOrigin.h"
38 #include "platform/wtf/Allocator.h" 38 #include "platform/wtf/Allocator.h"
39 39
40 namespace blink { 40 namespace blink {
41 41
42 enum DataBufferingPolicy { kBufferData, kDoNotBufferData }; 42 enum DataBufferingPolicy : uint8_t { kBufferData, kDoNotBufferData };
43 43
44 enum ContentSecurityPolicyDisposition { 44 enum ContentSecurityPolicyDisposition : uint8_t {
45 kCheckContentSecurityPolicy, 45 kCheckContentSecurityPolicy,
46 kDoNotCheckContentSecurityPolicy 46 kDoNotCheckContentSecurityPolicy
47 }; 47 };
48 48
49 enum RequestInitiatorContext { 49 enum RequestInitiatorContext : uint8_t {
50 kDocumentContext, 50 kDocumentContext,
51 kWorkerContext, 51 kWorkerContext,
52 }; 52 };
53 53
54 enum StoredCredentials { 54 enum StoredCredentials : uint8_t {
55 kAllowStoredCredentials, 55 kAllowStoredCredentials,
56 kDoNotAllowStoredCredentials 56 kDoNotAllowStoredCredentials
57 }; 57 };
58 58
59 // APIs like XMLHttpRequest and EventSource let the user decide whether to send 59 // APIs like XMLHttpRequest and EventSource let the user decide whether to send
60 // credentials, but they're always sent for same-origin requests. Additional 60 // credentials, but they're always sent for same-origin requests. Additional
61 // information is needed to handle cross-origin redirects correctly. 61 // information is needed to handle cross-origin redirects correctly.
62 enum CredentialRequest { 62 enum CredentialRequest : uint8_t {
63 kClientRequestedCredentials, 63 kClientRequestedCredentials,
64 kClientDidNotRequestCredentials 64 kClientDidNotRequestCredentials
65 }; 65 };
66 66
67 enum SynchronousPolicy { kRequestSynchronously, kRequestAsynchronously }; 67 enum SynchronousPolicy : uint8_t {
68 kRequestSynchronously,
69 kRequestAsynchronously
70 };
68 71
69 // A resource fetch can be marked as being CORS enabled. The loader must perform 72 // A resource fetch can be marked as being CORS enabled. The loader must perform
70 // an access check upon seeing the response. 73 // an access check upon seeing the response.
71 enum CORSEnabled { kNotCORSEnabled, kIsCORSEnabled }; 74 enum CORSEnabled : uint8_t { kNotCORSEnabled, kIsCORSEnabled };
72 75
73 // Was the request generated from a "parser-inserted" element? 76 // Was the request generated from a "parser-inserted" element?
74 // https://html.spec.whatwg.org/multipage/scripting.html#parser-inserted 77 // https://html.spec.whatwg.org/multipage/scripting.html#parser-inserted
75 enum ParserDisposition { kParserInserted, kNotParserInserted }; 78 enum ParserDisposition : uint8_t { kParserInserted, kNotParserInserted };
76 79
77 enum CacheAwareLoadingEnabled { 80 enum CacheAwareLoadingEnabled : uint8_t {
78 kNotCacheAwareLoadingEnabled, 81 kNotCacheAwareLoadingEnabled,
79 kIsCacheAwareLoadingEnabled 82 kIsCacheAwareLoadingEnabled
80 }; 83 };
81 84
82 struct ResourceLoaderOptions { 85 struct ResourceLoaderOptions {
83 USING_FAST_MALLOC(ResourceLoaderOptions); 86 USING_FAST_MALLOC(ResourceLoaderOptions);
84 87
85 public: 88 public:
86 ResourceLoaderOptions() 89 ResourceLoaderOptions()
87 : data_buffering_policy(kBufferData), 90 : data_buffering_policy(kBufferData),
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 // FIXME: check contentSecurityPolicyOption. 123 // FIXME: check contentSecurityPolicyOption.
121 // initiatorInfo is purely informational and should be benign for re-use. 124 // initiatorInfo is purely informational and should be benign for re-use.
122 // requestInitiatorContext is benign (indicates document vs. worker) 125 // requestInitiatorContext is benign (indicates document vs. worker)
123 if (synchronous_policy != other.synchronous_policy) 126 if (synchronous_policy != other.synchronous_policy)
124 return false; 127 return false;
125 return cors_enabled == other.cors_enabled; 128 return cors_enabled == other.cors_enabled;
126 // securityOrigin has more complicated checks which callers are responsible 129 // securityOrigin has more complicated checks which callers are responsible
127 // for. 130 // for.
128 } 131 }
129 132
133 FetchInitiatorInfo initiator_info;
134
130 // When adding members, CrossThreadResourceLoaderOptionsData should be 135 // When adding members, CrossThreadResourceLoaderOptionsData should be
131 // updated. 136 // updated.
132 DataBufferingPolicy data_buffering_policy; 137 DataBufferingPolicy data_buffering_policy;
133 138
134 // Whether HTTP credentials and cookies are sent with the request. 139 // Whether HTTP credentials and cookies are sent with the request.
135 StoredCredentials allow_credentials; 140 StoredCredentials allow_credentials;
136 141
137 // Whether the client (e.g. XHR) wanted credentials in the first place. 142 // Whether the client (e.g. XHR) wanted credentials in the first place.
138 CredentialRequest credentials_requested; 143 CredentialRequest credentials_requested;
139 144
140 ContentSecurityPolicyDisposition content_security_policy_option; 145 ContentSecurityPolicyDisposition content_security_policy_option;
141 FetchInitiatorInfo initiator_info;
142 RequestInitiatorContext request_initiator_context; 146 RequestInitiatorContext request_initiator_context;
143 SynchronousPolicy synchronous_policy; 147 SynchronousPolicy synchronous_policy;
144 148
145 // If the resource is loaded out-of-origin, whether or not to use CORS. 149 // If the resource is loaded out-of-origin, whether or not to use CORS.
146 CORSEnabled cors_enabled; 150 CORSEnabled cors_enabled;
147 151
148 RefPtr<SecurityOrigin> security_origin; 152 RefPtr<SecurityOrigin> security_origin;
149 String content_security_policy_nonce; 153 String content_security_policy_nonce;
150 IntegrityMetadataSet integrity_metadata; 154 IntegrityMetadataSet integrity_metadata;
151 ParserDisposition parser_disposition; 155 ParserDisposition parser_disposition;
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 struct CrossThreadCopier<ResourceLoaderOptions> { 214 struct CrossThreadCopier<ResourceLoaderOptions> {
211 using Type = CrossThreadResourceLoaderOptionsData; 215 using Type = CrossThreadResourceLoaderOptionsData;
212 static Type Copy(const ResourceLoaderOptions& options) { 216 static Type Copy(const ResourceLoaderOptions& options) {
213 return CrossThreadResourceLoaderOptionsData(options); 217 return CrossThreadResourceLoaderOptionsData(options);
214 } 218 }
215 }; 219 };
216 220
217 } // namespace blink 221 } // namespace blink
218 222
219 #endif // ResourceLoaderOptions_h 223 #endif // ResourceLoaderOptions_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698