Sat, 03 Jan 2015 20:18:00 +0100
Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.
2 /*
3 * Copyright 2006 The Android Open Source Project
4 *
5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file.
7 */
10 #ifndef SkPreConfig_DEFINED
11 #define SkPreConfig_DEFINED
13 #ifdef WEBKIT_VERSION_MIN_REQUIRED
14 #include "config.h"
15 #endif
17 // Allows embedders that want to disable macros that take arguments to just
18 // define that symbol to be one of these
19 //
20 #define SK_NOTHING_ARG1(arg1)
21 #define SK_NOTHING_ARG2(arg1, arg2)
22 #define SK_NOTHING_ARG3(arg1, arg2, arg3)
24 //////////////////////////////////////////////////////////////////////
26 #if !defined(SK_BUILD_FOR_ANDROID) && !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_PALM) && !defined(SK_BUILD_FOR_WINCE) && !defined(SK_BUILD_FOR_WIN32) && !defined(SK_BUILD_FOR_UNIX) && !defined(SK_BUILD_FOR_MAC) && !defined(SK_BUILD_FOR_SDL) && !defined(SK_BUILD_FOR_BREW) && !defined(SK_BUILD_FOR_NACL)
28 #ifdef __APPLE__
29 #include "TargetConditionals.h"
30 #endif
32 #if defined(PALMOS_SDK_VERSION)
33 #define SK_BUILD_FOR_PALM
34 #elif defined(UNDER_CE)
35 #define SK_BUILD_FOR_WINCE
36 #elif defined(WIN32)
37 #define SK_BUILD_FOR_WIN32
38 #elif defined(__SYMBIAN32__)
39 #define SK_BUILD_FOR_WIN32
40 #elif defined(ANDROID)
41 #define SK_BUILD_FOR_ANDROID
42 #elif defined(linux) || defined(__FreeBSD__) || defined(__OpenBSD__) || \
43 defined(__sun) || defined(__NetBSD__) || defined(__DragonFly__) || \
44 defined(__GLIBC__) || defined(__GNU__)
45 #define SK_BUILD_FOR_UNIX
46 #elif TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR
47 #define SK_BUILD_FOR_IOS
48 #else
49 #define SK_BUILD_FOR_MAC
50 #endif
52 #endif
54 /* Even if the user only defined the framework variant we still need to build
55 * the default (NDK-compliant) Android code. Therefore, when attempting to
56 * include/exclude something from the framework variant check first that we are
57 * building for Android then check the status of the framework define.
58 */
59 #if defined(SK_BUILD_FOR_ANDROID_FRAMEWORK) && !defined(SK_BUILD_FOR_ANDROID)
60 #define SK_BUILD_FOR_ANDROID
61 #endif
63 //////////////////////////////////////////////////////////////////////
65 #if !defined(SK_DEBUG) && !defined(SK_RELEASE)
66 #ifdef NDEBUG
67 #define SK_RELEASE
68 #else
69 #define SK_DEBUG
70 #endif
71 #endif
73 #ifdef SK_BUILD_FOR_WIN32
74 #if !defined(SK_RESTRICT)
75 #define SK_RESTRICT __restrict
76 #endif
77 #if !defined(SK_WARN_UNUSED_RESULT)
78 #define SK_WARN_UNUSED_RESULT
79 #endif
80 #endif
82 //////////////////////////////////////////////////////////////////////
84 #if !defined(SK_RESTRICT)
85 #define SK_RESTRICT __restrict__
86 #endif
88 #if !defined(SK_WARN_UNUSED_RESULT)
89 #define SK_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
90 #endif
92 //////////////////////////////////////////////////////////////////////
94 #if !defined(SK_CPU_BENDIAN) && !defined(SK_CPU_LENDIAN)
95 #if defined (__ppc__) || defined(__PPC__) || defined(__ppc64__) \
96 || defined(__PPC64__)
97 #define SK_CPU_BENDIAN
98 #else
99 #define SK_CPU_LENDIAN
100 #endif
101 #endif
103 //////////////////////////////////////////////////////////////////////
105 /**
106 * SK_CPU_SSE_LEVEL
107 *
108 * If defined, SK_CPU_SSE_LEVEL should be set to the highest supported level.
109 * On non-intel CPU this should be undefined.
110 */
112 #define SK_CPU_SSE_LEVEL_SSE1 10
113 #define SK_CPU_SSE_LEVEL_SSE2 20
114 #define SK_CPU_SSE_LEVEL_SSE3 30
115 #define SK_CPU_SSE_LEVEL_SSSE3 31
117 // Are we in GCC?
118 #ifndef SK_CPU_SSE_LEVEL
119 // These checks must be done in descending order to ensure we set the highest
120 // available SSE level.
121 #if defined(__SSSE3__)
122 #define SK_CPU_SSE_LEVEL SK_CPU_SSE_LEVEL_SSSE3
123 #elif defined(__SSE3__)
124 #define SK_CPU_SSE_LEVEL SK_CPU_SSE_LEVEL_SSE3
125 #elif defined(__SSE2__)
126 #define SK_CPU_SSE_LEVEL SK_CPU_SSE_LEVEL_SSE2
127 #endif
128 #endif
130 // Are we in VisualStudio?
131 #ifndef SK_CPU_SSE_LEVEL
132 // These checks must be done in descending order to ensure we set the highest
133 // available SSE level.
134 #if defined (_M_IX86_FP)
135 #if _M_IX86_FP >= 2
136 #define SK_CPU_SSE_LEVEL SK_CPU_SSE_LEVEL_SSE2
137 #elif _M_IX86_FP == 1
138 #define SK_CPU_SSE_LEVEL SK_CPU_SSE_LEVEL_SSE1
139 #endif
140 #endif
141 #endif
143 //////////////////////////////////////////////////////////////////////
144 // ARM defines
146 #if defined(__arm__) && (!defined(__APPLE__) || !TARGET_IPHONE_SIMULATOR)
147 #define SK_CPU_ARM
149 #if defined(__GNUC__)
150 #if defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) \
151 || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) \
152 || defined(__ARM_ARCH_7EM__) || defined(_ARM_ARCH_7)
153 #define SK_ARM_ARCH 7
154 #elif defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) \
155 || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6Z__) \
156 || defined(__ARM_ARCH_6ZK__) || defined(__ARM_ARCH_6T2__) \
157 || defined(__ARM_ARCH_6M__) || defined(_ARM_ARCH_6)
158 #define SK_ARM_ARCH 6
159 #elif defined(__ARM_ARCH_5__) || defined(__ARM_ARCH_5T__) \
160 || defined(__ARM_ARCH_5E__) || defined(__ARM_ARCH_5TE__) \
161 || defined(__ARM_ARCH_5TEJ__) || defined(_ARM_ARCH_5)
162 #define SK_ARM_ARCH 5
163 #elif defined(__ARM_ARCH_4__) || defined(__ARM_ARCH_4T__) || defined(_ARM_ARCH_4)
164 #define SK_ARM_ARCH 4
165 #else
166 #define SK_ARM_ARCH 3
167 #endif
169 #if defined(__thumb2__) && (SK_ARM_ARCH >= 6) \
170 || !defined(__thumb__) && ((SK_ARM_ARCH > 5) || defined(__ARM_ARCH_5E__) \
171 || defined(__ARM_ARCH_5TE__) || defined(__ARM_ARCH_5TEJ__))
172 #define SK_ARM_HAS_EDSP
173 #endif
174 #endif
175 #endif
177 //////////////////////////////////////////////////////////////////////
179 #if !defined(SKIA_IMPLEMENTATION)
180 #define SKIA_IMPLEMENTATION 0
181 #endif
183 #if defined(SKIA_DLL)
184 #if defined(WIN32)
185 #if SKIA_IMPLEMENTATION
186 #define SK_API __declspec(dllexport)
187 #else
188 #define SK_API __declspec(dllimport)
189 #endif
190 #else
191 #define SK_API __attribute__((visibility("default")))
192 #endif
193 #else
194 #define SK_API
195 #endif
197 //////////////////////////////////////////////////////////////////////
199 /**
200 * Use SK_PURE_FUNC as an attribute to indicate that a function's
201 * return value only depends on the value of its parameters. This
202 * can help the compiler optimize out successive calls.
203 *
204 * Usage:
205 * void function(int params) SK_PURE_FUNC;
206 */
207 #if defined(__GNUC__)
208 # define SK_PURE_FUNC __attribute__((pure))
209 #else
210 # define SK_PURE_FUNC /* nothing */
211 #endif
213 //////////////////////////////////////////////////////////////////////
215 /**
216 * SK_HAS_ATTRIBUTE(<name>) should return true iff the compiler
217 * supports __attribute__((<name>)). Mostly important because
218 * Clang doesn't support all of GCC attributes.
219 */
220 #if defined(__has_attribute)
221 # define SK_HAS_ATTRIBUTE(x) __has_attribute(x)
222 #elif defined(__GNUC__)
223 # define SK_HAS_ATTRIBUTE(x) 1
224 #else
225 # define SK_HAS_ATTRIBUTE(x) 0
226 #endif
228 /**
229 * SK_ATTRIBUTE_OPTIMIZE_O1 can be used as a function attribute
230 * to specify individual optimization level of -O1, if the compiler
231 * supports it.
232 *
233 * NOTE: Clang/ARM (r161757) does not support the 'optimize' attribute.
234 */
235 #if SK_HAS_ATTRIBUTE(optimize)
236 # define SK_ATTRIBUTE_OPTIMIZE_O1 __attribute__((optimize("O1")))
237 #else
238 # define SK_ATTRIBUTE_OPTIMIZE_O1 /* nothing */
239 #endif
241 #endif