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

Side by Side Diff: third_party/harfbuzz-ng/src/hb-mutex-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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright © 2007 Chris Wilson 2 * Copyright © 2007 Chris Wilson
3 * Copyright © 2009,2010 Red Hat, Inc. 3 * Copyright © 2009,2010 Red Hat, Inc.
4 * Copyright © 2011,2012 Google, Inc. 4 * Copyright © 2011,2012 Google, Inc.
5 * 5 *
6 * This is part of HarfBuzz, a text shaping library. 6 * This is part of HarfBuzz, a text shaping library.
7 * 7 *
8 * Permission is hereby granted, without written agreement and without 8 * Permission is hereby granted, without written agreement and without
9 * license or royalty fees, to use, copy, modify, and distribute this 9 * license or royalty fees, to use, copy, modify, and distribute this
10 * software and its documentation for any purpose, provided that the 10 * software and its documentation for any purpose, provided that the
(...skipping 26 matching lines...) Expand all
37 37
38 /* mutex */ 38 /* mutex */
39 39
40 /* We need external help for these */ 40 /* We need external help for these */
41 41
42 #if 0 42 #if 0
43 43
44 44
45 #elif !defined(HB_NO_MT) && defined(_MSC_VER) || defined(__MINGW32__) 45 #elif !defined(HB_NO_MT) && defined(_MSC_VER) || defined(__MINGW32__)
46 46
47 #define WIN32_LEAN_AND_MEAN
47 #include <windows.h> 48 #include <windows.h>
48 typedef CRITICAL_SECTION hb_mutex_impl_t; 49 typedef CRITICAL_SECTION hb_mutex_impl_t;
49 #define HB_MUTEX_IMPL_INIT { NULL, 0, 0, NULL, NULL, 0 } 50 #define HB_MUTEX_IMPL_INIT { NULL, 0, 0, NULL, NULL, 0 }
50 #define hb_mutex_impl_init(M) InitializeCriticalSection (M) 51 #define hb_mutex_impl_init(M) InitializeCriticalSection (M)
51 #define hb_mutex_impl_lock(M) EnterCriticalSection (M) 52 #define hb_mutex_impl_lock(M) EnterCriticalSection (M)
52 #define hb_mutex_impl_unlock(M) LeaveCriticalSection (M) 53 #define hb_mutex_impl_unlock(M) LeaveCriticalSection (M)
53 #define hb_mutex_impl_finish(M) DeleteCriticalSection (M) 54 #define hb_mutex_impl_finish(M) DeleteCriticalSection (M)
54 55
55 56
56 #elif !defined(HB_NO_MT) && (defined(HAVE_PTHREAD) || defined(__APPLE__)) 57 #elif !defined(HB_NO_MT) && (defined(HAVE_PTHREAD) || defined(__APPLE__))
57 58
58 #include <pthread.h> 59 #include <pthread.h>
59 typedef pthread_mutex_t hb_mutex_impl_t; 60 typedef pthread_mutex_t hb_mutex_impl_t;
60 #define HB_MUTEX_IMPL_INIT PTHREAD_MUTEX_INITIALIZER 61 #define HB_MUTEX_IMPL_INIT PTHREAD_MUTEX_INITIALIZER
61 #define hb_mutex_impl_init(M) pthread_mutex_init (M, NULL) 62 #define hb_mutex_impl_init(M) pthread_mutex_init (M, NULL)
62 #define hb_mutex_impl_lock(M) pthread_mutex_lock (M) 63 #define hb_mutex_impl_lock(M) pthread_mutex_lock (M)
63 #define hb_mutex_impl_unlock(M) pthread_mutex_unlock (M) 64 #define hb_mutex_impl_unlock(M) pthread_mutex_unlock (M)
64 #define hb_mutex_impl_finish(M) pthread_mutex_destroy (M) 65 #define hb_mutex_impl_finish(M) pthread_mutex_destroy (M)
65 66
66 67
67 #elif !defined(HB_NO_MT) && defined(HAVE_GLIB) 68 #elif !defined(HB_NO_MT) && defined(HAVE_GLIB)
68 69
69 #include <glib.h> 70 #include <glib.h>
71 #if !GLIB_CHECK_VERSION(2,32,0)
70 typedef GStaticMutex hb_mutex_impl_t; 72 typedef GStaticMutex hb_mutex_impl_t;
71 #define HB_MUTEX_IMPL_INIT G_STATIC_MUTEX_INIT 73 #define HB_MUTEX_IMPL_INIT G_STATIC_MUTEX_INIT
72 #define hb_mutex_impl_init(M) g_static_mutex_init (M) 74 #define hb_mutex_impl_init(M) g_static_mutex_init (M)
73 #define hb_mutex_impl_lock(M) g_static_mutex_lock (M) 75 #define hb_mutex_impl_lock(M) g_static_mutex_lock (M)
74 #define hb_mutex_impl_unlock(M) g_static_mutex_unlock (M) 76 #define hb_mutex_impl_unlock(M) g_static_mutex_unlock (M)
75 #define hb_mutex_impl_finish(M) g_static_mutex_free (M) 77 #define hb_mutex_impl_finish(M) g_static_mutex_free (M)
78 #else
79 typedef GMutex hb_mutex_impl_t;
80 #define HB_MUTEX_IMPL_INIT {0}
81 #define hb_mutex_impl_init(M) g_mutex_init (M)
82 #define hb_mutex_impl_lock(M) g_mutex_lock (M)
83 #define hb_mutex_impl_unlock(M) g_mutex_unlock (M)
84 #define hb_mutex_impl_finish(M) g_mutex_clear (M)
85 #endif
76 86
77 87
78 #elif !defined(HB_NO_MT) && defined(HAVE_INTEL_ATOMIC_PRIMITIVES) 88 #elif !defined(HB_NO_MT) && defined(HAVE_INTEL_ATOMIC_PRIMITIVES)
79 89
80 #if defined(HAVE_SCHED_H) && defined(HAVE_SCHED_YIELD) 90 #if defined(HAVE_SCHED_H) && defined(HAVE_SCHED_YIELD)
81 # include <sched.h> 91 # include <sched.h>
82 # define HB_SCHED_YIELD() sched_yield () 92 # define HB_SCHED_YIELD() sched_yield ()
83 #else 93 #else
84 # define HB_SCHED_YIELD() HB_STMT_START {} HB_STMT_END 94 # define HB_SCHED_YIELD() HB_STMT_START {} HB_STMT_END
85 #endif 95 #endif
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 hb_mutex_impl_t m; 141 hb_mutex_impl_t m;
132 142
133 inline void init (void) { hb_mutex_impl_init (&m); } 143 inline void init (void) { hb_mutex_impl_init (&m); }
134 inline void lock (void) { hb_mutex_impl_lock (&m); } 144 inline void lock (void) { hb_mutex_impl_lock (&m); }
135 inline void unlock (void) { hb_mutex_impl_unlock (&m); } 145 inline void unlock (void) { hb_mutex_impl_unlock (&m); }
136 inline void finish (void) { hb_mutex_impl_finish (&m); } 146 inline void finish (void) { hb_mutex_impl_finish (&m); }
137 }; 147 };
138 148
139 149
140 #endif /* HB_MUTEX_PRIVATE_HH */ 150 #endif /* HB_MUTEX_PRIVATE_HH */
OLDNEW
« no previous file with comments | « third_party/harfbuzz-ng/src/hb-icu-le.cc ('k') | third_party/harfbuzz-ng/src/hb-object-private.hh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698