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
This commit is contained in:
mtklein 2015-02-12 15:32:07 -08:00 committed by Commit bot
parent 71409c83e6
commit 0a62ad734c
2 changed files with 21 additions and 2 deletions

View File

@ -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

View File

@ -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