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