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

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

Issue 2858683002: Roll HarfBuzz to 1.4.6 (Closed)
Patch Set: Rebase Created 3 years, 7 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
« no previous file with comments | « third_party/harfbuzz-ng/src/hb-shape-plan.cc ('k') | third_party/harfbuzz-ng/src/hb-version.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright © 2012 Google, Inc. 2 * Copyright © 2012 Google, Inc.
3 * 3 *
4 * This is part of HarfBuzz, a text shaping library. 4 * This is part of HarfBuzz, a text shaping library.
5 * 5 *
6 * Permission is hereby granted, without written agreement and without 6 * Permission is hereby granted, without written agreement and without
7 * license or royalty fees, to use, copy, modify, and distribute this 7 * license or royalty fees, to use, copy, modify, and distribute this
8 * software and its documentation for any purpose, provided that the 8 * software and its documentation for any purpose, provided that the
9 * above copyright notice and the following two paragraphs appear in 9 * above copyright notice and the following two paragraphs appear in
10 * all copies of this software. 10 * all copies of this software.
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 58
59 #define HB_SHAPERS_COUNT (sizeof (hb_shaper_data_t) / sizeof (void *)) 59 #define HB_SHAPERS_COUNT (sizeof (hb_shaper_data_t) / sizeof (void *))
60 60
61 /* Means: succeeded, but don't need to keep any data. */ 61 /* Means: succeeded, but don't need to keep any data. */
62 #define HB_SHAPER_DATA_SUCCEEDED ((void *) +1) 62 #define HB_SHAPER_DATA_SUCCEEDED ((void *) +1)
63 63
64 /* Means: tried but failed to create. */ 64 /* Means: tried but failed to create. */
65 #define HB_SHAPER_DATA_INVALID ((void *) -1) 65 #define HB_SHAPER_DATA_INVALID ((void *) -1)
66 #define HB_SHAPER_DATA_IS_INVALID(data) ((void *) (data) == HB_SHAPER_DATA_INVAL ID) 66 #define HB_SHAPER_DATA_IS_INVALID(data) ((void *) (data) == HB_SHAPER_DATA_INVAL ID)
67 67
68 #define HB_SHAPER_DATA_TYPE(shaper, object)» » struct hb_##shaper##_sha per_##object##_data_t 68 #define HB_SHAPER_DATA_TYPE_NAME(shaper, object)» hb_##shaper##_shaper_##o bject##_data_t
69 #define HB_SHAPER_DATA_TYPE(shaper, object)» » struct HB_SHAPER_DATA_TY PE_NAME(shaper, object)
69 #define HB_SHAPER_DATA_INSTANCE(shaper, object, instance) (* (HB_SHAPER_DA TA_TYPE(shaper, object) **) &(instance)->shaper_data.shaper) 70 #define HB_SHAPER_DATA_INSTANCE(shaper, object, instance) (* (HB_SHAPER_DA TA_TYPE(shaper, object) **) &(instance)->shaper_data.shaper)
70 #define HB_SHAPER_DATA(shaper, object)» » » HB_SHAPER_DATA_INSTANCE (shaper, object, object) 71 #define HB_SHAPER_DATA(shaper, object)» » » HB_SHAPER_DATA_INSTANCE( shaper, object, object)
71 #define HB_SHAPER_DATA_CREATE_FUNC(shaper, object) _hb_##shaper##_shaper_## object##_data_create 72 #define HB_SHAPER_DATA_CREATE_FUNC(shaper, object) _hb_##shaper##_shaper_## object##_data_create
72 #define HB_SHAPER_DATA_DESTROY_FUNC(shaper, object) _hb_##shaper##_shaper_## object##_data_destroy 73 #define HB_SHAPER_DATA_DESTROY_FUNC(shaper, object) _hb_##shaper##_shaper_## object##_data_destroy
74 #define HB_SHAPER_DATA_ENSURE_FUNC(shaper, object) hb_##shaper##_shaper_##o bject##_data_ensure
73 75
74 #define HB_SHAPER_DATA_PROTOTYPE(shaper, object) \ 76 #define HB_SHAPER_DATA_PROTOTYPE(shaper, object) \
75 HB_SHAPER_DATA_TYPE (shaper, object); /* Type forward declaration. */ \ 77 HB_SHAPER_DATA_TYPE (shaper, object); /* Type forward declaration. */ \
76 extern "C" HB_INTERNAL HB_SHAPER_DATA_TYPE (shaper, object) * \ 78 extern "C" HB_INTERNAL HB_SHAPER_DATA_TYPE (shaper, object) * \
77 HB_SHAPER_DATA_CREATE_FUNC (shaper, object) (hb_##object##_t *object HB_ SHAPER_DATA_CREATE_FUNC_EXTRA_ARGS); \ 79 HB_SHAPER_DATA_CREATE_FUNC (shaper, object) (hb_##object##_t *object HB_ SHAPER_DATA_CREATE_FUNC_EXTRA_ARGS); \
78 extern "C" HB_INTERNAL void \ 80 extern "C" HB_INTERNAL void \
79 » HB_SHAPER_DATA_DESTROY_FUNC (shaper, object) (HB_SHAPER_DATA_TYPE (shape r, object) *data) 81 » HB_SHAPER_DATA_DESTROY_FUNC (shaper, object) (HB_SHAPER_DATA_TYPE (shape r, object) *data); \
82 » extern "C" HB_INTERNAL bool \
83 » HB_SHAPER_DATA_ENSURE_FUNC (shaper, object) (hb_##object##_t *object)
80 84
81 #define HB_SHAPER_DATA_DESTROY(shaper, object) \ 85 #define HB_SHAPER_DATA_DESTROY(shaper, object) \
82 if (HB_SHAPER_DATA_TYPE (shaper, object) *data = HB_SHAPER_DATA (shaper, obj ect)) \ 86 if (HB_SHAPER_DATA_TYPE (shaper, object) *data = HB_SHAPER_DATA (shaper, obj ect)) \
83 if (data != HB_SHAPER_DATA_INVALID && data != HB_SHAPER_DATA_SUCCEEDED) \ 87 if (data != HB_SHAPER_DATA_INVALID && data != HB_SHAPER_DATA_SUCCEEDED) \
84 HB_SHAPER_DATA_DESTROY_FUNC (shaper, object) (data); 88 HB_SHAPER_DATA_DESTROY_FUNC (shaper, object) (data);
85 89
86 #define HB_SHAPER_DATA_ENSURE_DECLARE(shaper, object) \ 90 #define HB_SHAPER_DATA_ENSURE_DEFINE(shaper, object) \
87 static inline bool \ 91 bool \
88 hb_##shaper##_shaper_##object##_data_ensure (hb_##object##_t *object) \ 92 HB_SHAPER_DATA_ENSURE_FUNC(shaper, object) (hb_##object##_t *object) \
89 {\ 93 {\
90 retry: \ 94 retry: \
91 HB_SHAPER_DATA_TYPE (shaper, object) *data = (HB_SHAPER_DATA_TYPE (shaper, obj ect) *) hb_atomic_ptr_get (&HB_SHAPER_DATA (shaper, object)); \ 95 HB_SHAPER_DATA_TYPE (shaper, object) *data = (HB_SHAPER_DATA_TYPE (shaper, obj ect) *) hb_atomic_ptr_get (&HB_SHAPER_DATA (shaper, object)); \
92 if (unlikely (!data)) { \ 96 if (unlikely (!data)) { \
93 data = HB_SHAPER_DATA_CREATE_FUNC (shaper, object) (object); \ 97 data = HB_SHAPER_DATA_CREATE_FUNC (shaper, object) (object); \
94 if (unlikely (!data)) \ 98 if (unlikely (!data)) \
95 data = (HB_SHAPER_DATA_TYPE (shaper, object) *) HB_SHAPER_DATA_INVALID; \ 99 data = (HB_SHAPER_DATA_TYPE (shaper, object) *) HB_SHAPER_DATA_INVALID; \
96 if (!hb_atomic_ptr_cmpexch (&HB_SHAPER_DATA (shaper, object), NULL, data)) { \ 100 if (!hb_atomic_ptr_cmpexch (&HB_SHAPER_DATA (shaper, object), NULL, data)) { \
97 if (data && \ 101 if (data && \
98 data != HB_SHAPER_DATA_INVALID && \ 102 data != HB_SHAPER_DATA_INVALID && \
99 data != HB_SHAPER_DATA_SUCCEEDED) \ 103 data != HB_SHAPER_DATA_SUCCEEDED) \
100 HB_SHAPER_DATA_DESTROY_FUNC (shaper, object) (data); \ 104 HB_SHAPER_DATA_DESTROY_FUNC (shaper, object) (data); \
101 goto retry; \ 105 goto retry; \
102 } \ 106 } \
103 } \ 107 } \
104 return data != NULL && !HB_SHAPER_DATA_IS_INVALID (data); \ 108 return data != NULL && !HB_SHAPER_DATA_IS_INVALID (data); \
105 } 109 }
106 110
107 111
108 #endif /* HB_SHAPER_PRIVATE_HH */ 112 #endif /* HB_SHAPER_PRIVATE_HH */
OLDNEW
« no previous file with comments | « third_party/harfbuzz-ng/src/hb-shape-plan.cc ('k') | third_party/harfbuzz-ng/src/hb-version.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698