OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #ifndef SkDynamicAnnotations_DEFINED | 8 #ifndef SkDynamicAnnotations_DEFINED |
9 #define SkDynamicAnnotations_DEFINED | 9 #define SkDynamicAnnotations_DEFINED |
10 | 10 |
(...skipping 24 matching lines...) Expand all Loading... |
35 template <typename T> | 35 template <typename T> |
36 inline T SK_ANNOTATE_UNPROTECTED_READ(const volatile T& x) { | 36 inline T SK_ANNOTATE_UNPROTECTED_READ(const volatile T& x) { |
37 AnnotateIgnoreReadsBegin(__FILE__, __LINE__); | 37 AnnotateIgnoreReadsBegin(__FILE__, __LINE__); |
38 T read = x; | 38 T read = x; |
39 AnnotateIgnoreReadsEnd(__FILE__, __LINE__); | 39 AnnotateIgnoreReadsEnd(__FILE__, __LINE__); |
40 return read; | 40 return read; |
41 } | 41 } |
42 | 42 |
43 // Like SK_ANNOTATE_UNPROTECTED_READ, but for writes. | 43 // Like SK_ANNOTATE_UNPROTECTED_READ, but for writes. |
44 template <typename T> | 44 template <typename T> |
45 inline void SK_ANNOTATE_UNPROTECTED_WRITE(T* ptr, const volatile T& val) { | 45 inline void SK_ANNOTATE_UNPROTECTED_WRITE(T* ptr, const T& val) { |
46 AnnotateIgnoreWritesBegin(__FILE__, __LINE__); | 46 AnnotateIgnoreWritesBegin(__FILE__, __LINE__); |
47 *ptr = val; | 47 *ptr = val; |
48 AnnotateIgnoreWritesEnd(__FILE__, __LINE__); | 48 AnnotateIgnoreWritesEnd(__FILE__, __LINE__); |
49 } | 49 } |
50 | 50 |
51 // Ignore racy reads and racy writes to this pointer, indefinitely. | 51 // Ignore racy reads and racy writes to this pointer, indefinitely. |
52 // If at all possible, use the more precise SK_ANNOTATE_UNPROTECTED_READ. | 52 // If at all possible, use the more precise SK_ANNOTATE_UNPROTECTED_READ. |
53 template <typename T> | 53 template <typename T> |
54 void SK_ANNOTATE_BENIGN_RACE(T* ptr) { | 54 void SK_ANNOTATE_BENIGN_RACE(T* ptr) { |
55 AnnotateBenignRaceSized(__FILE__, __LINE__, ptr, sizeof(*ptr), "SK_ANNOTATE_
BENIGN_RACE"); | 55 AnnotateBenignRaceSized(__FILE__, __LINE__, ptr, sizeof(*ptr), "SK_ANNOTATE_
BENIGN_RACE"); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 T* get() { return &fVal; } | 104 T* get() { return &fVal; } |
105 | 105 |
106 const T* operator->() const { return &fVal; } | 106 const T* operator->() const { return &fVal; } |
107 T* operator->() { return &fVal; } | 107 T* operator->() { return &fVal; } |
108 | 108 |
109 private: | 109 private: |
110 T fVal; | 110 T fVal; |
111 }; | 111 }; |
112 | 112 |
113 #endif//SkDynamicAnnotations_DEFINED | 113 #endif//SkDynamicAnnotations_DEFINED |
OLD | NEW |