aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Mike Klein <mtklein@chromium.org>2017-02-22 13:00:33 -0500
committerGravatar Mike Klein <mtklein@chromium.org>2017-02-22 18:34:51 +0000
commit416bbd97cee9e221577c729a8072fdb2057cbdf8 (patch)
treed7f77fd6d5e61714f02c310b751401030879524d
parentd7e86a525224b845f8d5f54ffbd05e54a78e45d9 (diff)
Switch SkTaskGroup to std::atomic.
No interesting change, just getting on std APIs. Change-Id: I0f42cbb6854b49a6ae8266e5b92f977d27f4e032 Reviewed-on: https://skia-review.googlesource.com/8860 Reviewed-by: Herb Derby <herb@google.com> Commit-Queue: Mike Klein <mtklein@chromium.org>
-rw-r--r--src/core/SkTaskGroup.cpp10
-rw-r--r--src/core/SkTaskGroup.h6
2 files changed, 8 insertions, 8 deletions
diff --git a/src/core/SkTaskGroup.cpp b/src/core/SkTaskGroup.cpp
index 78ab71c79d..9469b8c1ce 100644
--- a/src/core/SkTaskGroup.cpp
+++ b/src/core/SkTaskGroup.cpp
@@ -11,20 +11,20 @@
SkTaskGroup::SkTaskGroup(SkExecutor& executor) : fPending(0), fExecutor(executor) {}
void SkTaskGroup::add(std::function<void(void)> fn) {
- fPending.fetch_add(+1, sk_memory_order_relaxed);
+ fPending.fetch_add(+1, std::memory_order_relaxed);
fExecutor.add([=] {
fn();
- fPending.fetch_add(-1, sk_memory_order_release);
+ fPending.fetch_add(-1, std::memory_order_release);
});
}
void SkTaskGroup::batch(int N, std::function<void(int)> fn) {
// TODO: I really thought we had some sort of more clever chunking logic.
- fPending.fetch_add(+N, sk_memory_order_relaxed);
+ fPending.fetch_add(+N, std::memory_order_relaxed);
for (int i = 0; i < N; i++) {
fExecutor.add([=] {
fn(i);
- fPending.fetch_add(-1, sk_memory_order_release);
+ fPending.fetch_add(-1, std::memory_order_release);
});
}
}
@@ -34,7 +34,7 @@ void SkTaskGroup::wait() {
// This lets SkTaskGroups nest arbitrarily deep on a single SkExecutor:
// no thread ever blocks waiting for others to do its work.
// (We may end up doing work that's not part of our task group. That's fine.)
- while (fPending.load(sk_memory_order_acquire) > 0) {
+ while (fPending.load(std::memory_order_acquire) > 0) {
fExecutor.borrow();
}
}
diff --git a/src/core/SkTaskGroup.h b/src/core/SkTaskGroup.h
index cba9eea366..ff291ea29e 100644
--- a/src/core/SkTaskGroup.h
+++ b/src/core/SkTaskGroup.h
@@ -8,9 +8,9 @@
#ifndef SkTaskGroup_DEFINED
#define SkTaskGroup_DEFINED
-#include "SkAtomics.h"
#include "SkExecutor.h"
#include "SkTypes.h"
+#include <atomic>
#include <functional>
class SkTaskGroup : SkNoncopyable {
@@ -37,8 +37,8 @@ public:
};
private:
- SkAtomic<int32_t> fPending;
- SkExecutor& fExecutor;
+ std::atomic<int32_t> fPending;
+ SkExecutor& fExecutor;
};
#endif//SkTaskGroup_DEFINED