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

Unified Diff: src/utils/SkTaskGroup.h

Issue 689673003: SkTaskGroup::batch(fn, args, N) (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: simplify Created 6 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 | « dm/DMQuiltTask.cpp ('k') | src/utils/SkTaskGroup.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/utils/SkTaskGroup.h
diff --git a/src/utils/SkTaskGroup.h b/src/utils/SkTaskGroup.h
index c60ceda52e01d5bc7b6c246bcaf3bc1a4c3caecb..d959d94c33386844bc119d58e4a011e007f91f4d 100644
--- a/src/utils/SkTaskGroup.h
+++ b/src/utils/SkTaskGroup.h
@@ -27,11 +27,18 @@ public:
void add(SkRunnable*);
void add(void (*fn)(void*), void* arg);
+ // Add a batch of N tasks, all calling fn with different arguments.
+ // Equivalent to a loop over add(fn, arg), but with perhaps less synchronization overhead.
+ template <typename T>
+ void batch(void (*fn)(void*), T* args, int N) { this->batch(fn, args, N, sizeof(T)); }
reed1 2014/10/29 19:57:30 1. Slightly odd to me that we don't expose the non
mtklein 2014/10/29 20:01:00 Yeah. Just seemed like the template version makes
+
// Block until all Tasks previously add()ed to this SkTaskGroup have run.
// You may safely reuse this SkTaskGroup after wait() returns.
void wait();
private:
+ void batch(void (*fn)(void*), void* args, int N, size_t stride);
+
/*atomic*/ int32_t fPending;
};
« no previous file with comments | « dm/DMQuiltTask.cpp ('k') | src/utils/SkTaskGroup.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698