Chromium Code Reviews| Index: include/core/SkDynamicAnnotations.h |
| diff --git a/include/core/SkDynamicAnnotations.h b/include/core/SkDynamicAnnotations.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..f3c7f034b639448dc8339e76ad5feecc84769d8f |
| --- /dev/null |
| +++ b/include/core/SkDynamicAnnotations.h |
| @@ -0,0 +1,36 @@ |
| +/* |
| + * Copyright 2014 Google Inc. |
| + * |
| + * Use of this source code is governed by a BSD-style license that can be |
| + * found in the LICENSE file. |
| + */ |
| + |
| +#ifndef SkDynamicAnnotations_DEFINED |
| +#define SkDynamicAnnotations_DEFINED |
| + |
| +// We nabbed this code from the dynamic_annotations library, and in their honor |
| +// we check the same define. Add other macros you use here. |
|
reed1
2014/02/04 14:57:55
I have no idea what this stuff does. Can we also n
|
| + |
| +#if DYNAMIC_ANNOTATIONS_ENABLED |
| + |
| +extern "C" { |
| +// TSAN provides these hooks. |
| +void AnnotateIgnoreReadsBegin(const char* file, int line); |
| +void AnnotateIgnoreReadsEnd(const char* file, int line); |
| +} // extern "C" |
| + |
| +template <typename T> |
| +inline T SK_ANNOTATE_UNPROTECTED_READ(const volatile T& x) { |
| + AnnotateIgnoreReadsBegin(__FILE__, __LINE__); |
| + T read = x; |
| + AnnotateIgnoreReadsEnd(__FILE__, __LINE__); |
| + return read; |
| +} |
| + |
| +#else // !DYNAMIC_ANNOTATIONS_ENABLED |
| + |
| +#define SK_ANNOTATE_UNPROTECTED_READ(x) (x) |
| + |
| +#endif |
| + |
| +#endif//SkDynamicAnnotations_DEFINED |