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

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

Issue 1207893002: Clean up a few includes, introduce iwyu. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: SkTypes to export stddef. Created 5 years, 4 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/SkMutex.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 2015 Google Inc. 2 * Copyright 2015 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 SkAtomics_DEFINED 8 #ifndef SkAtomics_DEFINED
9 #define SkAtomics_DEFINED 9 #define SkAtomics_DEFINED
10 10
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 60
61 bool compare_exchange(T* expected, const T& desired, 61 bool compare_exchange(T* expected, const T& desired,
62 sk_memory_order success = sk_memory_order_seq_cst, 62 sk_memory_order success = sk_memory_order_seq_cst,
63 sk_memory_order failure = sk_memory_order_seq_cst) { 63 sk_memory_order failure = sk_memory_order_seq_cst) {
64 return sk_atomic_compare_exchange(&fVal, expected, desired, success, fai lure); 64 return sk_atomic_compare_exchange(&fVal, expected, desired, success, fai lure);
65 } 65 }
66 private: 66 private:
67 T fVal; 67 T fVal;
68 }; 68 };
69 69
70 // IWYU pragma: begin_exports
70 #if defined(_MSC_VER) 71 #if defined(_MSC_VER)
71 #include "../ports/SkAtomics_std.h" 72 #include "../ports/SkAtomics_std.h"
72 #elif !defined(SK_BUILD_FOR_IOS) && defined(__ATOMIC_RELAXED) 73 #elif !defined(SK_BUILD_FOR_IOS) && defined(__ATOMIC_RELAXED)
73 #include "../ports/SkAtomics_atomic.h" 74 #include "../ports/SkAtomics_atomic.h"
74 #else 75 #else
75 #include "../ports/SkAtomics_sync.h" 76 #include "../ports/SkAtomics_sync.h"
76 #endif 77 #endif
78 // IWYU pragma: end_exports
77 79
78 // From here down we have shims for our old atomics API, to be weaned off of. 80 // From here down we have shims for our old atomics API, to be weaned off of.
79 // We use the default sequentially-consistent memory order to make things simple 81 // We use the default sequentially-consistent memory order to make things simple
80 // and to match the practical reality of our old _sync and _win implementations. 82 // and to match the practical reality of our old _sync and _win implementations.
81 83
82 inline int32_t sk_atomic_inc(int32_t* ptr) { return sk_atomic_fetch_a dd(ptr, +1); } 84 inline int32_t sk_atomic_inc(int32_t* ptr) { return sk_atomic_fetch_a dd(ptr, +1); }
83 inline int32_t sk_atomic_dec(int32_t* ptr) { return sk_atomic_fetch_a dd(ptr, -1); } 85 inline int32_t sk_atomic_dec(int32_t* ptr) { return sk_atomic_fetch_a dd(ptr, -1); }
84 inline int32_t sk_atomic_add(int32_t* ptr, int32_t v) { return sk_atomic_fetch_a dd(ptr, v); } 86 inline int32_t sk_atomic_add(int32_t* ptr, int32_t v) { return sk_atomic_fetch_a dd(ptr, v); }
85 87
86 inline int64_t sk_atomic_inc(int64_t* ptr) { return sk_atomic_fetch_add<int64_t> (ptr, +1); } 88 inline int64_t sk_atomic_inc(int64_t* ptr) { return sk_atomic_fetch_add<int64_t> (ptr, +1); }
(...skipping 20 matching lines...) Expand all
107 template <typename T> 109 template <typename T>
108 T sk_acquire_load(T* ptr) { return sk_atomic_load(ptr, sk_memory_order_acquire); } 110 T sk_acquire_load(T* ptr) { return sk_atomic_load(ptr, sk_memory_order_acquire); }
109 111
110 template <typename T> 112 template <typename T>
111 void sk_release_store(T* ptr, T val) { sk_atomic_store(ptr, val, sk_memory_order _release); } 113 void sk_release_store(T* ptr, T val) { sk_atomic_store(ptr, val, sk_memory_order _release); }
112 114
113 inline void sk_membar_acquire__after_atomic_dec() {} 115 inline void sk_membar_acquire__after_atomic_dec() {}
114 inline void sk_membar_acquire__after_atomic_conditional_inc() {} 116 inline void sk_membar_acquire__after_atomic_conditional_inc() {}
115 117
116 #endif//SkAtomics_DEFINED 118 #endif//SkAtomics_DEFINED
OLDNEW
« no previous file with comments | « no previous file | include/core/SkMutex.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698