summaryrefslogtreecommitdiff
path: root/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-object.hh
diff options
context:
space:
mode:
Diffstat (limited to 'Build/source/libs/harfbuzz/harfbuzz-src/src/hb-object.hh')
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-object.hh19
1 files changed, 18 insertions, 1 deletions
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-object.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-object.hh
index 106f5920685..74340c555a8 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-object.hh
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-object.hh
@@ -194,9 +194,15 @@ struct hb_user_data_array_t
struct hb_object_header_t
{
hb_reference_count_t ref_count;
+ hb_atomic_int_t writable;
hb_atomic_ptr_t<hb_user_data_array_t> user_data;
};
-#define HB_OBJECT_HEADER_STATIC {HB_REFERENCE_COUNT_INIT, HB_ATOMIC_PTR_INIT (nullptr)}
+#define HB_OBJECT_HEADER_STATIC \
+ { \
+ HB_REFERENCE_COUNT_INIT, \
+ HB_ATOMIC_INT_INIT (false), \
+ HB_ATOMIC_PTR_INIT (nullptr) \
+ }
/*
@@ -228,6 +234,7 @@ template <typename Type>
static inline void hb_object_init (Type *obj)
{
obj->header.ref_count.init ();
+ obj->header.writable.set_relaxed (true);
obj->header.user_data.init ();
}
template <typename Type>
@@ -241,6 +248,16 @@ static inline bool hb_object_is_valid (const Type *obj)
return likely (obj->header.ref_count.is_valid ());
}
template <typename Type>
+static inline bool hb_object_is_immutable (const Type *obj)
+{
+ return !obj->header.writable.get_relaxed ();
+}
+template <typename Type>
+static inline void hb_object_make_immutable (const Type *obj)
+{
+ obj->header.writable.set_relaxed (false);
+}
+template <typename Type>
static inline Type *hb_object_reference (Type *obj)
{
hb_object_trace (obj, HB_FUNC);