OLD | NEW |
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 16 matching lines...) Expand all Loading... |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #ifndef ResourceLoaderOptions_h | 31 #ifndef ResourceLoaderOptions_h |
32 #define ResourceLoaderOptions_h | 32 #define ResourceLoaderOptions_h |
33 | 33 |
34 #include "core/fetch/FetchInitiatorInfo.h" | 34 #include "core/fetch/FetchInitiatorInfo.h" |
35 #include "platform/CrossThreadCopier.h" | 35 #include "platform/CrossThreadCopier.h" |
36 #include "platform/weborigin/SecurityOrigin.h" | 36 #include "platform/weborigin/SecurityOrigin.h" |
| 37 #include "wtf/Allocator.h" |
37 | 38 |
38 namespace blink { | 39 namespace blink { |
39 | 40 |
40 enum DataBufferingPolicy { | 41 enum DataBufferingPolicy { |
41 BufferData, | 42 BufferData, |
42 DoNotBufferData | 43 DoNotBufferData |
43 }; | 44 }; |
44 | 45 |
45 enum ContentSecurityPolicyDisposition { | 46 enum ContentSecurityPolicyDisposition { |
46 CheckContentSecurityPolicy, | 47 CheckContentSecurityPolicy, |
(...skipping 25 matching lines...) Expand all Loading... |
72 }; | 73 }; |
73 | 74 |
74 // A resource fetch can be marked as being CORS enabled. The loader | 75 // A resource fetch can be marked as being CORS enabled. The loader |
75 // must perform an access check upon seeing the response. | 76 // must perform an access check upon seeing the response. |
76 enum CORSEnabled { | 77 enum CORSEnabled { |
77 NotCORSEnabled, | 78 NotCORSEnabled, |
78 IsCORSEnabled | 79 IsCORSEnabled |
79 }; | 80 }; |
80 | 81 |
81 struct ResourceLoaderOptions { | 82 struct ResourceLoaderOptions { |
| 83 WTF_MAKE_FAST_ALLOCATED(ResourceLoaderOptions); |
| 84 public: |
82 ResourceLoaderOptions() | 85 ResourceLoaderOptions() |
83 : dataBufferingPolicy(BufferData) | 86 : dataBufferingPolicy(BufferData) |
84 , allowCredentials(DoNotAllowStoredCredentials) | 87 , allowCredentials(DoNotAllowStoredCredentials) |
85 , credentialsRequested(ClientDidNotRequestCredentials) | 88 , credentialsRequested(ClientDidNotRequestCredentials) |
86 , contentSecurityPolicyOption(CheckContentSecurityPolicy) | 89 , contentSecurityPolicyOption(CheckContentSecurityPolicy) |
87 , requestInitiatorContext(DocumentContext) | 90 , requestInitiatorContext(DocumentContext) |
88 , synchronousPolicy(RequestAsynchronously) | 91 , synchronousPolicy(RequestAsynchronously) |
89 , corsEnabled(NotCORSEnabled) | 92 , corsEnabled(NotCORSEnabled) |
90 { | 93 { |
91 } | 94 } |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 ContentSecurityPolicyDisposition contentSecurityPolicyOption; | 133 ContentSecurityPolicyDisposition contentSecurityPolicyOption; |
131 FetchInitiatorInfo initiatorInfo; | 134 FetchInitiatorInfo initiatorInfo; |
132 RequestInitiatorContext requestInitiatorContext; | 135 RequestInitiatorContext requestInitiatorContext; |
133 SynchronousPolicy synchronousPolicy; | 136 SynchronousPolicy synchronousPolicy; |
134 CORSEnabled corsEnabled; // If the resource is loaded out-of-origin, whether
or not to use CORS. | 137 CORSEnabled corsEnabled; // If the resource is loaded out-of-origin, whether
or not to use CORS. |
135 RefPtr<SecurityOrigin> securityOrigin; | 138 RefPtr<SecurityOrigin> securityOrigin; |
136 }; | 139 }; |
137 | 140 |
138 // Encode AtomicString (in FetchInitiatorInfo) as String to cross threads. | 141 // Encode AtomicString (in FetchInitiatorInfo) as String to cross threads. |
139 struct CrossThreadResourceLoaderOptionsData { | 142 struct CrossThreadResourceLoaderOptionsData { |
| 143 DISALLOW_ALLOCATION(); |
140 explicit CrossThreadResourceLoaderOptionsData(const ResourceLoaderOptions& o
ptions) | 144 explicit CrossThreadResourceLoaderOptionsData(const ResourceLoaderOptions& o
ptions) |
141 : dataBufferingPolicy(options.dataBufferingPolicy) | 145 : dataBufferingPolicy(options.dataBufferingPolicy) |
142 , allowCredentials(options.allowCredentials) | 146 , allowCredentials(options.allowCredentials) |
143 , credentialsRequested(options.credentialsRequested) | 147 , credentialsRequested(options.credentialsRequested) |
144 , contentSecurityPolicyOption(options.contentSecurityPolicyOption) | 148 , contentSecurityPolicyOption(options.contentSecurityPolicyOption) |
145 , initiatorInfo(options.initiatorInfo) | 149 , initiatorInfo(options.initiatorInfo) |
146 , requestInitiatorContext(options.requestInitiatorContext) | 150 , requestInitiatorContext(options.requestInitiatorContext) |
147 , synchronousPolicy(options.synchronousPolicy) | 151 , synchronousPolicy(options.synchronousPolicy) |
148 , corsEnabled(options.corsEnabled) | 152 , corsEnabled(options.corsEnabled) |
149 , securityOrigin(options.securityOrigin ? options.securityOrigin->isolat
edCopy() : nullptr) { } | 153 , securityOrigin(options.securityOrigin ? options.securityOrigin->isolat
edCopy() : nullptr) { } |
(...skipping 28 matching lines...) Expand all Loading... |
178 typedef CrossThreadResourceLoaderOptionsData Type; | 182 typedef CrossThreadResourceLoaderOptionsData Type; |
179 static Type copy(const ResourceLoaderOptions& options) | 183 static Type copy(const ResourceLoaderOptions& options) |
180 { | 184 { |
181 return CrossThreadResourceLoaderOptionsData(options); | 185 return CrossThreadResourceLoaderOptionsData(options); |
182 } | 186 } |
183 }; | 187 }; |
184 | 188 |
185 } // namespace blink | 189 } // namespace blink |
186 | 190 |
187 #endif // ResourceLoaderOptions_h | 191 #endif // ResourceLoaderOptions_h |
OLD | NEW |