mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Apply clang-format to all C, C++ and ObjC files (issue #2171)
This commit is contained in:
@ -85,9 +85,9 @@ inline void MemoryBarrier() {
|
||||
// variant of the target architecture is being used. This tests against
|
||||
// any known ARMv6 or ARMv7 variant, where it is possible to directly
|
||||
// use ldrex/strex instructions to implement fast atomic operations.
|
||||
#if defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) || \
|
||||
#if defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) || \
|
||||
defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) || \
|
||||
defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || \
|
||||
defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || \
|
||||
defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6Z__) || \
|
||||
defined(__ARM_ARCH_6ZK__) || defined(__ARM_ARCH_6T2__)
|
||||
|
||||
@ -103,16 +103,17 @@ inline Atomic32 NoBarrier_CompareAndSwap(volatile Atomic32* ptr,
|
||||
// reloop = 0
|
||||
// if (prev_value != old_value)
|
||||
// reloop = STREX(ptr, new_value)
|
||||
__asm__ __volatile__(" ldrex %0, [%3]\n"
|
||||
" mov %1, #0\n"
|
||||
" cmp %0, %4\n"
|
||||
__asm__ __volatile__(
|
||||
" ldrex %0, [%3]\n"
|
||||
" mov %1, #0\n"
|
||||
" cmp %0, %4\n"
|
||||
#ifdef __thumb2__
|
||||
" it eq\n"
|
||||
" it eq\n"
|
||||
#endif
|
||||
" strexeq %1, %5, [%3]\n"
|
||||
: "=&r"(prev_value), "=&r"(reloop), "+m"(*ptr)
|
||||
: "r"(ptr), "r"(old_value), "r"(new_value)
|
||||
: "cc", "memory");
|
||||
" strexeq %1, %5, [%3]\n"
|
||||
: "=&r"(prev_value), "=&r"(reloop), "+m"(*ptr)
|
||||
: "r"(ptr), "r"(old_value), "r"(new_value)
|
||||
: "cc", "memory");
|
||||
} while (reloop != 0);
|
||||
return prev_value;
|
||||
}
|
||||
@ -143,12 +144,13 @@ inline Atomic32 NoBarrier_AtomicIncrement(volatile Atomic32* ptr,
|
||||
// value += increment
|
||||
// reloop = STREX(ptr, value)
|
||||
//
|
||||
__asm__ __volatile__(" ldrex %0, [%3]\n"
|
||||
" add %0, %0, %4\n"
|
||||
" strex %1, %0, [%3]\n"
|
||||
: "=&r"(value), "=&r"(reloop), "+m"(*ptr)
|
||||
: "r"(ptr), "r"(increment)
|
||||
: "cc", "memory");
|
||||
__asm__ __volatile__(
|
||||
" ldrex %0, [%3]\n"
|
||||
" add %0, %0, %4\n"
|
||||
" strex %1, %0, [%3]\n"
|
||||
: "=&r"(value), "=&r"(reloop), "+m"(*ptr)
|
||||
: "r"(ptr), "r"(increment)
|
||||
: "cc", "memory");
|
||||
} while (reloop);
|
||||
return value;
|
||||
}
|
||||
@ -171,18 +173,19 @@ inline Atomic32 NoBarrier_AtomicExchange(volatile Atomic32* ptr,
|
||||
do {
|
||||
// old_value = LDREX(ptr)
|
||||
// reloop = STREX(ptr, new_value)
|
||||
__asm__ __volatile__(" ldrex %0, [%3]\n"
|
||||
" strex %1, %4, [%3]\n"
|
||||
: "=&r"(old_value), "=&r"(reloop), "+m"(*ptr)
|
||||
: "r"(ptr), "r"(new_value)
|
||||
: "cc", "memory");
|
||||
__asm__ __volatile__(
|
||||
" ldrex %0, [%3]\n"
|
||||
" strex %1, %4, [%3]\n"
|
||||
: "=&r"(old_value), "=&r"(reloop), "+m"(*ptr)
|
||||
: "r"(ptr), "r"(new_value)
|
||||
: "cc", "memory");
|
||||
} while (reloop != 0);
|
||||
return old_value;
|
||||
}
|
||||
|
||||
// This tests against any known ARMv5 variant.
|
||||
#elif defined(__ARM_ARCH_5__) || defined(__ARM_ARCH_5T__) || \
|
||||
defined(__ARM_ARCH_5TE__) || defined(__ARM_ARCH_5TEJ__)
|
||||
defined(__ARM_ARCH_5TE__) || defined(__ARM_ARCH_5TEJ__)
|
||||
|
||||
// The kernel also provides a helper function to perform an atomic
|
||||
// compare-and-swap operation at the hard-wired address 0xffff0fc0.
|
||||
@ -281,7 +284,7 @@ inline Atomic32 Release_CompareAndSwap(volatile Atomic32* ptr,
|
||||
}
|
||||
|
||||
#else
|
||||
# error "Your CPU's ARM architecture is not supported yet"
|
||||
#error "Your CPU's ARM architecture is not supported yet"
|
||||
#endif
|
||||
|
||||
// NOTE: Atomicity of the following load and store operations is only
|
||||
@ -301,7 +304,9 @@ inline void Release_Store(volatile Atomic32* ptr, Atomic32 value) {
|
||||
*ptr = value;
|
||||
}
|
||||
|
||||
inline Atomic32 NoBarrier_Load(volatile const Atomic32* ptr) { return *ptr; }
|
||||
inline Atomic32 NoBarrier_Load(volatile const Atomic32* ptr) {
|
||||
return *ptr;
|
||||
}
|
||||
|
||||
inline Atomic32 Acquire_Load(volatile const Atomic32* ptr) {
|
||||
Atomic32 value = *ptr;
|
||||
|
@ -52,26 +52,26 @@ namespace subtle {
|
||||
inline AtomicWord NoBarrier_CompareAndSwap(volatile AtomicWord* ptr,
|
||||
AtomicWord old_value,
|
||||
AtomicWord new_value) {
|
||||
return NoBarrier_CompareAndSwap(
|
||||
reinterpret_cast<volatile Atomic32*>(ptr), old_value, new_value);
|
||||
return NoBarrier_CompareAndSwap(reinterpret_cast<volatile Atomic32*>(ptr),
|
||||
old_value, new_value);
|
||||
}
|
||||
|
||||
inline AtomicWord NoBarrier_AtomicExchange(volatile AtomicWord* ptr,
|
||||
AtomicWord new_value) {
|
||||
return NoBarrier_AtomicExchange(
|
||||
reinterpret_cast<volatile Atomic32*>(ptr), new_value);
|
||||
return NoBarrier_AtomicExchange(reinterpret_cast<volatile Atomic32*>(ptr),
|
||||
new_value);
|
||||
}
|
||||
|
||||
inline AtomicWord NoBarrier_AtomicIncrement(volatile AtomicWord* ptr,
|
||||
AtomicWord increment) {
|
||||
return NoBarrier_AtomicIncrement(
|
||||
reinterpret_cast<volatile Atomic32*>(ptr), increment);
|
||||
return NoBarrier_AtomicIncrement(reinterpret_cast<volatile Atomic32*>(ptr),
|
||||
increment);
|
||||
}
|
||||
|
||||
inline AtomicWord Barrier_AtomicIncrement(volatile AtomicWord* ptr,
|
||||
AtomicWord increment) {
|
||||
return Barrier_AtomicIncrement(
|
||||
reinterpret_cast<volatile Atomic32*>(ptr), increment);
|
||||
return Barrier_AtomicIncrement(reinterpret_cast<volatile Atomic32*>(ptr),
|
||||
increment);
|
||||
}
|
||||
|
||||
inline AtomicWord Acquire_CompareAndSwap(volatile AtomicWord* ptr,
|
||||
@ -88,24 +88,22 @@ inline AtomicWord Release_CompareAndSwap(volatile AtomicWord* ptr,
|
||||
reinterpret_cast<volatile Atomic32*>(ptr), old_value, new_value);
|
||||
}
|
||||
|
||||
inline void NoBarrier_Store(volatile AtomicWord *ptr, AtomicWord value) {
|
||||
NoBarrier_Store(
|
||||
reinterpret_cast<volatile Atomic32*>(ptr), value);
|
||||
inline void NoBarrier_Store(volatile AtomicWord* ptr, AtomicWord value) {
|
||||
NoBarrier_Store(reinterpret_cast<volatile Atomic32*>(ptr), value);
|
||||
}
|
||||
|
||||
inline void Acquire_Store(volatile AtomicWord* ptr, AtomicWord value) {
|
||||
return base::subtle::Acquire_Store(
|
||||
reinterpret_cast<volatile Atomic32*>(ptr), value);
|
||||
return base::subtle::Acquire_Store(reinterpret_cast<volatile Atomic32*>(ptr),
|
||||
value);
|
||||
}
|
||||
|
||||
inline void Release_Store(volatile AtomicWord* ptr, AtomicWord value) {
|
||||
return base::subtle::Release_Store(
|
||||
reinterpret_cast<volatile Atomic32*>(ptr), value);
|
||||
return base::subtle::Release_Store(reinterpret_cast<volatile Atomic32*>(ptr),
|
||||
value);
|
||||
}
|
||||
|
||||
inline AtomicWord NoBarrier_Load(volatile const AtomicWord *ptr) {
|
||||
return NoBarrier_Load(
|
||||
reinterpret_cast<volatile const Atomic32*>(ptr));
|
||||
inline AtomicWord NoBarrier_Load(volatile const AtomicWord* ptr) {
|
||||
return NoBarrier_Load(reinterpret_cast<volatile const Atomic32*>(ptr));
|
||||
}
|
||||
|
||||
inline AtomicWord Acquire_Load(volatile const AtomicWord* ptr) {
|
||||
@ -118,8 +116,8 @@ inline AtomicWord Release_Load(volatile const AtomicWord* ptr) {
|
||||
reinterpret_cast<volatile const Atomic32*>(ptr));
|
||||
}
|
||||
|
||||
} // namespace base::subtle
|
||||
} // namespace base
|
||||
} // namespace base::subtle
|
||||
} // namespace base
|
||||
|
||||
#endif // !defined(ARCH_CPU_64_BITS)
|
||||
|
||||
|
@ -170,7 +170,7 @@ inline Atomic64 Acquire_CompareAndSwap(volatile Atomic64* ptr,
|
||||
Atomic64 prev_value;
|
||||
do {
|
||||
if (OSAtomicCompareAndSwap64Barrier(
|
||||
old_value, new_value, reinterpret_cast<volatile int64_t*>(ptr))) {
|
||||
old_value, new_value, reinterpret_cast<volatile int64_t*>(ptr))) {
|
||||
return old_value;
|
||||
}
|
||||
prev_value = *ptr;
|
||||
@ -217,7 +217,7 @@ inline Atomic64 Release_Load(volatile const Atomic64* ptr) {
|
||||
|
||||
#endif // defined(__LP64__)
|
||||
|
||||
} // namespace base::subtle
|
||||
} // namespace base
|
||||
} // namespace base::subtle
|
||||
} // namespace base
|
||||
|
||||
#endif // CEF_INCLUDE_BASE_INTERNAL_CEF_ATOMICOPS_MAC_H_
|
||||
|
@ -38,11 +38,10 @@
|
||||
// Features of this x86. Values may not be correct before main() is run,
|
||||
// but are set conservatively.
|
||||
struct AtomicOps_x86CPUFeatureStruct {
|
||||
bool has_amd_lock_mb_bug; // Processor has AMD memory-barrier bug; do lfence
|
||||
// after acquire compare-and-swap.
|
||||
bool has_amd_lock_mb_bug; // Processor has AMD memory-barrier bug; do lfence
|
||||
// after acquire compare-and-swap.
|
||||
};
|
||||
extern struct AtomicOps_x86CPUFeatureStruct
|
||||
AtomicOps_Internalx86CPUFeatures;
|
||||
extern struct AtomicOps_x86CPUFeatureStruct AtomicOps_Internalx86CPUFeatures;
|
||||
|
||||
#define ATOMICOPS_COMPILER_BARRIER() __asm__ __volatile__("" : : : "memory")
|
||||
|
||||
@ -56,8 +55,8 @@ inline Atomic32 NoBarrier_CompareAndSwap(volatile Atomic32* ptr,
|
||||
Atomic32 new_value) {
|
||||
Atomic32 prev;
|
||||
__asm__ __volatile__("lock; cmpxchgl %1,%2"
|
||||
: "=a" (prev)
|
||||
: "q" (new_value), "m" (*ptr), "0" (old_value)
|
||||
: "=a"(prev)
|
||||
: "q"(new_value), "m"(*ptr), "0"(old_value)
|
||||
: "memory");
|
||||
return prev;
|
||||
}
|
||||
@ -65,8 +64,8 @@ inline Atomic32 NoBarrier_CompareAndSwap(volatile Atomic32* ptr,
|
||||
inline Atomic32 NoBarrier_AtomicExchange(volatile Atomic32* ptr,
|
||||
Atomic32 new_value) {
|
||||
__asm__ __volatile__("xchgl %1,%0" // The lock prefix is implicit for xchg.
|
||||
: "=r" (new_value)
|
||||
: "m" (*ptr), "0" (new_value)
|
||||
: "=r"(new_value)
|
||||
: "m"(*ptr), "0"(new_value)
|
||||
: "memory");
|
||||
return new_value; // Now it's the previous value.
|
||||
}
|
||||
@ -75,8 +74,9 @@ inline Atomic32 NoBarrier_AtomicIncrement(volatile Atomic32* ptr,
|
||||
Atomic32 increment) {
|
||||
Atomic32 temp = increment;
|
||||
__asm__ __volatile__("lock; xaddl %0,%1"
|
||||
: "+r" (temp), "+m" (*ptr)
|
||||
: : "memory");
|
||||
: "+r"(temp), "+m"(*ptr)
|
||||
:
|
||||
: "memory");
|
||||
// temp now holds the old value of *ptr
|
||||
return temp + increment;
|
||||
}
|
||||
@ -85,8 +85,9 @@ inline Atomic32 Barrier_AtomicIncrement(volatile Atomic32* ptr,
|
||||
Atomic32 increment) {
|
||||
Atomic32 temp = increment;
|
||||
__asm__ __volatile__("lock; xaddl %0,%1"
|
||||
: "+r" (temp), "+m" (*ptr)
|
||||
: : "memory");
|
||||
: "+r"(temp), "+m"(*ptr)
|
||||
:
|
||||
: "memory");
|
||||
// temp now holds the old value of *ptr
|
||||
if (AtomicOps_Internalx86CPUFeatures.has_amd_lock_mb_bug) {
|
||||
__asm__ __volatile__("lfence" : : : "memory");
|
||||
@ -125,7 +126,7 @@ inline void Acquire_Store(volatile Atomic32* ptr, Atomic32 value) {
|
||||
|
||||
inline void Release_Store(volatile Atomic32* ptr, Atomic32 value) {
|
||||
ATOMICOPS_COMPILER_BARRIER();
|
||||
*ptr = value; // An x86 store acts as a release barrier.
|
||||
*ptr = value; // An x86 store acts as a release barrier.
|
||||
// See comments in Atomic64 version of Release_Store(), below.
|
||||
}
|
||||
|
||||
@ -134,7 +135,7 @@ inline Atomic32 NoBarrier_Load(volatile const Atomic32* ptr) {
|
||||
}
|
||||
|
||||
inline Atomic32 Acquire_Load(volatile const Atomic32* ptr) {
|
||||
Atomic32 value = *ptr; // An x86 load acts as a acquire barrier.
|
||||
Atomic32 value = *ptr; // An x86 load acts as a acquire barrier.
|
||||
// See comments in Atomic64 version of Release_Store(), below.
|
||||
ATOMICOPS_COMPILER_BARRIER();
|
||||
return value;
|
||||
@ -154,8 +155,8 @@ inline Atomic64 NoBarrier_CompareAndSwap(volatile Atomic64* ptr,
|
||||
Atomic64 new_value) {
|
||||
Atomic64 prev;
|
||||
__asm__ __volatile__("lock; cmpxchgq %1,%2"
|
||||
: "=a" (prev)
|
||||
: "q" (new_value), "m" (*ptr), "0" (old_value)
|
||||
: "=a"(prev)
|
||||
: "q"(new_value), "m"(*ptr), "0"(old_value)
|
||||
: "memory");
|
||||
return prev;
|
||||
}
|
||||
@ -163,8 +164,8 @@ inline Atomic64 NoBarrier_CompareAndSwap(volatile Atomic64* ptr,
|
||||
inline Atomic64 NoBarrier_AtomicExchange(volatile Atomic64* ptr,
|
||||
Atomic64 new_value) {
|
||||
__asm__ __volatile__("xchgq %1,%0" // The lock prefix is implicit for xchg.
|
||||
: "=r" (new_value)
|
||||
: "m" (*ptr), "0" (new_value)
|
||||
: "=r"(new_value)
|
||||
: "m"(*ptr), "0"(new_value)
|
||||
: "memory");
|
||||
return new_value; // Now it's the previous value.
|
||||
}
|
||||
@ -173,8 +174,9 @@ inline Atomic64 NoBarrier_AtomicIncrement(volatile Atomic64* ptr,
|
||||
Atomic64 increment) {
|
||||
Atomic64 temp = increment;
|
||||
__asm__ __volatile__("lock; xaddq %0,%1"
|
||||
: "+r" (temp), "+m" (*ptr)
|
||||
: : "memory");
|
||||
: "+r"(temp), "+m"(*ptr)
|
||||
:
|
||||
: "memory");
|
||||
// temp now contains the previous value of *ptr
|
||||
return temp + increment;
|
||||
}
|
||||
@ -183,8 +185,9 @@ inline Atomic64 Barrier_AtomicIncrement(volatile Atomic64* ptr,
|
||||
Atomic64 increment) {
|
||||
Atomic64 temp = increment;
|
||||
__asm__ __volatile__("lock; xaddq %0,%1"
|
||||
: "+r" (temp), "+m" (*ptr)
|
||||
: : "memory");
|
||||
: "+r"(temp), "+m"(*ptr)
|
||||
:
|
||||
: "memory");
|
||||
// temp now contains the previous value of *ptr
|
||||
if (AtomicOps_Internalx86CPUFeatures.has_amd_lock_mb_bug) {
|
||||
__asm__ __volatile__("lfence" : : : "memory");
|
||||
@ -204,9 +207,9 @@ inline void Acquire_Store(volatile Atomic64* ptr, Atomic64 value) {
|
||||
inline void Release_Store(volatile Atomic64* ptr, Atomic64 value) {
|
||||
ATOMICOPS_COMPILER_BARRIER();
|
||||
|
||||
*ptr = value; // An x86 store acts as a release barrier
|
||||
// for current AMD/Intel chips as of Jan 2008.
|
||||
// See also Acquire_Load(), below.
|
||||
*ptr = value; // An x86 store acts as a release barrier
|
||||
// for current AMD/Intel chips as of Jan 2008.
|
||||
// See also Acquire_Load(), below.
|
||||
|
||||
// When new chips come out, check:
|
||||
// IA-32 Intel Architecture Software Developer's Manual, Volume 3:
|
||||
@ -227,9 +230,9 @@ inline Atomic64 NoBarrier_Load(volatile const Atomic64* ptr) {
|
||||
}
|
||||
|
||||
inline Atomic64 Acquire_Load(volatile const Atomic64* ptr) {
|
||||
Atomic64 value = *ptr; // An x86 load acts as a acquire barrier,
|
||||
// for current AMD/Intel chips as of Jan 2008.
|
||||
// See also Release_Store(), above.
|
||||
Atomic64 value = *ptr; // An x86 load acts as a acquire barrier,
|
||||
// for current AMD/Intel chips as of Jan 2008.
|
||||
// See also Release_Store(), above.
|
||||
ATOMICOPS_COMPILER_BARRIER();
|
||||
return value;
|
||||
}
|
||||
@ -257,8 +260,8 @@ inline Atomic64 Release_CompareAndSwap(volatile Atomic64* ptr,
|
||||
|
||||
#endif // defined(__x86_64__)
|
||||
|
||||
} // namespace base::subtle
|
||||
} // namespace base
|
||||
} // namespace base::subtle
|
||||
} // namespace base
|
||||
|
||||
#undef ATOMICOPS_COMPILER_BARRIER
|
||||
|
||||
|
@ -55,25 +55,23 @@ inline Atomic32 NoBarrier_CompareAndSwap(volatile Atomic32* ptr,
|
||||
Atomic32 old_value,
|
||||
Atomic32 new_value) {
|
||||
LONG result = _InterlockedCompareExchange(
|
||||
reinterpret_cast<volatile LONG*>(ptr),
|
||||
static_cast<LONG>(new_value),
|
||||
reinterpret_cast<volatile LONG*>(ptr), static_cast<LONG>(new_value),
|
||||
static_cast<LONG>(old_value));
|
||||
return static_cast<Atomic32>(result);
|
||||
}
|
||||
|
||||
inline Atomic32 NoBarrier_AtomicExchange(volatile Atomic32* ptr,
|
||||
Atomic32 new_value) {
|
||||
LONG result = _InterlockedExchange(
|
||||
reinterpret_cast<volatile LONG*>(ptr),
|
||||
static_cast<LONG>(new_value));
|
||||
LONG result = _InterlockedExchange(reinterpret_cast<volatile LONG*>(ptr),
|
||||
static_cast<LONG>(new_value));
|
||||
return static_cast<Atomic32>(result);
|
||||
}
|
||||
|
||||
inline Atomic32 Barrier_AtomicIncrement(volatile Atomic32* ptr,
|
||||
Atomic32 increment) {
|
||||
return _InterlockedExchangeAdd(
|
||||
reinterpret_cast<volatile LONG*>(ptr),
|
||||
static_cast<LONG>(increment)) + increment;
|
||||
return _InterlockedExchangeAdd(reinterpret_cast<volatile LONG*>(ptr),
|
||||
static_cast<LONG>(increment)) +
|
||||
increment;
|
||||
}
|
||||
|
||||
inline Atomic32 NoBarrier_AtomicIncrement(volatile Atomic32* ptr,
|
||||
@ -112,11 +110,11 @@ inline void NoBarrier_Store(volatile Atomic32* ptr, Atomic32 value) {
|
||||
|
||||
inline void Acquire_Store(volatile Atomic32* ptr, Atomic32 value) {
|
||||
NoBarrier_AtomicExchange(ptr, value);
|
||||
// acts as a barrier in this implementation
|
||||
// acts as a barrier in this implementation
|
||||
}
|
||||
|
||||
inline void Release_Store(volatile Atomic32* ptr, Atomic32 value) {
|
||||
*ptr = value; // works w/o barrier for current Intel chips as of June 2005
|
||||
*ptr = value; // works w/o barrier for current Intel chips as of June 2005
|
||||
// See comments in Atomic64 version of Release_Store() below.
|
||||
}
|
||||
|
||||
@ -144,24 +142,24 @@ inline Atomic64 NoBarrier_CompareAndSwap(volatile Atomic64* ptr,
|
||||
Atomic64 old_value,
|
||||
Atomic64 new_value) {
|
||||
PVOID result = InterlockedCompareExchangePointer(
|
||||
reinterpret_cast<volatile PVOID*>(ptr),
|
||||
reinterpret_cast<PVOID>(new_value), reinterpret_cast<PVOID>(old_value));
|
||||
reinterpret_cast<volatile PVOID*>(ptr),
|
||||
reinterpret_cast<PVOID>(new_value), reinterpret_cast<PVOID>(old_value));
|
||||
return reinterpret_cast<Atomic64>(result);
|
||||
}
|
||||
|
||||
inline Atomic64 NoBarrier_AtomicExchange(volatile Atomic64* ptr,
|
||||
Atomic64 new_value) {
|
||||
PVOID result = InterlockedExchangePointer(
|
||||
reinterpret_cast<volatile PVOID*>(ptr),
|
||||
reinterpret_cast<PVOID>(new_value));
|
||||
PVOID result =
|
||||
InterlockedExchangePointer(reinterpret_cast<volatile PVOID*>(ptr),
|
||||
reinterpret_cast<PVOID>(new_value));
|
||||
return reinterpret_cast<Atomic64>(result);
|
||||
}
|
||||
|
||||
inline Atomic64 Barrier_AtomicIncrement(volatile Atomic64* ptr,
|
||||
Atomic64 increment) {
|
||||
return InterlockedExchangeAdd64(
|
||||
reinterpret_cast<volatile LONGLONG*>(ptr),
|
||||
static_cast<LONGLONG>(increment)) + increment;
|
||||
return InterlockedExchangeAdd64(reinterpret_cast<volatile LONGLONG*>(ptr),
|
||||
static_cast<LONGLONG>(increment)) +
|
||||
increment;
|
||||
}
|
||||
|
||||
inline Atomic64 NoBarrier_AtomicIncrement(volatile Atomic64* ptr,
|
||||
@ -175,11 +173,11 @@ inline void NoBarrier_Store(volatile Atomic64* ptr, Atomic64 value) {
|
||||
|
||||
inline void Acquire_Store(volatile Atomic64* ptr, Atomic64 value) {
|
||||
NoBarrier_AtomicExchange(ptr, value);
|
||||
// acts as a barrier in this implementation
|
||||
// acts as a barrier in this implementation
|
||||
}
|
||||
|
||||
inline void Release_Store(volatile Atomic64* ptr, Atomic64 value) {
|
||||
*ptr = value; // works w/o barrier for current Intel chips as of June 2005
|
||||
*ptr = value; // works w/o barrier for current Intel chips as of June 2005
|
||||
|
||||
// When new chips come out, check:
|
||||
// IA-32 Intel Architecture Software Developer's Manual, Volume 3:
|
||||
@ -215,7 +213,6 @@ inline Atomic64 Release_CompareAndSwap(volatile Atomic64* ptr,
|
||||
return NoBarrier_CompareAndSwap(ptr, old_value, new_value);
|
||||
}
|
||||
|
||||
|
||||
#endif // defined(_WIN64)
|
||||
|
||||
} // namespace base::subtle
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -48,338 +48,344 @@ class RunnableAdapter;
|
||||
|
||||
// __stdcall Function: Arity 0.
|
||||
template <typename R>
|
||||
class RunnableAdapter<R(__stdcall *)()> {
|
||||
class RunnableAdapter<R(__stdcall*)()> {
|
||||
public:
|
||||
typedef R (RunType)();
|
||||
typedef R(RunType)();
|
||||
|
||||
explicit RunnableAdapter(R(__stdcall *function)())
|
||||
: function_(function) {
|
||||
}
|
||||
explicit RunnableAdapter(R(__stdcall* function)()) : function_(function) {}
|
||||
|
||||
R Run() {
|
||||
return function_();
|
||||
}
|
||||
R Run() { return function_(); }
|
||||
|
||||
private:
|
||||
R (__stdcall *function_)();
|
||||
R(__stdcall* function_)();
|
||||
};
|
||||
|
||||
// __fastcall Function: Arity 0.
|
||||
template <typename R>
|
||||
class RunnableAdapter<R(__fastcall *)()> {
|
||||
class RunnableAdapter<R(__fastcall*)()> {
|
||||
public:
|
||||
typedef R (RunType)();
|
||||
typedef R(RunType)();
|
||||
|
||||
explicit RunnableAdapter(R(__fastcall *function)())
|
||||
: function_(function) {
|
||||
}
|
||||
explicit RunnableAdapter(R(__fastcall* function)()) : function_(function) {}
|
||||
|
||||
R Run() {
|
||||
return function_();
|
||||
}
|
||||
R Run() { return function_(); }
|
||||
|
||||
private:
|
||||
R (__fastcall *function_)();
|
||||
R(__fastcall* function_)();
|
||||
};
|
||||
|
||||
// __stdcall Function: Arity 1.
|
||||
template <typename R, typename A1>
|
||||
class RunnableAdapter<R(__stdcall *)(A1)> {
|
||||
class RunnableAdapter<R(__stdcall*)(A1)> {
|
||||
public:
|
||||
typedef R (RunType)(A1);
|
||||
typedef R(RunType)(A1);
|
||||
|
||||
explicit RunnableAdapter(R(__stdcall *function)(A1))
|
||||
: function_(function) {
|
||||
}
|
||||
explicit RunnableAdapter(R(__stdcall* function)(A1)) : function_(function) {}
|
||||
|
||||
R Run(typename CallbackParamTraits<A1>::ForwardType a1) {
|
||||
return function_(a1);
|
||||
}
|
||||
|
||||
private:
|
||||
R (__stdcall *function_)(A1);
|
||||
R(__stdcall* function_)(A1);
|
||||
};
|
||||
|
||||
// __fastcall Function: Arity 1.
|
||||
template <typename R, typename A1>
|
||||
class RunnableAdapter<R(__fastcall *)(A1)> {
|
||||
class RunnableAdapter<R(__fastcall*)(A1)> {
|
||||
public:
|
||||
typedef R (RunType)(A1);
|
||||
typedef R(RunType)(A1);
|
||||
|
||||
explicit RunnableAdapter(R(__fastcall *function)(A1))
|
||||
: function_(function) {
|
||||
}
|
||||
explicit RunnableAdapter(R(__fastcall* function)(A1)) : function_(function) {}
|
||||
|
||||
R Run(typename CallbackParamTraits<A1>::ForwardType a1) {
|
||||
return function_(a1);
|
||||
}
|
||||
|
||||
private:
|
||||
R (__fastcall *function_)(A1);
|
||||
R(__fastcall* function_)(A1);
|
||||
};
|
||||
|
||||
// __stdcall Function: Arity 2.
|
||||
template <typename R, typename A1, typename A2>
|
||||
class RunnableAdapter<R(__stdcall *)(A1, A2)> {
|
||||
class RunnableAdapter<R(__stdcall*)(A1, A2)> {
|
||||
public:
|
||||
typedef R (RunType)(A1, A2);
|
||||
typedef R(RunType)(A1, A2);
|
||||
|
||||
explicit RunnableAdapter(R(__stdcall *function)(A1, A2))
|
||||
: function_(function) {
|
||||
}
|
||||
explicit RunnableAdapter(R(__stdcall* function)(A1, A2))
|
||||
: function_(function) {}
|
||||
|
||||
R Run(typename CallbackParamTraits<A1>::ForwardType a1,
|
||||
typename CallbackParamTraits<A2>::ForwardType a2) {
|
||||
typename CallbackParamTraits<A2>::ForwardType a2) {
|
||||
return function_(a1, a2);
|
||||
}
|
||||
|
||||
private:
|
||||
R (__stdcall *function_)(A1, A2);
|
||||
R(__stdcall* function_)(A1, A2);
|
||||
};
|
||||
|
||||
// __fastcall Function: Arity 2.
|
||||
template <typename R, typename A1, typename A2>
|
||||
class RunnableAdapter<R(__fastcall *)(A1, A2)> {
|
||||
class RunnableAdapter<R(__fastcall*)(A1, A2)> {
|
||||
public:
|
||||
typedef R (RunType)(A1, A2);
|
||||
typedef R(RunType)(A1, A2);
|
||||
|
||||
explicit RunnableAdapter(R(__fastcall *function)(A1, A2))
|
||||
: function_(function) {
|
||||
}
|
||||
explicit RunnableAdapter(R(__fastcall* function)(A1, A2))
|
||||
: function_(function) {}
|
||||
|
||||
R Run(typename CallbackParamTraits<A1>::ForwardType a1,
|
||||
typename CallbackParamTraits<A2>::ForwardType a2) {
|
||||
typename CallbackParamTraits<A2>::ForwardType a2) {
|
||||
return function_(a1, a2);
|
||||
}
|
||||
|
||||
private:
|
||||
R (__fastcall *function_)(A1, A2);
|
||||
R(__fastcall* function_)(A1, A2);
|
||||
};
|
||||
|
||||
// __stdcall Function: Arity 3.
|
||||
template <typename R, typename A1, typename A2, typename A3>
|
||||
class RunnableAdapter<R(__stdcall *)(A1, A2, A3)> {
|
||||
class RunnableAdapter<R(__stdcall*)(A1, A2, A3)> {
|
||||
public:
|
||||
typedef R (RunType)(A1, A2, A3);
|
||||
typedef R(RunType)(A1, A2, A3);
|
||||
|
||||
explicit RunnableAdapter(R(__stdcall *function)(A1, A2, A3))
|
||||
: function_(function) {
|
||||
}
|
||||
explicit RunnableAdapter(R(__stdcall* function)(A1, A2, A3))
|
||||
: function_(function) {}
|
||||
|
||||
R Run(typename CallbackParamTraits<A1>::ForwardType a1,
|
||||
typename CallbackParamTraits<A2>::ForwardType a2,
|
||||
typename CallbackParamTraits<A3>::ForwardType a3) {
|
||||
typename CallbackParamTraits<A2>::ForwardType a2,
|
||||
typename CallbackParamTraits<A3>::ForwardType a3) {
|
||||
return function_(a1, a2, a3);
|
||||
}
|
||||
|
||||
private:
|
||||
R (__stdcall *function_)(A1, A2, A3);
|
||||
R(__stdcall* function_)(A1, A2, A3);
|
||||
};
|
||||
|
||||
// __fastcall Function: Arity 3.
|
||||
template <typename R, typename A1, typename A2, typename A3>
|
||||
class RunnableAdapter<R(__fastcall *)(A1, A2, A3)> {
|
||||
class RunnableAdapter<R(__fastcall*)(A1, A2, A3)> {
|
||||
public:
|
||||
typedef R (RunType)(A1, A2, A3);
|
||||
typedef R(RunType)(A1, A2, A3);
|
||||
|
||||
explicit RunnableAdapter(R(__fastcall *function)(A1, A2, A3))
|
||||
: function_(function) {
|
||||
}
|
||||
explicit RunnableAdapter(R(__fastcall* function)(A1, A2, A3))
|
||||
: function_(function) {}
|
||||
|
||||
R Run(typename CallbackParamTraits<A1>::ForwardType a1,
|
||||
typename CallbackParamTraits<A2>::ForwardType a2,
|
||||
typename CallbackParamTraits<A3>::ForwardType a3) {
|
||||
typename CallbackParamTraits<A2>::ForwardType a2,
|
||||
typename CallbackParamTraits<A3>::ForwardType a3) {
|
||||
return function_(a1, a2, a3);
|
||||
}
|
||||
|
||||
private:
|
||||
R (__fastcall *function_)(A1, A2, A3);
|
||||
R(__fastcall* function_)(A1, A2, A3);
|
||||
};
|
||||
|
||||
// __stdcall Function: Arity 4.
|
||||
template <typename R, typename A1, typename A2, typename A3, typename A4>
|
||||
class RunnableAdapter<R(__stdcall *)(A1, A2, A3, A4)> {
|
||||
class RunnableAdapter<R(__stdcall*)(A1, A2, A3, A4)> {
|
||||
public:
|
||||
typedef R (RunType)(A1, A2, A3, A4);
|
||||
typedef R(RunType)(A1, A2, A3, A4);
|
||||
|
||||
explicit RunnableAdapter(R(__stdcall *function)(A1, A2, A3, A4))
|
||||
: function_(function) {
|
||||
}
|
||||
explicit RunnableAdapter(R(__stdcall* function)(A1, A2, A3, A4))
|
||||
: function_(function) {}
|
||||
|
||||
R Run(typename CallbackParamTraits<A1>::ForwardType a1,
|
||||
typename CallbackParamTraits<A2>::ForwardType a2,
|
||||
typename CallbackParamTraits<A3>::ForwardType a3,
|
||||
typename CallbackParamTraits<A4>::ForwardType a4) {
|
||||
typename CallbackParamTraits<A2>::ForwardType a2,
|
||||
typename CallbackParamTraits<A3>::ForwardType a3,
|
||||
typename CallbackParamTraits<A4>::ForwardType a4) {
|
||||
return function_(a1, a2, a3, a4);
|
||||
}
|
||||
|
||||
private:
|
||||
R (__stdcall *function_)(A1, A2, A3, A4);
|
||||
R(__stdcall* function_)(A1, A2, A3, A4);
|
||||
};
|
||||
|
||||
// __fastcall Function: Arity 4.
|
||||
template <typename R, typename A1, typename A2, typename A3, typename A4>
|
||||
class RunnableAdapter<R(__fastcall *)(A1, A2, A3, A4)> {
|
||||
class RunnableAdapter<R(__fastcall*)(A1, A2, A3, A4)> {
|
||||
public:
|
||||
typedef R (RunType)(A1, A2, A3, A4);
|
||||
typedef R(RunType)(A1, A2, A3, A4);
|
||||
|
||||
explicit RunnableAdapter(R(__fastcall *function)(A1, A2, A3, A4))
|
||||
: function_(function) {
|
||||
}
|
||||
explicit RunnableAdapter(R(__fastcall* function)(A1, A2, A3, A4))
|
||||
: function_(function) {}
|
||||
|
||||
R Run(typename CallbackParamTraits<A1>::ForwardType a1,
|
||||
typename CallbackParamTraits<A2>::ForwardType a2,
|
||||
typename CallbackParamTraits<A3>::ForwardType a3,
|
||||
typename CallbackParamTraits<A4>::ForwardType a4) {
|
||||
typename CallbackParamTraits<A2>::ForwardType a2,
|
||||
typename CallbackParamTraits<A3>::ForwardType a3,
|
||||
typename CallbackParamTraits<A4>::ForwardType a4) {
|
||||
return function_(a1, a2, a3, a4);
|
||||
}
|
||||
|
||||
private:
|
||||
R (__fastcall *function_)(A1, A2, A3, A4);
|
||||
R(__fastcall* function_)(A1, A2, A3, A4);
|
||||
};
|
||||
|
||||
// __stdcall Function: Arity 5.
|
||||
template <typename R, typename A1, typename A2, typename A3, typename A4,
|
||||
typename A5>
|
||||
class RunnableAdapter<R(__stdcall *)(A1, A2, A3, A4, A5)> {
|
||||
template <typename R,
|
||||
typename A1,
|
||||
typename A2,
|
||||
typename A3,
|
||||
typename A4,
|
||||
typename A5>
|
||||
class RunnableAdapter<R(__stdcall*)(A1, A2, A3, A4, A5)> {
|
||||
public:
|
||||
typedef R (RunType)(A1, A2, A3, A4, A5);
|
||||
typedef R(RunType)(A1, A2, A3, A4, A5);
|
||||
|
||||
explicit RunnableAdapter(R(__stdcall *function)(A1, A2, A3, A4, A5))
|
||||
: function_(function) {
|
||||
}
|
||||
explicit RunnableAdapter(R(__stdcall* function)(A1, A2, A3, A4, A5))
|
||||
: function_(function) {}
|
||||
|
||||
R Run(typename CallbackParamTraits<A1>::ForwardType a1,
|
||||
typename CallbackParamTraits<A2>::ForwardType a2,
|
||||
typename CallbackParamTraits<A3>::ForwardType a3,
|
||||
typename CallbackParamTraits<A4>::ForwardType a4,
|
||||
typename CallbackParamTraits<A5>::ForwardType a5) {
|
||||
typename CallbackParamTraits<A2>::ForwardType a2,
|
||||
typename CallbackParamTraits<A3>::ForwardType a3,
|
||||
typename CallbackParamTraits<A4>::ForwardType a4,
|
||||
typename CallbackParamTraits<A5>::ForwardType a5) {
|
||||
return function_(a1, a2, a3, a4, a5);
|
||||
}
|
||||
|
||||
private:
|
||||
R (__stdcall *function_)(A1, A2, A3, A4, A5);
|
||||
R(__stdcall* function_)(A1, A2, A3, A4, A5);
|
||||
};
|
||||
|
||||
// __fastcall Function: Arity 5.
|
||||
template <typename R, typename A1, typename A2, typename A3, typename A4,
|
||||
typename A5>
|
||||
class RunnableAdapter<R(__fastcall *)(A1, A2, A3, A4, A5)> {
|
||||
template <typename R,
|
||||
typename A1,
|
||||
typename A2,
|
||||
typename A3,
|
||||
typename A4,
|
||||
typename A5>
|
||||
class RunnableAdapter<R(__fastcall*)(A1, A2, A3, A4, A5)> {
|
||||
public:
|
||||
typedef R (RunType)(A1, A2, A3, A4, A5);
|
||||
typedef R(RunType)(A1, A2, A3, A4, A5);
|
||||
|
||||
explicit RunnableAdapter(R(__fastcall *function)(A1, A2, A3, A4, A5))
|
||||
: function_(function) {
|
||||
}
|
||||
explicit RunnableAdapter(R(__fastcall* function)(A1, A2, A3, A4, A5))
|
||||
: function_(function) {}
|
||||
|
||||
R Run(typename CallbackParamTraits<A1>::ForwardType a1,
|
||||
typename CallbackParamTraits<A2>::ForwardType a2,
|
||||
typename CallbackParamTraits<A3>::ForwardType a3,
|
||||
typename CallbackParamTraits<A4>::ForwardType a4,
|
||||
typename CallbackParamTraits<A5>::ForwardType a5) {
|
||||
typename CallbackParamTraits<A2>::ForwardType a2,
|
||||
typename CallbackParamTraits<A3>::ForwardType a3,
|
||||
typename CallbackParamTraits<A4>::ForwardType a4,
|
||||
typename CallbackParamTraits<A5>::ForwardType a5) {
|
||||
return function_(a1, a2, a3, a4, a5);
|
||||
}
|
||||
|
||||
private:
|
||||
R (__fastcall *function_)(A1, A2, A3, A4, A5);
|
||||
R(__fastcall* function_)(A1, A2, A3, A4, A5);
|
||||
};
|
||||
|
||||
// __stdcall Function: Arity 6.
|
||||
template <typename R, typename A1, typename A2, typename A3, typename A4,
|
||||
typename A5, typename A6>
|
||||
class RunnableAdapter<R(__stdcall *)(A1, A2, A3, A4, A5, A6)> {
|
||||
template <typename R,
|
||||
typename A1,
|
||||
typename A2,
|
||||
typename A3,
|
||||
typename A4,
|
||||
typename A5,
|
||||
typename A6>
|
||||
class RunnableAdapter<R(__stdcall*)(A1, A2, A3, A4, A5, A6)> {
|
||||
public:
|
||||
typedef R (RunType)(A1, A2, A3, A4, A5, A6);
|
||||
typedef R(RunType)(A1, A2, A3, A4, A5, A6);
|
||||
|
||||
explicit RunnableAdapter(R(__stdcall *function)(A1, A2, A3, A4, A5, A6))
|
||||
: function_(function) {
|
||||
}
|
||||
explicit RunnableAdapter(R(__stdcall* function)(A1, A2, A3, A4, A5, A6))
|
||||
: function_(function) {}
|
||||
|
||||
R Run(typename CallbackParamTraits<A1>::ForwardType a1,
|
||||
typename CallbackParamTraits<A2>::ForwardType a2,
|
||||
typename CallbackParamTraits<A3>::ForwardType a3,
|
||||
typename CallbackParamTraits<A4>::ForwardType a4,
|
||||
typename CallbackParamTraits<A5>::ForwardType a5,
|
||||
typename CallbackParamTraits<A6>::ForwardType a6) {
|
||||
typename CallbackParamTraits<A2>::ForwardType a2,
|
||||
typename CallbackParamTraits<A3>::ForwardType a3,
|
||||
typename CallbackParamTraits<A4>::ForwardType a4,
|
||||
typename CallbackParamTraits<A5>::ForwardType a5,
|
||||
typename CallbackParamTraits<A6>::ForwardType a6) {
|
||||
return function_(a1, a2, a3, a4, a5, a6);
|
||||
}
|
||||
|
||||
private:
|
||||
R (__stdcall *function_)(A1, A2, A3, A4, A5, A6);
|
||||
R(__stdcall* function_)(A1, A2, A3, A4, A5, A6);
|
||||
};
|
||||
|
||||
// __fastcall Function: Arity 6.
|
||||
template <typename R, typename A1, typename A2, typename A3, typename A4,
|
||||
typename A5, typename A6>
|
||||
class RunnableAdapter<R(__fastcall *)(A1, A2, A3, A4, A5, A6)> {
|
||||
template <typename R,
|
||||
typename A1,
|
||||
typename A2,
|
||||
typename A3,
|
||||
typename A4,
|
||||
typename A5,
|
||||
typename A6>
|
||||
class RunnableAdapter<R(__fastcall*)(A1, A2, A3, A4, A5, A6)> {
|
||||
public:
|
||||
typedef R (RunType)(A1, A2, A3, A4, A5, A6);
|
||||
typedef R(RunType)(A1, A2, A3, A4, A5, A6);
|
||||
|
||||
explicit RunnableAdapter(R(__fastcall *function)(A1, A2, A3, A4, A5, A6))
|
||||
: function_(function) {
|
||||
}
|
||||
explicit RunnableAdapter(R(__fastcall* function)(A1, A2, A3, A4, A5, A6))
|
||||
: function_(function) {}
|
||||
|
||||
R Run(typename CallbackParamTraits<A1>::ForwardType a1,
|
||||
typename CallbackParamTraits<A2>::ForwardType a2,
|
||||
typename CallbackParamTraits<A3>::ForwardType a3,
|
||||
typename CallbackParamTraits<A4>::ForwardType a4,
|
||||
typename CallbackParamTraits<A5>::ForwardType a5,
|
||||
typename CallbackParamTraits<A6>::ForwardType a6) {
|
||||
typename CallbackParamTraits<A2>::ForwardType a2,
|
||||
typename CallbackParamTraits<A3>::ForwardType a3,
|
||||
typename CallbackParamTraits<A4>::ForwardType a4,
|
||||
typename CallbackParamTraits<A5>::ForwardType a5,
|
||||
typename CallbackParamTraits<A6>::ForwardType a6) {
|
||||
return function_(a1, a2, a3, a4, a5, a6);
|
||||
}
|
||||
|
||||
private:
|
||||
R (__fastcall *function_)(A1, A2, A3, A4, A5, A6);
|
||||
R(__fastcall* function_)(A1, A2, A3, A4, A5, A6);
|
||||
};
|
||||
|
||||
// __stdcall Function: Arity 7.
|
||||
template <typename R, typename A1, typename A2, typename A3, typename A4,
|
||||
typename A5, typename A6, typename A7>
|
||||
class RunnableAdapter<R(__stdcall *)(A1, A2, A3, A4, A5, A6, A7)> {
|
||||
template <typename R,
|
||||
typename A1,
|
||||
typename A2,
|
||||
typename A3,
|
||||
typename A4,
|
||||
typename A5,
|
||||
typename A6,
|
||||
typename A7>
|
||||
class RunnableAdapter<R(__stdcall*)(A1, A2, A3, A4, A5, A6, A7)> {
|
||||
public:
|
||||
typedef R (RunType)(A1, A2, A3, A4, A5, A6, A7);
|
||||
typedef R(RunType)(A1, A2, A3, A4, A5, A6, A7);
|
||||
|
||||
explicit RunnableAdapter(R(__stdcall *function)(A1, A2, A3, A4, A5, A6, A7))
|
||||
: function_(function) {
|
||||
}
|
||||
explicit RunnableAdapter(R(__stdcall* function)(A1, A2, A3, A4, A5, A6, A7))
|
||||
: function_(function) {}
|
||||
|
||||
R Run(typename CallbackParamTraits<A1>::ForwardType a1,
|
||||
typename CallbackParamTraits<A2>::ForwardType a2,
|
||||
typename CallbackParamTraits<A3>::ForwardType a3,
|
||||
typename CallbackParamTraits<A4>::ForwardType a4,
|
||||
typename CallbackParamTraits<A5>::ForwardType a5,
|
||||
typename CallbackParamTraits<A6>::ForwardType a6,
|
||||
typename CallbackParamTraits<A7>::ForwardType a7) {
|
||||
typename CallbackParamTraits<A2>::ForwardType a2,
|
||||
typename CallbackParamTraits<A3>::ForwardType a3,
|
||||
typename CallbackParamTraits<A4>::ForwardType a4,
|
||||
typename CallbackParamTraits<A5>::ForwardType a5,
|
||||
typename CallbackParamTraits<A6>::ForwardType a6,
|
||||
typename CallbackParamTraits<A7>::ForwardType a7) {
|
||||
return function_(a1, a2, a3, a4, a5, a6, a7);
|
||||
}
|
||||
|
||||
private:
|
||||
R (__stdcall *function_)(A1, A2, A3, A4, A5, A6, A7);
|
||||
R(__stdcall* function_)(A1, A2, A3, A4, A5, A6, A7);
|
||||
};
|
||||
|
||||
// __fastcall Function: Arity 7.
|
||||
template <typename R, typename A1, typename A2, typename A3, typename A4,
|
||||
typename A5, typename A6, typename A7>
|
||||
class RunnableAdapter<R(__fastcall *)(A1, A2, A3, A4, A5, A6, A7)> {
|
||||
template <typename R,
|
||||
typename A1,
|
||||
typename A2,
|
||||
typename A3,
|
||||
typename A4,
|
||||
typename A5,
|
||||
typename A6,
|
||||
typename A7>
|
||||
class RunnableAdapter<R(__fastcall*)(A1, A2, A3, A4, A5, A6, A7)> {
|
||||
public:
|
||||
typedef R (RunType)(A1, A2, A3, A4, A5, A6, A7);
|
||||
typedef R(RunType)(A1, A2, A3, A4, A5, A6, A7);
|
||||
|
||||
explicit RunnableAdapter(R(__fastcall *function)(A1, A2, A3, A4, A5, A6, A7))
|
||||
: function_(function) {
|
||||
}
|
||||
explicit RunnableAdapter(R(__fastcall* function)(A1, A2, A3, A4, A5, A6, A7))
|
||||
: function_(function) {}
|
||||
|
||||
R Run(typename CallbackParamTraits<A1>::ForwardType a1,
|
||||
typename CallbackParamTraits<A2>::ForwardType a2,
|
||||
typename CallbackParamTraits<A3>::ForwardType a3,
|
||||
typename CallbackParamTraits<A4>::ForwardType a4,
|
||||
typename CallbackParamTraits<A5>::ForwardType a5,
|
||||
typename CallbackParamTraits<A6>::ForwardType a6,
|
||||
typename CallbackParamTraits<A7>::ForwardType a7) {
|
||||
typename CallbackParamTraits<A2>::ForwardType a2,
|
||||
typename CallbackParamTraits<A3>::ForwardType a3,
|
||||
typename CallbackParamTraits<A4>::ForwardType a4,
|
||||
typename CallbackParamTraits<A5>::ForwardType a5,
|
||||
typename CallbackParamTraits<A6>::ForwardType a6,
|
||||
typename CallbackParamTraits<A7>::ForwardType a7) {
|
||||
return function_(a1, a2, a3, a4, a5, a6, a7);
|
||||
}
|
||||
|
||||
private:
|
||||
R (__fastcall *function_)(A1, A2, A3, A4, A5, A6, A7);
|
||||
R(__fastcall* function_)(A1, A2, A3, A4, A5, A6, A7);
|
||||
};
|
||||
|
||||
} // namespace cef_internal
|
||||
|
@ -92,7 +92,7 @@ class CallbackBase {
|
||||
// another type. It is not okay to use void*. We create a InvokeFuncStorage
|
||||
// that that can store our function pointer, and then cast it back to
|
||||
// the original type on usage.
|
||||
typedef void(*InvokeFuncStorage)(void);
|
||||
typedef void (*InvokeFuncStorage)(void);
|
||||
|
||||
// Returns true if this callback equals |other|. |other| may be null.
|
||||
bool Equals(const CallbackBase& other) const;
|
||||
@ -115,15 +115,16 @@ class CallbackBase {
|
||||
// A helper template to determine if given type is non-const move-only-type,
|
||||
// i.e. if a value of the given type should be passed via .Pass() in a
|
||||
// destructive way.
|
||||
template <typename T> struct IsMoveOnlyType {
|
||||
template <typename T>
|
||||
struct IsMoveOnlyType {
|
||||
template <typename U>
|
||||
static YesType Test(const typename U::MoveOnlyTypeForCPP03*);
|
||||
|
||||
template <typename U>
|
||||
static NoType Test(...);
|
||||
|
||||
static const bool value = sizeof(Test<T>(0)) == sizeof(YesType) &&
|
||||
!is_const<T>::value;
|
||||
static const bool value =
|
||||
sizeof(Test<T>(0)) == sizeof(YesType) && !is_const<T>::value;
|
||||
};
|
||||
|
||||
// This is a typetraits object that's used to take an argument type, and
|
||||
|
@ -51,9 +51,7 @@ namespace cef_internal {
|
||||
template <typename T>
|
||||
struct NeedsScopedRefptrButGetsRawPtr {
|
||||
#if defined(OS_WIN)
|
||||
enum {
|
||||
value = base::false_type::value
|
||||
};
|
||||
enum { value = base::false_type::value };
|
||||
#else
|
||||
enum {
|
||||
// Human readable translation: you needed to be a scoped_refptr if you are a
|
||||
@ -77,74 +75,103 @@ struct ParamsUseScopedRefptrCorrectly<Tuple0> {
|
||||
};
|
||||
|
||||
template <typename A>
|
||||
struct ParamsUseScopedRefptrCorrectly<Tuple1<A> > {
|
||||
struct ParamsUseScopedRefptrCorrectly<Tuple1<A>> {
|
||||
enum { value = !NeedsScopedRefptrButGetsRawPtr<A>::value };
|
||||
};
|
||||
|
||||
template <typename A, typename B>
|
||||
struct ParamsUseScopedRefptrCorrectly<Tuple2<A, B> > {
|
||||
enum { value = !(NeedsScopedRefptrButGetsRawPtr<A>::value ||
|
||||
NeedsScopedRefptrButGetsRawPtr<B>::value) };
|
||||
struct ParamsUseScopedRefptrCorrectly<Tuple2<A, B>> {
|
||||
enum {
|
||||
value = !(NeedsScopedRefptrButGetsRawPtr<A>::value ||
|
||||
NeedsScopedRefptrButGetsRawPtr<B>::value)
|
||||
};
|
||||
};
|
||||
|
||||
template <typename A, typename B, typename C>
|
||||
struct ParamsUseScopedRefptrCorrectly<Tuple3<A, B, C> > {
|
||||
enum { value = !(NeedsScopedRefptrButGetsRawPtr<A>::value ||
|
||||
NeedsScopedRefptrButGetsRawPtr<B>::value ||
|
||||
NeedsScopedRefptrButGetsRawPtr<C>::value) };
|
||||
struct ParamsUseScopedRefptrCorrectly<Tuple3<A, B, C>> {
|
||||
enum {
|
||||
value = !(NeedsScopedRefptrButGetsRawPtr<A>::value ||
|
||||
NeedsScopedRefptrButGetsRawPtr<B>::value ||
|
||||
NeedsScopedRefptrButGetsRawPtr<C>::value)
|
||||
};
|
||||
};
|
||||
|
||||
template <typename A, typename B, typename C, typename D>
|
||||
struct ParamsUseScopedRefptrCorrectly<Tuple4<A, B, C, D> > {
|
||||
enum { value = !(NeedsScopedRefptrButGetsRawPtr<A>::value ||
|
||||
NeedsScopedRefptrButGetsRawPtr<B>::value ||
|
||||
NeedsScopedRefptrButGetsRawPtr<C>::value ||
|
||||
NeedsScopedRefptrButGetsRawPtr<D>::value) };
|
||||
struct ParamsUseScopedRefptrCorrectly<Tuple4<A, B, C, D>> {
|
||||
enum {
|
||||
value = !(NeedsScopedRefptrButGetsRawPtr<A>::value ||
|
||||
NeedsScopedRefptrButGetsRawPtr<B>::value ||
|
||||
NeedsScopedRefptrButGetsRawPtr<C>::value ||
|
||||
NeedsScopedRefptrButGetsRawPtr<D>::value)
|
||||
};
|
||||
};
|
||||
|
||||
template <typename A, typename B, typename C, typename D, typename E>
|
||||
struct ParamsUseScopedRefptrCorrectly<Tuple5<A, B, C, D, E> > {
|
||||
enum { value = !(NeedsScopedRefptrButGetsRawPtr<A>::value ||
|
||||
NeedsScopedRefptrButGetsRawPtr<B>::value ||
|
||||
NeedsScopedRefptrButGetsRawPtr<C>::value ||
|
||||
NeedsScopedRefptrButGetsRawPtr<D>::value ||
|
||||
NeedsScopedRefptrButGetsRawPtr<E>::value) };
|
||||
struct ParamsUseScopedRefptrCorrectly<Tuple5<A, B, C, D, E>> {
|
||||
enum {
|
||||
value = !(NeedsScopedRefptrButGetsRawPtr<A>::value ||
|
||||
NeedsScopedRefptrButGetsRawPtr<B>::value ||
|
||||
NeedsScopedRefptrButGetsRawPtr<C>::value ||
|
||||
NeedsScopedRefptrButGetsRawPtr<D>::value ||
|
||||
NeedsScopedRefptrButGetsRawPtr<E>::value)
|
||||
};
|
||||
};
|
||||
|
||||
template <typename A, typename B, typename C, typename D, typename E,
|
||||
template <typename A,
|
||||
typename B,
|
||||
typename C,
|
||||
typename D,
|
||||
typename E,
|
||||
typename F>
|
||||
struct ParamsUseScopedRefptrCorrectly<Tuple6<A, B, C, D, E, F> > {
|
||||
enum { value = !(NeedsScopedRefptrButGetsRawPtr<A>::value ||
|
||||
NeedsScopedRefptrButGetsRawPtr<B>::value ||
|
||||
NeedsScopedRefptrButGetsRawPtr<C>::value ||
|
||||
NeedsScopedRefptrButGetsRawPtr<D>::value ||
|
||||
NeedsScopedRefptrButGetsRawPtr<E>::value ||
|
||||
NeedsScopedRefptrButGetsRawPtr<F>::value) };
|
||||
struct ParamsUseScopedRefptrCorrectly<Tuple6<A, B, C, D, E, F>> {
|
||||
enum {
|
||||
value = !(NeedsScopedRefptrButGetsRawPtr<A>::value ||
|
||||
NeedsScopedRefptrButGetsRawPtr<B>::value ||
|
||||
NeedsScopedRefptrButGetsRawPtr<C>::value ||
|
||||
NeedsScopedRefptrButGetsRawPtr<D>::value ||
|
||||
NeedsScopedRefptrButGetsRawPtr<E>::value ||
|
||||
NeedsScopedRefptrButGetsRawPtr<F>::value)
|
||||
};
|
||||
};
|
||||
|
||||
template <typename A, typename B, typename C, typename D, typename E,
|
||||
typename F, typename G>
|
||||
struct ParamsUseScopedRefptrCorrectly<Tuple7<A, B, C, D, E, F, G> > {
|
||||
enum { value = !(NeedsScopedRefptrButGetsRawPtr<A>::value ||
|
||||
NeedsScopedRefptrButGetsRawPtr<B>::value ||
|
||||
NeedsScopedRefptrButGetsRawPtr<C>::value ||
|
||||
NeedsScopedRefptrButGetsRawPtr<D>::value ||
|
||||
NeedsScopedRefptrButGetsRawPtr<E>::value ||
|
||||
NeedsScopedRefptrButGetsRawPtr<F>::value ||
|
||||
NeedsScopedRefptrButGetsRawPtr<G>::value) };
|
||||
template <typename A,
|
||||
typename B,
|
||||
typename C,
|
||||
typename D,
|
||||
typename E,
|
||||
typename F,
|
||||
typename G>
|
||||
struct ParamsUseScopedRefptrCorrectly<Tuple7<A, B, C, D, E, F, G>> {
|
||||
enum {
|
||||
value = !(NeedsScopedRefptrButGetsRawPtr<A>::value ||
|
||||
NeedsScopedRefptrButGetsRawPtr<B>::value ||
|
||||
NeedsScopedRefptrButGetsRawPtr<C>::value ||
|
||||
NeedsScopedRefptrButGetsRawPtr<D>::value ||
|
||||
NeedsScopedRefptrButGetsRawPtr<E>::value ||
|
||||
NeedsScopedRefptrButGetsRawPtr<F>::value ||
|
||||
NeedsScopedRefptrButGetsRawPtr<G>::value)
|
||||
};
|
||||
};
|
||||
|
||||
template <typename A, typename B, typename C, typename D, typename E,
|
||||
typename F, typename G, typename H>
|
||||
struct ParamsUseScopedRefptrCorrectly<Tuple8<A, B, C, D, E, F, G, H> > {
|
||||
enum { value = !(NeedsScopedRefptrButGetsRawPtr<A>::value ||
|
||||
NeedsScopedRefptrButGetsRawPtr<B>::value ||
|
||||
NeedsScopedRefptrButGetsRawPtr<C>::value ||
|
||||
NeedsScopedRefptrButGetsRawPtr<D>::value ||
|
||||
NeedsScopedRefptrButGetsRawPtr<E>::value ||
|
||||
NeedsScopedRefptrButGetsRawPtr<F>::value ||
|
||||
NeedsScopedRefptrButGetsRawPtr<G>::value ||
|
||||
NeedsScopedRefptrButGetsRawPtr<H>::value) };
|
||||
template <typename A,
|
||||
typename B,
|
||||
typename C,
|
||||
typename D,
|
||||
typename E,
|
||||
typename F,
|
||||
typename G,
|
||||
typename H>
|
||||
struct ParamsUseScopedRefptrCorrectly<Tuple8<A, B, C, D, E, F, G, H>> {
|
||||
enum {
|
||||
value = !(NeedsScopedRefptrButGetsRawPtr<A>::value ||
|
||||
NeedsScopedRefptrButGetsRawPtr<B>::value ||
|
||||
NeedsScopedRefptrButGetsRawPtr<C>::value ||
|
||||
NeedsScopedRefptrButGetsRawPtr<D>::value ||
|
||||
NeedsScopedRefptrButGetsRawPtr<E>::value ||
|
||||
NeedsScopedRefptrButGetsRawPtr<F>::value ||
|
||||
NeedsScopedRefptrButGetsRawPtr<G>::value ||
|
||||
NeedsScopedRefptrButGetsRawPtr<H>::value)
|
||||
};
|
||||
};
|
||||
|
||||
} // namespace cef_internal
|
||||
|
Reference in New Issue
Block a user