diff options
author | 2015-02-12 15:32:07 -0800 | |
---|---|---|
committer | 2015-02-12 15:32:07 -0800 | |
commit | 0a62ad734ccd5e52f5e08afd64c3d758711315d5 (patch) | |
tree | 70c7739376e398e46a7b23b18ef36a6e72b7a326 | |
parent | 71409c83e69b387b3c5d567197d0421c36baf68d (diff) |
Revert of I cannot remember what the race here actually was. (patchset #1 id:1 of https://codereview.chromium.org/922873002/)
Reason for revert:
http://build.chromium.org/p/client.skia/builders/Test-Ubuntu13.10-GCE-NoGPU-x86_64-Release-TSAN/builds/1557/steps/dm/logs/stdio
Original issue's description:
> I cannot remember what the race here actually was.
>
> Removing SkTRacy will show us, or perhaps show us we already fixed the race.
>
> BUG=chromium:437511
>
> No public API changes.
> TBR=reed@google.com
>
> Committed: https://skia.googlesource.com/skia/+/71409c83e69b387b3c5d567197d0421c36baf68d
TBR=bungeman@google.com,mtklein@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=chromium:437511
Review URL: https://codereview.chromium.org/923543003
-rw-r--r-- | include/core/SkDynamicAnnotations.h | 19 | ||||
-rw-r--r-- | include/core/SkPixelRef.h | 4 |
2 files changed, 21 insertions, 2 deletions
diff --git a/include/core/SkDynamicAnnotations.h b/include/core/SkDynamicAnnotations.h index 108dd10f9c..e7710307f5 100644 --- a/include/core/SkDynamicAnnotations.h +++ b/include/core/SkDynamicAnnotations.h @@ -66,4 +66,23 @@ void SK_ANNOTATE_BENIGN_RACE(T* ptr) { #endif +// Can be used to wrap values that are intentionally racy, usually small mutable cached values, e.g. +// - SkMatrix type mask +// - SkPixelRef genIDs +template <typename T> +class SkTRacy { +public: + operator const T() const { + return SK_ANNOTATE_UNPROTECTED_READ(fVal); + } + + SkTRacy& operator=(const T& val) { + SK_ANNOTATE_UNPROTECTED_WRITE(&fVal, val); + return *this; + } + +private: + T fVal; +}; + #endif//SkDynamicAnnotations_DEFINED diff --git a/include/core/SkPixelRef.h b/include/core/SkPixelRef.h index 9b98ebdf10..2a5e7ecbdc 100644 --- a/include/core/SkPixelRef.h +++ b/include/core/SkPixelRef.h @@ -353,8 +353,8 @@ private: LockRec fRec; int fLockCount; - mutable uint32_t fGenerationID; - mutable bool fUniqueGenerationID; + mutable SkTRacy<uint32_t> fGenerationID; + mutable SkTRacy<bool> fUniqueGenerationID; #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK const uint32_t fStableID; #endif |