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

Side by Side Diff: dm/DMTask.cpp

Issue 305963007: add --dryRun flag to dm (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 6 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 | « dm/DM.cpp ('k') | 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 7
8 DECLARE_bool(dryRun);
9
8 namespace DM { 10 namespace DM {
9 11
10 Task::Task(Reporter* reporter, TaskRunner* taskRunner) 12 Task::Task(Reporter* reporter, TaskRunner* taskRunner)
11 : fReporter(reporter) 13 : fReporter(reporter)
12 , fTaskRunner(taskRunner) 14 , fTaskRunner(taskRunner)
13 , fDepth(0) { 15 , fDepth(0) {
14 fReporter->taskCreated(); 16 fReporter->taskCreated();
15 } 17 }
16 18
17 Task::Task(const Task& parent) 19 Task::Task(const Task& parent)
(...skipping 26 matching lines...) Expand all
44 void Task::spawnChildNext(CpuTask* task) { 46 void Task::spawnChildNext(CpuTask* task) {
45 fTaskRunner->addNext(task); 47 fTaskRunner->addNext(task);
46 } 48 }
47 49
48 CpuTask::CpuTask(Reporter* reporter, TaskRunner* taskRunner) : Task(reporter, ta skRunner) {} 50 CpuTask::CpuTask(Reporter* reporter, TaskRunner* taskRunner) : Task(reporter, ta skRunner) {}
49 CpuTask::CpuTask(const Task& parent) : Task(parent) {} 51 CpuTask::CpuTask(const Task& parent) : Task(parent) {}
50 52
51 void CpuTask::run() { 53 void CpuTask::run() {
52 if (FLAGS_cpu && !this->shouldSkip()) { 54 if (FLAGS_cpu && !this->shouldSkip()) {
53 this->start(); 55 this->start();
54 this->draw(); 56 if (!FLAGS_dryRun) this->draw();
55 this->finish(); 57 this->finish();
56 } 58 }
57 SkDELETE(this); 59 SkDELETE(this);
58 } 60 }
59 61
60 void CpuTask::spawnChild(CpuTask* task) { 62 void CpuTask::spawnChild(CpuTask* task) {
61 // Run children serially on this (CPU) thread. This tends to save RAM and i s usually no slower. 63 // Run children serially on this (CPU) thread. This tends to save RAM and i s usually no slower.
62 // Calling spawnChildNext() is nearly equivalent, but it'd pointlessly conte nd on the 64 // Calling spawnChildNext() is nearly equivalent, but it'd pointlessly conte nd on the
63 // threadpool; spawnChildNext() is most useful when you want to change threa dpools. 65 // threadpool; spawnChildNext() is most useful when you want to change threa dpools.
64 task->run(); 66 task->run();
65 } 67 }
66 68
67 GpuTask::GpuTask(Reporter* reporter, TaskRunner* taskRunner) : Task(reporter, ta skRunner) {} 69 GpuTask::GpuTask(Reporter* reporter, TaskRunner* taskRunner) : Task(reporter, ta skRunner) {}
68 70
69 void GpuTask::run(GrContextFactory& factory) { 71 void GpuTask::run(GrContextFactory& factory) {
70 if (FLAGS_gpu && !this->shouldSkip()) { 72 if (FLAGS_gpu && !this->shouldSkip()) {
71 this->start(); 73 this->start();
72 this->draw(&factory); 74 if (!FLAGS_dryRun) this->draw(&factory);
73 this->finish(); 75 this->finish();
74 } 76 }
75 SkDELETE(this); 77 SkDELETE(this);
76 } 78 }
77 79
78 void GpuTask::spawnChild(CpuTask* task) { 80 void GpuTask::spawnChild(CpuTask* task) {
79 // Really spawn a new task so it runs on the CPU threadpool instead of the G PU one we're on now. 81 // Really spawn a new task so it runs on the CPU threadpool instead of the G PU one we're on now.
80 // It goes on the front of the queue to minimize the time we must hold refer ence bitmaps in RAM. 82 // It goes on the front of the queue to minimize the time we must hold refer ence bitmaps in RAM.
81 this->spawnChildNext(task); 83 this->spawnChildNext(task);
82 } 84 }
83 85
84 } // namespace DM 86 } // namespace DM
OLDNEW
« no previous file with comments | « dm/DM.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698