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

Unified Diff: include/core/SkDynamicAnnotations.h

Issue 247813005: teach TSAN about SkSpinlock, SkRefCnt, and SkOnce (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: unused Created 6 years, 8 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/SkOnce.h » ('j') | include/core/SkRefCnt.h » ('J')
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 6d21cddb940b363d16a614d3b9f54f59af3e7dcf..e4493c8e652978b0067295ee1ed59b96e0038be7 100644
--- a/include/core/SkDynamicAnnotations.h
+++ b/include/core/SkDynamicAnnotations.h
@@ -19,6 +19,10 @@ extern "C" {
// TSAN provides these hooks.
void AnnotateIgnoreReadsBegin(const char* file, int line);
void AnnotateIgnoreReadsEnd(const char* file, int line);
+void AnnotateHappensBefore(const char* file, int line, const volatile void* ptr);
+void AnnotateHappensAfter(const char* file, int line, const volatile void* ptr);
+void AnnotateRWLockAcquired(const char* file, int line, const volatile void* lock, long is_w);
+void AnnotateRWLockReleased(const char* file, int line, const volatile void* lock, long is_w);
} // extern "C"
// SK_ANNOTATE_UNPROTECTED_READ can wrap any variable read to tell TSAN to ignore that it appears to
@@ -37,9 +41,19 @@ inline T SK_ANNOTATE_UNPROTECTED_READ(const volatile T& x) {
return read;
}
+#define SK_ANNOTATE_HAPPENS_BEFORE(obj) AnnotateHappensBefore(__FILE__, __LINE__, obj)
+#define SK_ANNOTATE_HAPPENS_AFTER(obj) AnnotateHappensAfter(__FILE__, __LINE__, obj)
+
+#define SK_ANNOTATE_RWLOCK_ACQUIRED(lock, w) AnnotateRWLockAcquired(__FILE__, __LINE__, lock, w)
+#define SK_ANNOTATE_RWLOCK_RELEASED(lock, w) AnnotateRWLockReleased(__FILE__, __LINE__, lock, w)
+
#else // !DYNAMIC_ANNOTATIONS_ENABLED
#define SK_ANNOTATE_UNPROTECTED_READ(x) (x)
+#define SK_ANNOTATE_HAPPENS_BEFORE(obj)
+#define SK_ANNOTATE_HAPPENS_AFTER(obj)
+#define SK_ANNOTATE_RWLOCK_ACQUIRED(lock, w)
+#define SK_ANNOTATE_RWLOCK_RELEASED(lock, w)
#endif
« no previous file with comments | « no previous file | include/core/SkOnce.h » ('j') | include/core/SkRefCnt.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698