OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 AllowCrossOriginRequests | 51 AllowCrossOriginRequests |
52 }; | 52 }; |
53 | 53 |
54 enum PreflightPolicy { ConsiderPreflight, ForcePreflight, PreventPreflight }; | 54 enum PreflightPolicy { ConsiderPreflight, ForcePreflight, PreventPreflight }; |
55 | 55 |
56 enum ContentSecurityPolicyEnforcement { | 56 enum ContentSecurityPolicyEnforcement { |
57 EnforceContentSecurityPolicy, | 57 EnforceContentSecurityPolicy, |
58 DoNotEnforceContentSecurityPolicy, | 58 DoNotEnforceContentSecurityPolicy, |
59 }; | 59 }; |
60 | 60 |
| 61 enum SchedulerWaitingPolicy { |
| 62 PreventSchedulerFromWaiting, |
| 63 DoNotPreventSchedulerFromWaiting, |
| 64 }; |
| 65 |
61 struct ThreadableLoaderOptions { | 66 struct ThreadableLoaderOptions { |
62 DISALLOW_NEW(); | 67 DISALLOW_NEW(); |
63 ThreadableLoaderOptions() | 68 ThreadableLoaderOptions() |
64 : preflightPolicy(ConsiderPreflight), | 69 : preflightPolicy(ConsiderPreflight), |
65 crossOriginRequestPolicy(DenyCrossOriginRequests), | 70 crossOriginRequestPolicy(DenyCrossOriginRequests), |
66 contentSecurityPolicyEnforcement(EnforceContentSecurityPolicy), | 71 contentSecurityPolicyEnforcement(EnforceContentSecurityPolicy), |
67 timeoutMilliseconds(0) {} | 72 timeoutMilliseconds(0), |
| 73 schedulerWaitingPolicy(DoNotPreventSchedulerFromWaiting) {} |
68 | 74 |
69 // When adding members, CrossThreadThreadableLoaderOptionsData should | 75 // When adding members, CrossThreadThreadableLoaderOptionsData should |
70 // be updated. | 76 // be updated. |
71 | 77 |
72 // If AccessControl is used, how to determine if a preflight is needed. | 78 // If AccessControl is used, how to determine if a preflight is needed. |
73 PreflightPolicy preflightPolicy; | 79 PreflightPolicy preflightPolicy; |
74 | 80 |
75 CrossOriginRequestPolicy crossOriginRequestPolicy; | 81 CrossOriginRequestPolicy crossOriginRequestPolicy; |
76 AtomicString initiator; | 82 AtomicString initiator; |
77 ContentSecurityPolicyEnforcement contentSecurityPolicyEnforcement; | 83 ContentSecurityPolicyEnforcement contentSecurityPolicyEnforcement; |
78 unsigned long timeoutMilliseconds; | 84 unsigned long timeoutMilliseconds; |
| 85 SchedulerWaitingPolicy schedulerWaitingPolicy; |
79 }; | 86 }; |
80 | 87 |
81 // Encode AtomicString as String to cross threads. | 88 // Encode AtomicString as String to cross threads. |
82 struct CrossThreadThreadableLoaderOptionsData { | 89 struct CrossThreadThreadableLoaderOptionsData { |
83 STACK_ALLOCATED(); | 90 STACK_ALLOCATED(); |
84 explicit CrossThreadThreadableLoaderOptionsData( | 91 explicit CrossThreadThreadableLoaderOptionsData( |
85 const ThreadableLoaderOptions& options) | 92 const ThreadableLoaderOptions& options) |
86 : preflightPolicy(options.preflightPolicy), | 93 : preflightPolicy(options.preflightPolicy), |
87 crossOriginRequestPolicy(options.crossOriginRequestPolicy), | 94 crossOriginRequestPolicy(options.crossOriginRequestPolicy), |
88 initiator(options.initiator.getString().isolatedCopy()), | 95 initiator(options.initiator.getString().isolatedCopy()), |
89 contentSecurityPolicyEnforcement( | 96 contentSecurityPolicyEnforcement( |
90 options.contentSecurityPolicyEnforcement), | 97 options.contentSecurityPolicyEnforcement), |
91 timeoutMilliseconds(options.timeoutMilliseconds) {} | 98 timeoutMilliseconds(options.timeoutMilliseconds), |
| 99 schedulerWaitingPolicy(options.schedulerWaitingPolicy) {} |
92 | 100 |
93 operator ThreadableLoaderOptions() const { | 101 operator ThreadableLoaderOptions() const { |
94 ThreadableLoaderOptions options; | 102 ThreadableLoaderOptions options; |
95 options.preflightPolicy = preflightPolicy; | 103 options.preflightPolicy = preflightPolicy; |
96 options.crossOriginRequestPolicy = crossOriginRequestPolicy; | 104 options.crossOriginRequestPolicy = crossOriginRequestPolicy; |
97 options.initiator = AtomicString(initiator); | 105 options.initiator = AtomicString(initiator); |
98 options.contentSecurityPolicyEnforcement = contentSecurityPolicyEnforcement; | 106 options.contentSecurityPolicyEnforcement = contentSecurityPolicyEnforcement; |
99 options.timeoutMilliseconds = timeoutMilliseconds; | 107 options.timeoutMilliseconds = timeoutMilliseconds; |
| 108 options.schedulerWaitingPolicy = schedulerWaitingPolicy; |
100 return options; | 109 return options; |
101 } | 110 } |
102 | 111 |
103 PreflightPolicy preflightPolicy; | 112 PreflightPolicy preflightPolicy; |
104 CrossOriginRequestPolicy crossOriginRequestPolicy; | 113 CrossOriginRequestPolicy crossOriginRequestPolicy; |
105 String initiator; | 114 String initiator; |
106 ContentSecurityPolicyEnforcement contentSecurityPolicyEnforcement; | 115 ContentSecurityPolicyEnforcement contentSecurityPolicyEnforcement; |
107 unsigned long timeoutMilliseconds; | 116 unsigned long timeoutMilliseconds; |
| 117 SchedulerWaitingPolicy schedulerWaitingPolicy; |
108 }; | 118 }; |
109 | 119 |
110 template <> | 120 template <> |
111 struct CrossThreadCopier<ThreadableLoaderOptions> { | 121 struct CrossThreadCopier<ThreadableLoaderOptions> { |
112 typedef CrossThreadThreadableLoaderOptionsData Type; | 122 typedef CrossThreadThreadableLoaderOptionsData Type; |
113 static Type copy(const ThreadableLoaderOptions& options) { | 123 static Type copy(const ThreadableLoaderOptions& options) { |
114 return CrossThreadThreadableLoaderOptionsData(options); | 124 return CrossThreadThreadableLoaderOptionsData(options); |
115 } | 125 } |
116 }; | 126 }; |
117 | 127 |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 | 201 |
192 DEFINE_INLINE_VIRTUAL_TRACE() {} | 202 DEFINE_INLINE_VIRTUAL_TRACE() {} |
193 | 203 |
194 protected: | 204 protected: |
195 ThreadableLoader() {} | 205 ThreadableLoader() {} |
196 }; | 206 }; |
197 | 207 |
198 } // namespace blink | 208 } // namespace blink |
199 | 209 |
200 #endif // ThreadableLoader_h | 210 #endif // ThreadableLoader_h |
OLD | NEW |