| OLD | NEW | 
|---|
| 1 /* | 1 /* | 
| 2  * Copyright 2013 Google Inc. | 2  * Copyright 2013 Google Inc. | 
| 3  * | 3  * | 
| 4  * Use of this source code is governed by a BSD-style license that can be | 4  * Use of this source code is governed by a BSD-style license that can be | 
| 5  * found in the LICENSE file. | 5  * found in the LICENSE file. | 
| 6  */ | 6  */ | 
| 7 | 7 | 
| 8 #include "CrashHandler.h" | 8 #include "CrashHandler.h" | 
| 9 #include "DMJsonWriter.h" | 9 #include "DMJsonWriter.h" | 
| 10 #include "DMSrcSink.h" | 10 #include "DMSrcSink.h" | 
| (...skipping 1090 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1101     // CPU tests run on any thread.  GPU tests depend on --gpu_threading. | 1101     // CPU tests run on any thread.  GPU tests depend on --gpu_threading. | 
| 1102     SkTArray<Task> enclaves[kNumEnclaves]; | 1102     SkTArray<Task> enclaves[kNumEnclaves]; | 
| 1103     for (int j = 0; j < gSinks.count(); j++) { | 1103     for (int j = 0; j < gSinks.count(); j++) { | 
| 1104         SkTArray<Task>& tasks = enclaves[gSinks[j]->enclave()]; | 1104         SkTArray<Task>& tasks = enclaves[gSinks[j]->enclave()]; | 
| 1105         for (int i = 0; i < gSrcs.count(); i++) { | 1105         for (int i = 0; i < gSrcs.count(); i++) { | 
| 1106             tasks.push_back(Task(gSrcs[i], gSinks[j])); | 1106             tasks.push_back(Task(gSrcs[i], gSinks[j])); | 
| 1107         } | 1107         } | 
| 1108     } | 1108     } | 
| 1109 | 1109 | 
| 1110     SkTaskGroup tg; | 1110     SkTaskGroup tg; | 
| 1111     tg.batch(run_test, gThreadedTests.begin(), gThreadedTests.count()); | 1111     tg.batch([](int i){ run_test(&gThreadedTests[i]); }, gThreadedTests.count())
      ; | 
| 1112     for (int i = 0; i < kNumEnclaves; i++) { | 1112     for (int i = 0; i < kNumEnclaves; i++) { | 
|  | 1113         SkTArray<Task>* currentEnclave = &enclaves[i]; | 
| 1113         switch(i) { | 1114         switch(i) { | 
| 1114             case kAnyThread_Enclave: | 1115             case kAnyThread_Enclave: | 
| 1115                 tg.batch(Task::Run, enclaves[i].begin(), enclaves[i].count()); | 1116                 tg.batch([currentEnclave](int j) { Task::Run(&(*currentEnclave)[
      j]); }, currentEnclave->count()); | 
| 1116                 break; | 1117                 break; | 
| 1117             case kGPU_Enclave: | 1118             case kGPU_Enclave: | 
| 1118                 tg.add(run_enclave_and_gpu_tests, &enclaves[i]); | 1119                 tg.add([currentEnclave](){ run_enclave_and_gpu_tests(currentEncl
      ave); }); | 
| 1119                 break; | 1120                 break; | 
| 1120             default: | 1121             default: | 
| 1121                 tg.add(run_enclave, &enclaves[i]); | 1122                 tg.add([currentEnclave](){ run_enclave(currentEnclave); }); | 
| 1122                 break; | 1123                 break; | 
| 1123         } | 1124         } | 
| 1124     } | 1125     } | 
| 1125     tg.wait(); | 1126     tg.wait(); | 
| 1126     // At this point we're back in single-threaded land. | 1127     // At this point we're back in single-threaded land. | 
| 1127     sk_tool_utils::release_portable_typefaces(); | 1128     sk_tool_utils::release_portable_typefaces(); | 
| 1128 | 1129 | 
| 1129     if (FLAGS_verbose && gNoteTally.count() > 0) { | 1130     if (FLAGS_verbose && gNoteTally.count() > 0) { | 
| 1130         SkDebugf("\nNote tally:\n"); | 1131         SkDebugf("\nNote tally:\n"); | 
| 1131         gNoteTally.foreach([](const SkString& note, int* tally) { | 1132         gNoteTally.foreach([](const SkString& note, int* tally) { | 
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1167     test(reporter, context->fGrContext); | 1168     test(reporter, context->fGrContext); | 
| 1168 } | 1169 } | 
| 1169 template<> | 1170 template<> | 
| 1170 void call_test(TestWithGrContextAndGLContext test, skiatest::Reporter* reporter, | 1171 void call_test(TestWithGrContextAndGLContext test, skiatest::Reporter* reporter, | 
| 1171                GrContextFactory::ContextInfo* context) { | 1172                GrContextFactory::ContextInfo* context) { | 
| 1172     test(reporter, context->fGrContext, context->fGLContext); | 1173     test(reporter, context->fGrContext, context->fGLContext); | 
| 1173 } | 1174 } | 
| 1174 #endif | 1175 #endif | 
| 1175 } // namespace | 1176 } // namespace | 
| 1176 | 1177 | 
| 1177 |  | 
| 1178 template<typename T> | 1178 template<typename T> | 
| 1179 void RunWithGPUTestContexts(T test, GPUTestContexts testContexts, Reporter* repo
      rter, | 1179 void RunWithGPUTestContexts(T test, GPUTestContexts testContexts, Reporter* repo
      rter, | 
| 1180                             GrContextFactory* factory) { | 1180                             GrContextFactory* factory) { | 
| 1181 #if SK_SUPPORT_GPU | 1181 #if SK_SUPPORT_GPU | 
| 1182     const GrGLStandard api = get_gpu_api(); | 1182     const GrGLStandard api = get_gpu_api(); | 
| 1183     for (int i = 0; i < GrContextFactory::kGLContextTypeCnt; ++i) { | 1183     for (int i = 0; i < GrContextFactory::kGLContextTypeCnt; ++i) { | 
| 1184         GrContextFactory::GLContextType glCtxType = (GrContextFactory::GLContext
      Type) i; | 1184         GrContextFactory::GLContextType glCtxType = (GrContextFactory::GLContext
      Type) i; | 
| 1185         int contextSelector = kNone_GPUTestContexts; | 1185         int contextSelector = kNone_GPUTestContexts; | 
| 1186         if (GrContextFactory::IsRenderingGLContext(glCtxType)) { | 1186         if (GrContextFactory::IsRenderingGLContext(glCtxType)) { | 
| 1187             contextSelector |= kAllRendering_GPUTestContexts; | 1187             contextSelector |= kAllRendering_GPUTestContexts; | 
| (...skipping 30 matching lines...) Expand all  Loading... | 
| 1218                                                            Reporter* reporter, | 1218                                                            Reporter* reporter, | 
| 1219                                                            GrContextFactory* fac
      tory); | 1219                                                            GrContextFactory* fac
      tory); | 
| 1220 } // namespace skiatest | 1220 } // namespace skiatest | 
| 1221 | 1221 | 
| 1222 #if !defined(SK_BUILD_FOR_IOS) | 1222 #if !defined(SK_BUILD_FOR_IOS) | 
| 1223 int main(int argc, char** argv) { | 1223 int main(int argc, char** argv) { | 
| 1224     SkCommandLineFlags::Parse(argc, argv); | 1224     SkCommandLineFlags::Parse(argc, argv); | 
| 1225     return dm_main(); | 1225     return dm_main(); | 
| 1226 } | 1226 } | 
| 1227 #endif | 1227 #endif | 
| OLD | NEW | 
|---|