static void path_fuzz_stroker(SkBitmap* bitmap, int seed) { ThreadState states[100]; for (size_t i = 0; i < SK_ARRAY_COUNT(states); i++) { states[i].fSeed = seed + (int) i; states[i].fBitmap = bitmap; } SkTaskGroup tg; tg.batch(test_fuzz, states, SK_ARRAY_COUNT(states)); }
int dm_main() { SetupCrashHandler(); SkAutoGraphics ag; SkTaskGroup::Enabler enabled(FLAGS_threads); gCreateTypefaceDelegate = &create_from_name; start_keepalive(); gather_gold(); gather_uninteresting_hashes(); gather_srcs(); gather_sinks(); gather_tests(); gPending = gSrcs.count() * gSinks.count() + gThreadedTests.count() + gGPUTests.count(); SkDebugf("%d srcs * %d sinks + %d tests == %d tasks\n", gSrcs.count(), gSinks.count(), gThreadedTests.count() + gGPUTests.count(), gPending); // We try to exploit as much parallelism as is safe. Most Src/Sink pairs run on any thread, // but Sinks that identify as part of a particular enclave run serially on a single thread. // CPU tests run on any thread. GPU tests depend on --gpu_threading. SkTArray<Task> enclaves[kNumEnclaves]; for (int j = 0; j < gSinks.count(); j++) { SkTArray<Task>& tasks = enclaves[gSinks[j]->enclave()]; for (int i = 0; i < gSrcs.count(); i++) { tasks.push_back(Task(gSrcs[i], gSinks[j])); } } SkTaskGroup tg; tg.batch(run_test, gThreadedTests.begin(), gThreadedTests.count()); for (int i = 0; i < kNumEnclaves; i++) { switch(i) { case kAnyThread_Enclave: tg.batch(Task::Run, enclaves[i].begin(), enclaves[i].count()); break; case kGPU_Enclave: tg.add(run_enclave_and_gpu_tests, &enclaves[i]); break; default: tg.add(run_enclave, &enclaves[i]); break; } } tg.wait(); // At this point we're back in single-threaded land. sk_tool_utils::release_portable_typefaces(); SkDebugf("\n"); if (gFailures.count() > 0) { SkDebugf("Failures:\n"); for (int i = 0; i < gFailures.count(); i++) { SkDebugf("\t%s\n", gFailures[i].c_str()); } SkDebugf("%d failures\n", gFailures.count()); return 1; } if (gPending > 0) { SkDebugf("Hrm, we didn't seem to run everything we intended to! Please file a bug.\n"); return 1; } return 0; }