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

Unified Diff: dm/DMTask.cpp

Issue 263803003: DM: Push GPU-parent child tasks to the front of the queue. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: share code Created 6 years, 8 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/DMTask.h ('k') | dm/DMTaskRunner.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dm/DMTask.cpp
diff --git a/dm/DMTask.cpp b/dm/DMTask.cpp
index 83df84933f8cd816d8910f7d039f880208e67d6c..7725780d4ced9ec8377ddc04e6c0cfeaaef6aff1 100644
--- a/dm/DMTask.cpp
+++ b/dm/DMTask.cpp
@@ -37,8 +37,8 @@ void Task::finish() {
fReporter->finish(this->name(), SkTime::GetMSecs() - fStart);
}
-void Task::reallySpawnChild(CpuTask* task) {
- fTaskRunner->add(task);
+void Task::spawnChildNext(CpuTask* task) {
+ fTaskRunner->addNext(task);
}
CpuTask::CpuTask(Reporter* reporter, TaskRunner* taskRunner) : Task(reporter, taskRunner) {}
@@ -55,6 +55,8 @@ void CpuTask::run() {
void CpuTask::spawnChild(CpuTask* task) {
// Run children serially on this (CPU) thread. This tends to save RAM and is usually no slower.
+ // Calling spawnChildNext() is nearly equivalent, but it'd pointlessly contend on the
+ // threadpool; spawnChildNext() is most useful when you want to change threadpools.
task->run();
}
@@ -71,7 +73,8 @@ void GpuTask::run(GrContextFactory& factory) {
void GpuTask::spawnChild(CpuTask* task) {
// Really spawn a new task so it runs on the CPU threadpool instead of the GPU one we're on now.
- this->reallySpawnChild(task);
+ // It goes on the front of the queue to minimize the time we must hold reference bitmaps in RAM.
+ this->spawnChildNext(task);
}
} // namespace DM
« no previous file with comments | « dm/DMTask.h ('k') | dm/DMTaskRunner.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698