8#ifndef SkThreadAnnotations_DEFINED
9#define SkThreadAnnotations_DEFINED
16#if defined(__clang__) && (!defined(SWIG))
17#define SK_THREAD_ANNOTATION_ATTRIBUTE(x) __attribute__((x))
19#define SK_THREAD_ANNOTATION_ATTRIBUTE(x)
22#define SK_CAPABILITY(x) \
23 SK_THREAD_ANNOTATION_ATTRIBUTE(capability(x))
25#define SK_SCOPED_CAPABILITY \
26 SK_THREAD_ANNOTATION_ATTRIBUTE(scoped_lockable)
28#define SK_GUARDED_BY(x) \
29 SK_THREAD_ANNOTATION_ATTRIBUTE(guarded_by(x))
31#define SK_PT_GUARDED_BY(x) \
32 SK_THREAD_ANNOTATION_ATTRIBUTE(pt_guarded_by(x))
34#define SK_ACQUIRED_BEFORE(...) \
35 SK_THREAD_ANNOTATION_ATTRIBUTE(acquired_before(__VA_ARGS__))
37#define SK_ACQUIRED_AFTER(...) \
38 SK_THREAD_ANNOTATION_ATTRIBUTE(acquired_after(__VA_ARGS__))
40#define SK_REQUIRES(...) \
41 SK_THREAD_ANNOTATION_ATTRIBUTE(requires_capability(__VA_ARGS__))
43#define SK_REQUIRES_SHARED(...) \
44 SK_THREAD_ANNOTATION_ATTRIBUTE(requires_shared_capability(__VA_ARGS__))
46#define SK_ACQUIRE(...) \
47 SK_THREAD_ANNOTATION_ATTRIBUTE(acquire_capability(__VA_ARGS__))
49#define SK_ACQUIRE_SHARED(...) \
50 SK_THREAD_ANNOTATION_ATTRIBUTE(acquire_shared_capability(__VA_ARGS__))
53#define SK_RELEASE_CAPABILITY(...) \
54 SK_THREAD_ANNOTATION_ATTRIBUTE(release_capability(__VA_ARGS__))
57#define SK_RELEASE_SHARED_CAPABILITY(...) \
58 SK_THREAD_ANNOTATION_ATTRIBUTE(release_shared_capability(__VA_ARGS__))
60#define SK_TRY_ACQUIRE(...) \
61 SK_THREAD_ANNOTATION_ATTRIBUTE(try_acquire_capability(__VA_ARGS__))
63#define SK_TRY_ACQUIRE_SHARED(...) \
64 SK_THREAD_ANNOTATION_ATTRIBUTE(try_acquire_shared_capability(__VA_ARGS__))
66#define SK_EXCLUDES(...) \
67 SK_THREAD_ANNOTATION_ATTRIBUTE(locks_excluded(__VA_ARGS__))
69#define SK_ASSERT_CAPABILITY(x) \
70 SK_THREAD_ANNOTATION_ATTRIBUTE(assert_capability(x))
72#define SK_ASSERT_SHARED_CAPABILITY(x) \
73 SK_THREAD_ANNOTATION_ATTRIBUTE(assert_shared_capability(x))
75#define SK_RETURN_CAPABILITY(x) \
76 SK_THREAD_ANNOTATION_ATTRIBUTE(lock_returned(x))
78#define SK_NO_THREAD_SAFETY_ANALYSIS \
79 SK_THREAD_ANNOTATION_ATTRIBUTE(no_thread_safety_analysis)
81#if defined(SK_BUILD_FOR_GOOGLE3) && !defined(SK_BUILD_FOR_WASM_IN_GOOGLE3) \
82 && !defined(SK_BUILD_FOR_WIN)
84 void __google_cxa_guard_acquire_begin(
void)
__attribute__((weak));
85 void __google_cxa_guard_acquire_end (
void)
__attribute__((weak));
87 static inline void sk_potentially_blocking_region_begin() {
88 if (&__google_cxa_guard_acquire_begin) {
89 __google_cxa_guard_acquire_begin();
92 static inline void sk_potentially_blocking_region_end() {
93 if (&__google_cxa_guard_acquire_end) {
94 __google_cxa_guard_acquire_end();
97 #define SK_POTENTIALLY_BLOCKING_REGION_BEGIN sk_potentially_blocking_region_begin()
98 #define SK_POTENTIALLY_BLOCKING_REGION_END sk_potentially_blocking_region_end()
100 #define SK_POTENTIALLY_BLOCKING_REGION_BEGIN
101 #define SK_POTENTIALLY_BLOCKING_REGION_END
__attribute__((visibility("default"))) int RunBenchmarks(int argc