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

Side by Side Diff: include/core/SkDynamicAnnotations.h

Issue 922873002: I cannot remember what the race here actually was. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 10 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 unified diff | Download patch
« no previous file with comments | « no previous file | include/core/SkPixelRef.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 } 59 }
60 60
61 #else // !DYNAMIC_ANNOTATIONS_ENABLED 61 #else // !DYNAMIC_ANNOTATIONS_ENABLED
62 62
63 #define SK_ANNOTATE_UNPROTECTED_READ(x) (x) 63 #define SK_ANNOTATE_UNPROTECTED_READ(x) (x)
64 #define SK_ANNOTATE_UNPROTECTED_WRITE(ptr, val) *(ptr) = (val) 64 #define SK_ANNOTATE_UNPROTECTED_WRITE(ptr, val) *(ptr) = (val)
65 #define SK_ANNOTATE_BENIGN_RACE(ptr) 65 #define SK_ANNOTATE_BENIGN_RACE(ptr)
66 66
67 #endif 67 #endif
68 68
69 // Can be used to wrap values that are intentionally racy, usually small mutable cached values, e.g.
70 // - SkMatrix type mask
71 // - SkPixelRef genIDs
72 template <typename T>
73 class SkTRacy {
74 public:
75 operator const T() const {
76 return SK_ANNOTATE_UNPROTECTED_READ(fVal);
77 }
78
79 SkTRacy& operator=(const T& val) {
80 SK_ANNOTATE_UNPROTECTED_WRITE(&fVal, val);
81 return *this;
82 }
83
84 private:
85 T fVal;
86 };
87
88 #endif//SkDynamicAnnotations_DEFINED 69 #endif//SkDynamicAnnotations_DEFINED
OLDNEW
« no previous file with comments | « no previous file | include/core/SkPixelRef.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698