Go to file
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
animations first cut at a checkbox 2009-10-21 19:41:10 +00:00
bench Mark overridden destructors with 'override' and remove 'virtual' 2017-03-22 16:06:18 +00:00
bin bin/fetch-clang-format 2017-03-08 16:43:49 +00:00
debugger Get Debugger app compiling again 2017-01-06 16:18:27 +00:00
dm Eager or Lazy evaluation of sub-drawings for SkDeferredCanvas. 2017-03-20 15:15:33 +00:00
example Add the ability to enable/disable GPU path renderers 2017-02-22 20:29:56 +00:00
experimental Mark overridden destructors with 'override' and remove 'virtual' 2017-03-22 16:06:18 +00:00
fuzz FuzzCanvas: NullGL & DebugGL 2017-03-21 20:30:38 +00:00
gm Make SkImageCacherator be deferred (take 2) 2017-03-23 13:10:45 +00:00
gn Revert "Remove Android-specific SK_SUPPORT_LEGACY_IMG_SNAPSHOT flag" 2017-03-22 14:18:15 +00:00
include Make reference counted assignment check for races. 2017-03-23 14:16:34 +00:00
infra Consolidate Linux GCE dimensions 2017-03-22 21:33:16 +00:00
platform_tools One-liner fix that allows Viewer to switch between Raster and OpenGL 2017-02-23 22:33:36 +00:00
resources Set a limit on the size for BMP images 2017-02-24 21:25:44 +00:00
samplecode Mark overridden destructors with 'override' and remove 'virtual' 2017-03-22 16:06:18 +00:00
site Add docs for iOS simulator build. 2017-03-21 17:12:46 +00:00
src Make SkImageCacherator be deferred (take 2) 2017-03-23 13:10:45 +00:00
tests Revert "Revert "Add support for writing icc profiles to the jpeg encoder"" 2017-03-22 21:52:57 +00:00
third_party Turn on x86-specific code when building zlib. 2017-03-23 13:36:31 +00:00
tools Mark overridden destructors with 'override' and remove 'virtual' 2017-03-22 16:06:18 +00:00
.clang-format Mark flatennable macros as block beginning/ending in .clang-format 2017-01-09 15:31:36 +00:00
.gitignore bin/fetch-clang-format 2017-03-08 16:43:49 +00:00
.gn Basic standalone GN configs. 2016-07-21 12:25:45 -07:00
AUTHORS Added support for building for tvOS 2017-03-14 22:55:04 +00:00
BUILD.gn Enable dng testing on windows 2017-03-21 17:28:21 +00:00
codereview.settings Make uploading to Gerrit the default for Skia 2016-11-09 19:07:56 +00:00
CONTRIBUTING Fix references to https://sites.google.com/site/skiadocs/. 2015-02-03 13:12:54 -02:00
CQ_COMMITTERS Moved committer list to chrome-infra-auth and deleted it from the repo 2015-09-02 13:37:54 -07:00
DEPS Update build tools to newer gn. 2017-03-17 17:38:58 +00:00
Doxyfile Make the housekeeper upload doxygen to a newer bucket 2016-10-04 13:23:57 -07:00
LICENSE BUG=skia:5602 2016-09-02 11:19:34 -07:00
PRESUBMIT.py Clean up more references to GYP. 2017-02-06 17:55:35 +00:00
public.bzl remove SK_SUPPORT_LEGACY_DRAWVERTICES_VIRTUAL flag 2017-03-21 10:11:35 +00:00
README Fix references to https://sites.google.com/site/skiadocs/. 2015-02-03 13:12:54 -02:00
README.chromium Update README.chromium. 2015-06-11 13:19:24 -07:00
whitespace.txt Skia Gerrit 10k! 2017-03-22 14:37:06 +00:00

Skia is a complete 2D graphic library for drawing Text, Geometries, and Images.

See full details, and build instructions, at https://skia.org.