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

Side by Side Diff: third_party/harfbuzz-ng/src/hb-mutex-private.hh

Issue 9223010: Update harfbuzz-ng to 1a5a91dc0d8bf4b72a2f22dc6300b06ad7000b79. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Don't use -M option for 'git diff' to patch correctly Created 8 years, 10 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
(Empty)
1 /*
2 * Copyright © 2007 Chris Wilson
3 * Copyright © 2009,2010 Red Hat, Inc.
4 * Copyright © 2011 Google, Inc.
5 *
6 * This is part of HarfBuzz, a text shaping library.
7 *
8 * Permission is hereby granted, without written agreement and without
9 * license or royalty fees, to use, copy, modify, and distribute this
10 * software and its documentation for any purpose, provided that the
11 * above copyright notice and the following two paragraphs appear in
12 * all copies of this software.
13 *
14 * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
15 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
16 * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
17 * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
18 * DAMAGE.
19 *
20 * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
21 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
22 * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
23 * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
24 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
25 *
26 * Contributor(s):
27 * Chris Wilson <chris@chris-wilson.co.uk>
28 * Red Hat Author(s): Behdad Esfahbod
29 * Google Author(s): Behdad Esfahbod
30 */
31
32 #ifndef HB_MUTEX_PRIVATE_HH
33 #define HB_MUTEX_PRIVATE_HH
34
35 #include "hb-private.hh"
36
37
38
39 /* mutex */
40
41 /* We need external help for these */
42
43 #ifdef HAVE_GLIB
44
45 #include <glib.h>
46
47 typedef GStaticMutex hb_mutex_impl_t;
48 #define HB_MUTEX_IMPL_INIT G_STATIC_MUTEX_INIT
49 #define hb_mutex_impl_init(M) g_static_mutex_init (M)
50 #define hb_mutex_impl_lock(M) g_static_mutex_lock (M)
51 #define hb_mutex_impl_unlock(M) g_static_mutex_unlock (M)
52 #define hb_mutex_impl_free(M) g_static_mutex_free (M)
53
54
55 #elif defined(_MSC_VER) || defined(__MINGW32__)
56
57 #include <windows.h>
58
59 typedef CRITICAL_SECTION hb_mutex_impl_t;
60 #define HB_MUTEX_IMPL_INIT { NULL, 0, 0, NULL, NULL, 0 }
61 #define hb_mutex_impl_init(M) InitializeCriticalSection (M)
62 #define hb_mutex_impl_lock(M) EnterCriticalSection (M)
63 #define hb_mutex_impl_unlock(M) LeaveCriticalSection (M)
64 #define hb_mutex_impl_free(M) DeleteCriticalSection (M)
65
66
67 #else
68
69 #warning "Could not find any system to define platform macros, library will NOT be thread-safe"
70
71 typedef volatile int hb_mutex_impl_t;
72 #define HB_MUTEX_IMPL_INIT 0
73 #define hb_mutex_impl_init(M) ((void) (*(M) = 0))
74 #define hb_mutex_impl_lock(M) ((void) (*(M) = 1))
75 #define hb_mutex_impl_unlock(M) ((void) (*(M) = 0))
76 #define hb_mutex_impl_free(M) ((void) (*(M) = 2))
77
78
79 #endif
80
81
82 struct hb_mutex_t
83 {
84 hb_mutex_impl_t m;
85
86 inline void init (void) { hb_mutex_impl_init (&m); }
87 inline void lock (void) { hb_mutex_impl_lock (&m); }
88 inline void unlock (void) { hb_mutex_impl_unlock (&m); }
89 inline void free (void) { hb_mutex_impl_free (&m); }
90 };
91
92 #define HB_MUTEX_INIT {HB_MUTEX_IMPL_INIT}
93 #define hb_mutex_init(M) (M)->init ()
94 #define hb_mutex_lock(M) (M)->lock ()
95 #define hb_mutex_unlock(M) (M)->unlock ()
96 #define hb_mutex_free(M) (M)->free ()
97
98
99 struct hb_static_mutex_t : hb_mutex_t
100 {
101 hb_static_mutex_t (void) { this->init (); }
102 ~hb_static_mutex_t (void) { this->free (); }
103
104 private:
105 NO_COPY (hb_static_mutex_t);
106 };
107
108
109
110 #endif /* HB_MUTEX_PRIVATE_HH */
OLDNEW
« no previous file with comments | « third_party/harfbuzz-ng/src/hb-language.c ('k') | third_party/harfbuzz-ng/src/hb-object-private.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698