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

Side by Side Diff: dm/DMTask.cpp

Issue 397743004: DM: destroy contexts after each GPU task instead of before (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 5 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #include "DMTask.h" 1 #include "DMTask.h"
2 #include "DMTaskRunner.h" 2 #include "DMTaskRunner.h"
3 #include "SkCommandLineFlags.h" 3 #include "SkCommandLineFlags.h"
4 4
5 DEFINE_bool(cpu, true, "Master switch for running CPU-bound work."); 5 DEFINE_bool(cpu, true, "Master switch for running CPU-bound work.");
6 DEFINE_bool(gpu, true, "Master switch for running GPU-bound work."); 6 DEFINE_bool(gpu, true, "Master switch for running GPU-bound work.");
7 DEFINE_bool(resetGpuContext, true, "Reset the GrContext before running each task ."); 7 DEFINE_bool(resetGpuContext, true, "Reset the GrContext before running each task .");
8 8
9 DECLARE_bool(dryRun); 9 DECLARE_bool(dryRun);
10 10
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 // Run children serially on this (CPU) thread. This tends to save RAM and i s usually no slower. 64 // Run children serially on this (CPU) thread. This tends to save RAM and i s usually no slower.
65 // Calling spawnChildNext() is nearly equivalent, but it'd pointlessly conte nd on the 65 // Calling spawnChildNext() is nearly equivalent, but it'd pointlessly conte nd on the
66 // threadpool; spawnChildNext() is most useful when you want to change threa dpools. 66 // threadpool; spawnChildNext() is most useful when you want to change threa dpools.
67 task->run(); 67 task->run();
68 } 68 }
69 69
70 GpuTask::GpuTask(Reporter* reporter, TaskRunner* taskRunner) : Task(reporter, ta skRunner) {} 70 GpuTask::GpuTask(Reporter* reporter, TaskRunner* taskRunner) : Task(reporter, ta skRunner) {}
71 71
72 void GpuTask::run(GrContextFactory& factory) { 72 void GpuTask::run(GrContextFactory& factory) {
73 if (FLAGS_gpu && !this->shouldSkip()) { 73 if (FLAGS_gpu && !this->shouldSkip()) {
74 this->start();
75 if (!FLAGS_dryRun) this->draw(&factory);
76 this->finish();
74 if (FLAGS_resetGpuContext) { 77 if (FLAGS_resetGpuContext) {
75 factory.destroyContexts(); 78 factory.destroyContexts();
76 } 79 }
77 this->start();
78 if (!FLAGS_dryRun) this->draw(&factory);
79 this->finish();
80 } 80 }
81 SkDELETE(this); 81 SkDELETE(this);
82 } 82 }
83 83
84 void GpuTask::spawnChild(CpuTask* task) { 84 void GpuTask::spawnChild(CpuTask* task) {
85 // Really spawn a new task so it runs on the CPU threadpool instead of the G PU one we're on now. 85 // Really spawn a new task so it runs on the CPU threadpool instead of the G PU one we're on now.
86 // It goes on the front of the queue to minimize the time we must hold refer ence bitmaps in RAM. 86 // It goes on the front of the queue to minimize the time we must hold refer ence bitmaps in RAM.
87 this->spawnChildNext(task); 87 this->spawnChildNext(task);
88 } 88 }
89 89
90 } // namespace DM 90 } // namespace DM
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698