src/hb-object-private.hh


Log

Author Commit Date CI Message
Behdad Esfahbod 326b5ebf 2015-08-30T17:29:21 Poison freed objects such that double-free is detected Previously we were setting refcount of freed objects to the inert value, which was harmful because it caused further destroy()s of the freed object to NOT call free() and hence hide the bug. Indeed, after eb0bf3ae6688b7 test-object was double-free'ing objects and this was never caught on Linux. It only was caught as crashing on Mac. Now we poison refcount upon freeing and check that it's valid whenever reading it. Makes test-object fail now.
Konstantin Ritt 3f174cd0 2015-03-28T00:49:33 Minor refactoring to the atomics implementation s/atomic_int/atomic_int_impl/ and s/atomic_ptr/atomic_ptr_impl/ to bring it in par with hb_mutex_impl_t, then re-introduce hb_atomic_int_t as a wrapper around hb_atomic_int_impl_t. In hb_reference_count_t, make it clear the non-atomic get and set are intentional due to nature of the cases they are used in (comparison to -1 and the debug output/tracing).
Behdad Esfahbod 0d2c2f23 2014-08-14T13:25:55 Simplify hb-object
Behdad Esfahbod 9d861b81 2014-08-14T13:15:21 Really fix clang build this time
Behdad Esfahbod 272226f2 2014-08-14T13:11:33 Revert "Fix build on clang after previous commit" This reverts commit 9c80cbc87f23040a334e30c750f64523d9ef10c8.
Behdad Esfahbod 9c80cbc8 2014-08-14T13:09:52 Fix build on clang after previous commit
Behdad Esfahbod a5a27073 2014-08-14T13:05:36 Rewrite this==NULL checks to avoid undefined behavior Fixes https://code.google.com/p/chromium/issues/detail?id=403594
Behdad Esfahbod cd7ea4f7 2014-08-14T12:57:02 Make hb_object_t members private In preparation for fixing: https://code.google.com/p/chromium/issues/detail?id=403594
Behdad Esfahbod 7babfe5a 2012-12-04T00:35:54 Move object mutext into the user-data array We are not using it for anything lse it seems.
Behdad Esfahbod a1900114 2012-12-04T00:29:35 Remove unused functions
Behdad Esfahbod 2cf30196 2012-06-09T14:58:01 Add hb_object_lock/unlock()
Behdad Esfahbod bd300df9 2012-06-08T20:35:18 Minor
Behdad Esfahbod 6220e5fc 2012-06-06T03:30:09 Add ASSERT_POD for most objects
Behdad Esfahbod cdafe3a7 2012-06-05T16:34:49 Add gcc intrinsics implementations for atomic and mutex
Behdad Esfahbod 0e253e97 2012-06-05T15:37:19 Add a mutex to object header Removes one more static-initialization. A few more to go.
Behdad Esfahbod bf93b636 2012-06-05T14:17:32 Remove constructor from hb_prealloced_array_t This was causing all object types to be non-POD and have static initializers. We don't need that! Now, most nil objects just moved from .bss to .data. Fixing for that coming soon.
Behdad Esfahbod 3b8fd9c4 2012-06-03T15:54:19 Remove const from ref_count.ref_count According to Tom Hacohen this was breaking build with some compilers. In file included from hb-buffer-private.hh:35:0, from hb-ot-map-private.hh:32, from hb-ot-shape-private.hh:32, from hb-ot-shape.cc:29: hb-object-private.hh: In constructor '_hb_object_header_t::_hb_object_header_t()': hb-object-private.hh:97:8: error: uninitialized const member in 'struct hb_reference_count_t' hb-object-private.hh:51:25: note: 'hb_reference_count_t::ref_count' should be initialized In file included from hb-ot-shape.cc:33:0: hb-set-private.hh: In constructor '_hb_set_t::_hb_set_t()': hb-set-private.hh:37:8: note: synthesized method '_hb_object_header_t::_hb_object_header_t()' first required here hb-ot-shape.cc: In function 'void hb_ot_shape_glyphs_closure(hb_font_t*, hb_buffer_t*, const hb_feature_t*, unsigned int, hb_set_t*)': hb-ot-shape.cc:521:12: note: synthesized method '_hb_set_t::_hb_set_t()' first required here
Behdad Esfahbod 70600dbf 2012-06-03T15:52:51 Minor
Behdad Esfahbod 0558d55b 2012-05-28T10:46:47 Remove hb_atomic_int_set/get() We never use them in fact... I'm just adjusting these as I better understand the requirements of the code and the guarantees of each operation.
Behdad Esfahbod ec3ba4b9 2012-05-17T20:30:46 Move atomic ops into their own header
Behdad Esfahbod 7bd2b04f 2012-05-11T03:40:58 Minor
Behdad Esfahbod cf26510d 2012-05-11T03:35:08 Some more... Done. I promise.
Behdad Esfahbod bc71ad49 2012-03-01T17:30:29 Fix atomic-int op on Apple The OSAtomicAdd32Barrier operator returns the new value, we want the old value.
Behdad Esfahbod a1970d9a 2012-02-24T13:51:09 Add support for atomic int and mutex on Apple systems So, apparently there's no atomic int 'get' method on Apple. You have to add(0) to get. And that's not const-friendly. So switch inert-object checking to a non-atomic get. This, however, is safe, and a negligible performance boost too.
Behdad Esfahbod 80044291 2012-02-23T18:47:17 Remove unused hb_atomic_int_set() Apparently it can't be implemented on OS X. We weren't using it anyway.
Behdad Esfahbod bd7ff1de 2012-02-23T15:06:16 Allow disabling multi-threaded support By defining HB_NO_MT. Also, only warn once per missing MT feature support. Mozilla Bug 666661 - gfx/harfbuzz/src/hb-prive.h - compiler warnings on mac
Behdad Esfahbod af921354 2011-10-21T09:18:43 Minor
Behdad Esfahbod 89d89646 2011-10-17T11:50:54 Fix intrin.h b0rkage with older MSVC Reported by Jonathan Kew.
Behdad Esfahbod d5476a30 2011-09-16T12:30:50 Minor
Behdad Esfahbod 33ccc779 2011-08-09T00:43:24 [API] Make set_user_data() functions take a replace parameter We need this to set data on objects safely without worrying that some other thread unsets it by setting it at the same time.
Behdad Esfahbod c605bbbb 2011-08-04T20:00:53 Remove C++ guards from source files Where causing issues for people with MSVC.
Behdad Esfahbod cc06c243 2011-07-25T20:25:44 Streamline debugging infrastructure even more
Behdad Esfahbod 43ff203d 2011-07-25T17:35:24 Use variadic macros for debugging Looks *so* much nicer!
Behdad Esfahbod decd4e3e 2011-07-25T16:47:02 Add sugar syntax for debug messages Buffer debugging coming soon.
Behdad Esfahbod 31f18abe 2011-06-15T09:49:58 Minor compiler warning fixes
Behdad Esfahbod b9452bfc 2011-06-14T14:47:07 Fix compiler warnings with -pedantic
Behdad Esfahbod df077fad 2011-05-12T01:19:39 [object] Make object inert during destruction Such that user_data and other finalizers cannot resurrect object
Behdad Esfahbod 45bfa990 2011-05-10T19:12:49 Fix set implementation to be truly threadsafe even with destroy() callbacks The test/object test is passing again, instead of deadlocking.
Behdad Esfahbod 46df6828 2011-05-05T15:33:19 Make user_data access threadsafe For now, by taking a global user_data mutex.
Behdad Esfahbod 218e67b9 2011-05-05T15:28:37 Shrink code
Behdad Esfahbod b45f32ee 2011-05-05T15:00:43 Use hb_array_t for hb_language_t mapping
Behdad Esfahbod 21d2c92f 2011-05-05T14:47:53 Move code around
Behdad Esfahbod 811482bd 2011-05-05T13:21:04 Replace hb_map_t with hb_set_t which is more intuitive and flexible
Behdad Esfahbod 478a4253 2011-05-05T12:39:51 Make array/map implementation more generic
Behdad Esfahbod 56eb5ad6 2011-05-04T19:27:37 Move code around Mutex (and Windows.h by extension) are fairly isolated now.
Behdad Esfahbod 20001794 2011-05-03T00:49:06 Move Win32 thread-safety stuff to hb-object-private.h The Win32 definitions for LONG, ULONG, etc conflicts with hb-open-type.h. Avoid that by making sure hb-object-private.h and hb-open-type.h are not included in the same compilation unit.
Behdad Esfahbod 1cd5969f 2011-05-02T19:53:39 [object] Fix bug in get_user_data() implementation
Behdad Esfahbod 852e08ec 2011-04-27T21:45:51 Move code around
Behdad Esfahbod 29c67d3f 2011-04-27T21:22:32 Add initial implementation of user_data to objects
Behdad Esfahbod 47e71d96 2011-04-27T16:38:03 [object] Remove unnecessary use of macros
Behdad Esfahbod ae008b90 2011-04-27T16:12:12 [object] Add tracing support back in
Behdad Esfahbod 40a9b815 2011-04-27T01:48:56 Add TODO item
Behdad Esfahbod ec6f9c2f 2011-04-21T18:35:58 Further simplify object handling
Behdad Esfahbod fca368c4 2011-04-21T18:24:02 Add hb_object_header_t which is the common part of all objects Makes way for adding arbitrary user_data support.
Behdad Esfahbod a9f24c80 2011-04-21T17:18:22 Move hb_reference_count_t to hb-private.h
Behdad Esfahbod 2409d5f8 2011-04-21T17:14:28 Update Copyright headers
Behdad Esfahbod 24229eb1 2011-04-21T16:55:17 Remove obsolete comment Talking to Ryan Lortie, he thinks my comment doesn't make sense. So I'm making the getter const. Note that g_atomic_int_get() casts that away itself, so we don't need to worry about that (which kinda makes me uncomfortable actually).
Behdad Esfahbod 3e8bdbf9 2011-04-21T16:16:21 Cleanup hb_refrence_count_t
Behdad Esfahbod d18431b4 2011-04-20T18:59:10 Move hb_reference_count_t from macros to inline methods
Behdad Esfahbod c57d454a 2011-04-20T18:50:27 Rename all private sources and headers to C++ files So we can liberally use the simple features of C++ that parts of the codebase is already using.