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

Unified Diff: src/utils/SkTaskGroup.h

Issue 531653002: SkThreadPool ~~> SkTaskGroup (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: cleanup allowThreaded() Created 6 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 side-by-side diff with in-line comments
Download patch
Index: src/utils/SkTaskGroup.h
diff --git a/src/utils/SkTaskGroup.h b/src/utils/SkTaskGroup.h
new file mode 100644
index 0000000000000000000000000000000000000000..af4d47aa979186a8749821c80100f2b202ce6927
--- /dev/null
+++ b/src/utils/SkTaskGroup.h
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2014 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef SkTaskGroup_DEFINED
+#define SkTaskGroup_DEFINED
+
+#include "SkTypes.h"
+#include "SkRunnable.h"
+
+class SkTaskGroup : SkNoncopyable {
+public:
+ // Call before creating any SkTaskGroup to set the number of threads all SkTaskGroups share.
+ // If not called, we default to the number of system-reported cores.
+ static void SetThreadCount(int);
+
+ SkTaskGroup();
+ ~SkTaskGroup() { this->wait(); }
+
+ // Add a task to this SkTaskGroup. It will likely run() on another thread.
+ void add(SkRunnable*);
+
+ // Block until all Tasks previously add()ed to this SkTaskGroup have run().
+ // You may safely reuse this SkTaskGroup after wait() returns.
+ void wait();
+
+private:
+ /*atomic*/ int32_t fPending;
+};
+
+#endif//SkTaskGroup_DEFINED
« src/utils/SkRunnable.h ('K') | « src/utils/SkRunnable.h ('k') | src/utils/SkTaskGroup.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698