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 | * Copyright 2013 Google Inc. |
michael@0 | 3 | * |
michael@0 | 4 | * Use of this source code is governed by a BSD-style license that can be |
michael@0 | 5 | * found in the LICENSE file. |
michael@0 | 6 | */ |
michael@0 | 7 | |
michael@0 | 8 | #ifndef SkAtomics_none_DEFINED |
michael@0 | 9 | #define SkAtomics_none_DEFINED |
michael@0 | 10 | |
michael@0 | 11 | /** Non-atomic atomics for uniprocessor systems. */ |
michael@0 | 12 | |
michael@0 | 13 | #include <stdint.h> |
michael@0 | 14 | |
michael@0 | 15 | static inline int32_t sk_atomic_inc(int32_t* addr) { |
michael@0 | 16 | int32_t value = *addr; |
michael@0 | 17 | *addr = value + 1; |
michael@0 | 18 | return value; |
michael@0 | 19 | } |
michael@0 | 20 | |
michael@0 | 21 | static inline int32_t sk_atomic_add(int32_t* addr, int32_t inc) { |
michael@0 | 22 | int32_t value = *addr; |
michael@0 | 23 | *addr = value + inc; |
michael@0 | 24 | return value; |
michael@0 | 25 | } |
michael@0 | 26 | |
michael@0 | 27 | static inline int32_t sk_atomic_dec(int32_t* addr) { |
michael@0 | 28 | int32_t value = *addr; |
michael@0 | 29 | *addr = value - 1; |
michael@0 | 30 | return value; |
michael@0 | 31 | } |
michael@0 | 32 | |
michael@0 | 33 | static inline void sk_membar_acquire__after_atomic_dec() { } |
michael@0 | 34 | |
michael@0 | 35 | static inline int32_t sk_atomic_conditional_inc(int32_t* addr) { |
michael@0 | 36 | int32_t value = *addr; |
michael@0 | 37 | if (value != 0) ++*addr; |
michael@0 | 38 | return value; |
michael@0 | 39 | } |
michael@0 | 40 | |
michael@0 | 41 | static inline bool sk_atomic_cas(int32_t* addr, int32_t before, int32_t after) { |
michael@0 | 42 | if (*addr != before) return false; |
michael@0 | 43 | *addr = after; |
michael@0 | 44 | return true; |
michael@0 | 45 | } |
michael@0 | 46 | |
michael@0 | 47 | static inline void sk_membar_acquire__after_atomic_conditional_inc() { } |
michael@0 | 48 | |
michael@0 | 49 | #endif |