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

Side by Side Diff: dm/DMTaskRunner.cpp

Issue 531653002: SkThreadPool ~~> SkTaskGroup (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: cleanup allowThreaded() Created 6 years, 3 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
OLDNEW
1 #include "DMTaskRunner.h" 1 #include "DMTaskRunner.h"
2 #include "DMTask.h" 2 #include "DMTask.h"
3 3
4 namespace DM { 4 namespace DM {
5 5
6 TaskRunner::TaskRunner(int cpuThreads, int gpuThreads) : fCpu(cpuThreads), fGpu( gpuThreads) {} 6 TaskRunner::TaskRunner(int cpuThreads) {
7 SkTaskGroup::SetThreadCount(cpuThreads);
8 }
7 9
8 void TaskRunner::add(CpuTask* task) { fCpu.add(task); } 10 void TaskRunner::add(CpuTask* task) { fCpuWork.add(task); }
9 void TaskRunner::addNext(CpuTask* task) { fCpu.addNext(task); } 11 void TaskRunner::add(GpuTask* task) { fGpuWork.push(task); }
10 void TaskRunner::add(GpuTask* task) { fGpu.add(task); }
11 12
12 void TaskRunner::wait() { 13 void TaskRunner::wait() {
13 // These wait calls block until each threadpool is done. We don't allow 14 GrContextFactory factory;
14 // spawning new child GPU tasks, so we can wait for that first knowing 15 for (int i = 0; i < fGpuWork.count(); i++) {
15 // we'll never try to add to it later. Same can't be said of the CPU pool: 16 fGpuWork[i]->run(&factory);
16 // both CPU and GPU tasks can spawn off new CPU work, so we wait for that la st. 17 }
17 fGpu.wait(); 18 fCpuWork.wait();
18 fCpu.wait();
19 } 19 }
20 20
21 } // namespace DM 21 } // namespace DM
OLDNEW
« no previous file with comments | « dm/DMTaskRunner.h ('k') | dm/DMTestTask.h » ('j') | src/utils/SkRunnable.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698