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

Side by Side Diff: dm/DMTaskRunner.cpp

Issue 22839016: Skeleton of DM (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: missed one Created 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 #include "DMTaskRunner.h"
2 #include "DMTask.h"
3
4 namespace DM {
5
6 TaskRunner::TaskRunner(int cputhreads, int gpuThreads)
7 : fMain(SkNEW_ARGS(SkThreadPool, (cputhreads)))
8 , fGpu(SkNEW_ARGS(SkThreadPool, (gpuThreads)))
9 {}
10
11 void TaskRunner::add(Task* task) {
12 if (task->usesGpu()) {
13 fGpu->add(task);
14 } else {
15 fMain->add(task);
16 }
17 }
18
19 void TaskRunner::wait() {
20 // These free calls block until the threadpool is done. We don't allow
epoger 2013/10/11 21:13:13 Thanks for the commentary!
21 // children to spawn new GPU tasks so we can wait for that first knowing
22 // we'll never try to add to it later. Same can't be said of fMain: fGpu
23 // and fMain can both add tasks to fMain, so we have to wait for that last.
24 fGpu.free();
25 fMain.free();
26 }
27
28 } // namespace DM
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698