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

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: Just a little more cleanup. Created 5 years, 5 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') | include/core/SkRefCnt.h » ('J')
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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 #if defined(_MSC_VER) 70 #if defined(_MSC_VER)
71 #include "../ports/SkAtomics_std.h" 71 #include "../ports/SkAtomics_std.h" // IWYU pragma: export
72 #elif !defined(SK_BUILD_FOR_IOS) && defined(__ATOMIC_RELAXED) 72 #elif !defined(SK_BUILD_FOR_IOS) && defined(__ATOMIC_RELAXED)
73 #include "../ports/SkAtomics_atomic.h" 73 #include "../ports/SkAtomics_atomic.h" // IWYU pragma: export
74 #else 74 #else
75 #include "../ports/SkAtomics_sync.h" 75 #include "../ports/SkAtomics_sync.h" // IWYU pragma: export
76 #endif 76 #endif
77 77
78 // From here down we have shims for our old atomics API, to be weaned off of. 78 // 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 79 // 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. 80 // and to match the practical reality of our old _sync and _win implementations.
81 81
82 inline int32_t sk_atomic_inc(int32_t* ptr) { return sk_atomic_fetch_a dd(ptr, +1); } 82 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); } 83 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); } 84 inline int32_t sk_atomic_add(int32_t* ptr, int32_t v) { return sk_atomic_fetch_a dd(ptr, v); }
85 85
(...skipping 21 matching lines...) Expand all
107 template <typename T> 107 template <typename T>
108 T sk_acquire_load(T* ptr) { return sk_atomic_load(ptr, sk_memory_order_acquire); } 108 T sk_acquire_load(T* ptr) { return sk_atomic_load(ptr, sk_memory_order_acquire); }
109 109
110 template <typename T> 110 template <typename T>
111 void sk_release_store(T* ptr, T val) { sk_atomic_store(ptr, val, sk_memory_order _release); } 111 void sk_release_store(T* ptr, T val) { sk_atomic_store(ptr, val, sk_memory_order _release); }
112 112
113 inline void sk_membar_acquire__after_atomic_dec() {} 113 inline void sk_membar_acquire__after_atomic_dec() {}
114 inline void sk_membar_acquire__after_atomic_conditional_inc() {} 114 inline void sk_membar_acquire__after_atomic_conditional_inc() {}
115 115
116 #endif//SkAtomics_DEFINED 116 #endif//SkAtomics_DEFINED
OLDNEW
« no previous file with comments | « no previous file | include/core/SkMutex.h » ('j') | include/core/SkRefCnt.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698