Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 /* | |
| 2 * Copyright 2014 Google Inc. | |
| 3 * | |
| 4 * Use of this source code is governed by a BSD-style license that can be | |
| 5 * found in the LICENSE file. | |
| 6 */ | |
| 7 | |
| 8 #ifndef SkDynamicAnnotations_DEFINED | |
| 9 #define SkDynamicAnnotations_DEFINED | |
| 10 | |
| 11 // We nabbed this code from the dynamic_annotations library, and in their honor | |
| 12 // 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
| |
| 13 | |
| 14 #if DYNAMIC_ANNOTATIONS_ENABLED | |
| 15 | |
| 16 extern "C" { | |
| 17 // TSAN provides these hooks. | |
| 18 void AnnotateIgnoreReadsBegin(const char* file, int line); | |
| 19 void AnnotateIgnoreReadsEnd(const char* file, int line); | |
| 20 } // extern "C" | |
| 21 | |
| 22 template <typename T> | |
| 23 inline T SK_ANNOTATE_UNPROTECTED_READ(const volatile T& x) { | |
| 24 AnnotateIgnoreReadsBegin(__FILE__, __LINE__); | |
| 25 T read = x; | |
| 26 AnnotateIgnoreReadsEnd(__FILE__, __LINE__); | |
| 27 return read; | |
| 28 } | |
| 29 | |
| 30 #else // !DYNAMIC_ANNOTATIONS_ENABLED | |
| 31 | |
| 32 #define SK_ANNOTATE_UNPROTECTED_READ(x) (x) | |
| 33 | |
| 34 #endif | |
| 35 | |
| 36 #endif//SkDynamicAnnotations_DEFINED | |
| OLD | NEW |