skia2/include
Derek Sollenberger 6dd88144d5 Make reference counted assignment check for races.
If SkRefCnt_SafeAssign is erroneously invoked simultaneously by two
threads on the same destination, a likely outcome is that the
reference count of an object other than the replaced dst will
be decremented. This results in an extra reference count decrement,
which usually means that the final reference count decrement will
be applied to a random location in an object that has already been
reallocated.  This is exceedingly hard to debug.

We add a hack to detect such data races with sufficiently high
probability, so that such a data race bug should sometimes actually
generate bug reports that lend themselves to diagnosis.

We detect changes within a relatively larger range that normally
includes several (typically slow) memory fences.  Not all such changes
would provoke a crash. Even if we decrement the wrong reference count,
there's a chance we would decrement a dead location. Thus, to
avoid potentially adding instability, we currently only log.

This change tries to minimize additional runtime overhead.
The macro is only expanded a few dozen times, so we do not worry too
much about code size.

Bug: b/31227650
Change-Id: Ia40c9ed2c4d0fa578ea682fbec4b71a2ef22a5d1
Reviewed-on: https://skia-review.googlesource.com/9994
Commit-Queue: Derek Sollenberger <djsollen@google.com>
Reviewed-by: Mike Klein <mtklein@chromium.org>
2017-03-23 14:16:34 +00:00
..
android SkEncodeImage: no more link-time registration 2016-11-30 22:48:56 +00:00
c C API: document sk_matrix_t 2017-03-21 18:04:34 +00:00
codec Suggest P3 for wide gamut images in SkAndroidCodec 2017-02-15 14:35:48 +00:00
config Revert "Revert "SkUserConfig.h: remove out-of-date comment on SK_SFNTLY_SUBSETTER"" 2017-01-27 14:40:01 +00:00
core Make reference counted assignment check for races. 2017-03-23 14:16:34 +00:00
effects Mark overridden destructors with 'override' and remove 'virtual' 2017-03-22 16:06:18 +00:00
gpu Revert "Revert "Add a new GrResourceCache purging mechanism for purging unused resources."" 2017-03-22 20:08:21 +00:00
pathops use reversePathTo in place of addPathReverse 2016-11-07 05:09:28 -08:00
ports Add SkTypeface::getVariationDesignPosition. 2017-02-24 16:59:05 +00:00
private Add Swizzle FP, and remove swizzle logic from GrConfigConversionEffect 2017-03-22 19:16:30 +00:00
svg no need for SK_SUPPORT_LEGACY_CANVAS_IS_REFCNT anymore 2016-12-07 22:28:04 +00:00
utils Mark overridden destructors with 'override' and remove 'virtual' 2017-03-22 16:06:18 +00:00
views Mark overridden destructors with 'override' and remove 'virtual' 2017-03-22 16:06:18 +00:00