Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Unified Diff: include/core/SkDynamicAnnotations.h

Issue 923543003: Revert of I cannot remember what the race here actually was. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | include/core/SkPixelRef.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkDynamicAnnotations.h
diff --git a/include/core/SkDynamicAnnotations.h b/include/core/SkDynamicAnnotations.h
index 108dd10f9c8798e0061d1bba9a50677118854b9c..e7710307f5532589a09b1f56d9b976cfdc373de7 100644
--- a/include/core/SkDynamicAnnotations.h
+++ b/include/core/SkDynamicAnnotations.h
@@ -66,4 +66,23 @@
#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
« no previous file with comments | « no previous file | include/core/SkPixelRef.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698