diff options
author | mtklein <mtklein@chromium.org> | 2014-07-08 19:37:47 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-07-08 19:37:47 -0700 |
commit | 0b544ae222aab1c5d9122a8dfe2800451b31d979 (patch) | |
tree | 1db2485f18f76cffa8f9ad131cbe35e1c229a461 /include/core/SkPixelRef.h | |
parent | 10586dc172ca7c106a13aae718328c03eccf2ba9 (diff) |
Add SkRacy
SkRacy<T> is a zero-overhead wrapper for a T, except it also
silences race warnings when TSAN is running.
Here we apply in several classes. In SkMatrix and SkPathRef,
we use it to opportunistically cache some idempotent work.
In SkPixelRef, we wrap the genIDs. We think the worst that
can happen here is we'll increment the global next-genID a
few times instead of once when we go to get another ID.
BUG=skia:
Committed: https://skia.googlesource.com/skia/+/d5e3e6ae1b3434ad1158f441902ff65f1eeaa3a7
CQ_EXTRA_TRYBOTS=tryserver.skia:Canary-Chrome-Ubuntu13.10-Ninja-x86_64-ToT-Trybot,Canary-Chrome-Win7-Ninja-x86-SharedLib_ToT-Trybot,Test-Ubuntu13.10-GCE-NoGPU-x86_64-Release-TSAN-Trybot
R=reed@google.com, mtklein@google.com
Author: mtklein@chromium.org
Review URL: https://codereview.chromium.org/371363004
Diffstat (limited to 'include/core/SkPixelRef.h')
-rw-r--r-- | include/core/SkPixelRef.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/include/core/SkPixelRef.h b/include/core/SkPixelRef.h index a997993eb1..263145ba3d 100644 --- a/include/core/SkPixelRef.h +++ b/include/core/SkPixelRef.h @@ -9,6 +9,7 @@ #define SkPixelRef_DEFINED #include "SkBitmap.h" +#include "SkDynamicAnnotations.h" #include "SkRefCnt.h" #include "SkString.h" #include "SkFlattenable.h" @@ -349,8 +350,8 @@ private: LockRec fRec; int fLockCount; - mutable uint32_t fGenerationID; - mutable bool fUniqueGenerationID; + mutable SkTRacy<uint32_t> fGenerationID; + mutable SkTRacy<bool> fUniqueGenerationID; SkTDArray<GenIDChangeListener*> fGenIDChangeListeners; // pointers are owned |