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

Unified Diff: src/core/SkTaskGroup.cpp

Issue 1419593004: Avoid hang in OncePtr test with --threads 1 (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/core/SkTaskGroup.h ('k') | tests/OncePtrTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkTaskGroup.cpp
diff --git a/src/core/SkTaskGroup.cpp b/src/core/SkTaskGroup.cpp
index 97e3ff44a8518daf99a826a2b9650ac407d5971b..863195cfd3feea11c8db574ddd7e917d90130c5e 100644
--- a/src/core/SkTaskGroup.cpp
+++ b/src/core/SkTaskGroup.cpp
@@ -196,6 +196,7 @@ private:
static ThreadPool* gGlobal;
friend struct SkTaskGroup::Enabler;
+ friend int ::sk_parallel_for_thread_count();
};
ThreadPool* ThreadPool::gGlobal = nullptr;
@@ -219,3 +220,9 @@ void SkTaskGroup::batch (void (*fn)(void*), void* args, int N, size_t stride) {
ThreadPool::Batch(fn, args, N, stride, &fPending);
}
+int sk_parallel_for_thread_count() {
+ if (ThreadPool::gGlobal != nullptr) {
+ return ThreadPool::gGlobal->fThreads.count();
+ }
+ return 0;
+}
« no previous file with comments | « src/core/SkTaskGroup.h ('k') | tests/OncePtrTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698