gfx/skia/trunk/src/ports/SkAtomics_none.h

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

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.

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

mercurial