| Index: src/core/SkTaskGroup.h
|
| diff --git a/src/core/SkTaskGroup.h b/src/core/SkTaskGroup.h
|
| index 75443c37cbaf44a371169ff01997d0b221a0e63c..14a52c6aac1aadd1d3393466200fec43f4bf0e45 100644
|
| --- a/src/core/SkTaskGroup.h
|
| +++ b/src/core/SkTaskGroup.h
|
| @@ -26,13 +26,25 @@ public:
|
| // Add a task to this SkTaskGroup. It will likely run on another thread.
|
| // Neither add() method takes owership of any of its parameters.
|
| void add(SkRunnable*);
|
| - void add(void (*fn)(void*), void* arg);
|
| +
|
| + template <typename T>
|
| + void add(void (*fn)(T*), T* arg) { this->add((void_fn)fn, (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)(T*), T* args, int N) { this->batch((void_fn)fn, args, N, sizeof(T)); }
|
|
|
| // Block until all Tasks previously add()ed to this SkTaskGroup have run.
|
| // You may safely reuse this SkTaskGroup after wait() returns.
|
| void wait();
|
|
|
| private:
|
| + typedef void(*void_fn)(void*);
|
| +
|
| + void add (void_fn, void* arg);
|
| + void batch(void_fn, void* args, int N, size_t stride);
|
| +
|
| /*atomic*/ int32_t fPending;
|
| };
|
|
|
|
|