Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(89)

Unified Diff: third_party/harfbuzz-ng/src/hb-atomic-private.hh

Issue 10915172: harfbuzz-ng roll (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/harfbuzz-ng/harfbuzz.gyp ('k') | third_party/harfbuzz-ng/src/hb-blob.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/harfbuzz-ng/src/hb-atomic-private.hh
diff --git a/third_party/harfbuzz-ng/src/hb-atomic-private.hh b/third_party/harfbuzz-ng/src/hb-atomic-private.hh
index c543a8d936510d0e3dbddb60cd9763bcbe770ec1..4ae5b866a5fdc2472b81ec19c8f01d94426370f2 100644
--- a/third_party/harfbuzz-ng/src/hb-atomic-private.hh
+++ b/third_party/harfbuzz-ng/src/hb-atomic-private.hh
@@ -42,16 +42,28 @@
#if 0
-#elif !defined(HB_NO_MT) && defined(_MSC_VER) && _MSC_VER >= 1600
+#elif !defined(HB_NO_MT) && defined(_MSC_VER) || defined(__MINGW32__)
-#include <intrin.h>
-#pragma intrinsic(_InterlockedExchangeAdd, _InterlockedCompareExchangePointer)
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+
+/* mingw32 does not have MemoryBarrier.
+ * MemoryBarrier may be defined as a macro or a function.
+ * Just make a failsafe version for ourselves. */
+#ifdef MemoryBarrier
+#define HBMemoryBarrier MemoryBarrier
+#else
+static inline void HBMemoryBarrier (void) {
+ long dummy = 0;
+ InterlockedExchange (&dummy, 1);
+}
+#endif
typedef long hb_atomic_int_t;
-#define hb_atomic_int_add(AI, V) _InterlockedExchangeAdd (&(AI), (V))
+#define hb_atomic_int_add(AI, V) InterlockedExchangeAdd (&(AI), (V))
-#define hb_atomic_ptr_get(P) (MemoryBarrier (), (void *) *(P))
-#define hb_atomic_ptr_cmpexch(P,O,N) (_InterlockedCompareExchangePointer ((void **) (P), (void *) (N), (void *) (O)) == (void *) (O))
+#define hb_atomic_ptr_get(P) (HBMemoryBarrier (), (void *) *(P))
+#define hb_atomic_ptr_cmpexch(P,O,N) (InterlockedCompareExchangePointer ((void **) (P), (void *) (N), (void *) (O)) == (void *) (O))
#elif !defined(HB_NO_MT) && defined(__APPLE__)
@@ -65,7 +77,7 @@ typedef int32_t hb_atomic_int_t;
#define hb_atomic_ptr_cmpexch(P,O,N) OSAtomicCompareAndSwapPtrBarrier ((void *) (O), (void *) (N), (void **) (P))
-#elif !defined(HB_NO_MT) && defined(HAVE_INTEL_ATOMIC_PRIMITIVES) && !defined(__MINGW32__)
+#elif !defined(HB_NO_MT) && defined(HAVE_INTEL_ATOMIC_PRIMITIVES)
typedef int hb_atomic_int_t;
#define hb_atomic_int_add(AI, V) __sync_fetch_and_add (&(AI), (V))
« no previous file with comments | « third_party/harfbuzz-ng/harfbuzz.gyp ('k') | third_party/harfbuzz-ng/src/hb-blob.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698