remove sk_atomic_inc
Change-Id: I4960b1cd055daf44637e95825f82cb7fe2ce134a
Reviewed-on: https://skia-review.googlesource.com/c/174285
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
diff --git a/src/gpu/GrResourceAllocator.cpp b/src/gpu/GrResourceAllocator.cpp
index eab856f..52aec58 100644
--- a/src/gpu/GrResourceAllocator.cpp
+++ b/src/gpu/GrResourceAllocator.cpp
@@ -19,14 +19,16 @@
#include "GrUninstantiateProxyTracker.h"
#if GR_TRACK_INTERVAL_CREATION
-uint32_t GrResourceAllocator::Interval::CreateUniqueID() {
- static int32_t gUniqueID = SK_InvalidUniqueID;
- uint32_t id;
- do {
- id = static_cast<uint32_t>(sk_atomic_inc(&gUniqueID) + 1);
- } while (id == SK_InvalidUniqueID);
- return id;
-}
+ #include <atomic>
+
+ uint32_t GrResourceAllocator::Interval::CreateUniqueID() {
+ static std::atomic<uint32_t> nextID{1};
+ uint32_t id;
+ do {
+ id = nextID++;
+ } while (id == SK_InvalidUniqueID);
+ return id;
+ }
#endif
void GrResourceAllocator::Interval::assign(sk_sp<GrSurface> s) {