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

Side by Side Diff: dm/DM.cpp

Issue 1511773005: Make SkGLContext lifetime more well-defined (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix the test Created 4 years, 11 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 | « bench/nanobench.cpp ('k') | gyp/pathops_unittest.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1129 matching lines...) Expand 10 before | Expand all | Expand 10 after
1140 } 1140 }
1141 1141
1142 // TODO: currently many GPU tests are declared outside SK_SUPPORT_GPU guards. 1142 // TODO: currently many GPU tests are declared outside SK_SUPPORT_GPU guards.
1143 // Thus we export the empty RunWithGPUTestContexts when SK_SUPPORT_GPU=0. 1143 // Thus we export the empty RunWithGPUTestContexts when SK_SUPPORT_GPU=0.
1144 namespace skiatest { 1144 namespace skiatest {
1145 namespace { 1145 namespace {
1146 typedef void(*TestWithGrContext)(skiatest::Reporter*, GrContext*); 1146 typedef void(*TestWithGrContext)(skiatest::Reporter*, GrContext*);
1147 typedef void(*TestWithGrContextAndGLContext)(skiatest::Reporter*, GrContext*, Sk GLContext*); 1147 typedef void(*TestWithGrContextAndGLContext)(skiatest::Reporter*, GrContext*, Sk GLContext*);
1148 #if SK_SUPPORT_GPU 1148 #if SK_SUPPORT_GPU
1149 template<typename T> 1149 template<typename T>
1150 void call_test(T test, skiatest::Reporter* reporter, GrContextFactory::ContextIn fo* context); 1150 void call_test(T test, skiatest::Reporter* reporter, const GrContextFactory::Con textInfo& context);
1151 template<> 1151 template<>
1152 void call_test(TestWithGrContext test, skiatest::Reporter* reporter, 1152 void call_test(TestWithGrContext test, skiatest::Reporter* reporter,
1153 GrContextFactory::ContextInfo* context) { 1153 const GrContextFactory::ContextInfo& context) {
1154 test(reporter, context->fGrContext); 1154 test(reporter, context.fGrContext);
1155 } 1155 }
1156 template<> 1156 template<>
1157 void call_test(TestWithGrContextAndGLContext test, skiatest::Reporter* reporter, 1157 void call_test(TestWithGrContextAndGLContext test, skiatest::Reporter* reporter,
1158 GrContextFactory::ContextInfo* context) { 1158 const GrContextFactory::ContextInfo& context) {
1159 test(reporter, context->fGrContext, context->fGLContext); 1159 test(reporter, context.fGrContext, context.fGLContext);
1160 } 1160 }
1161 #endif 1161 #endif
1162 } // namespace 1162 } // namespace
1163 1163
1164 template<typename T> 1164 template<typename T>
1165 void RunWithGPUTestContexts(T test, GPUTestContexts testContexts, Reporter* repo rter, 1165 void RunWithGPUTestContexts(T test, GPUTestContexts testContexts, Reporter* repo rter,
1166 GrContextFactory* factory) { 1166 GrContextFactory* factory) {
1167 #if SK_SUPPORT_GPU 1167 #if SK_SUPPORT_GPU
1168 // Iterate over context types, except use "native" instead of explicitly try ing OpenGL and 1168 // Iterate over context types, except use "native" instead of explicitly try ing OpenGL and
1169 // OpenGL ES. Do not use GLES on desktop, since tests do not account for not fixing 1169 // OpenGL ES. Do not use GLES on desktop, since tests do not account for not fixing
(...skipping 25 matching lines...) Expand all
1195 } else if (contextType == GrContextFactory::kNative_GLContextType) { 1195 } else if (contextType == GrContextFactory::kNative_GLContextType) {
1196 contextSelector |= kNative_GPUTestContexts; 1196 contextSelector |= kNative_GPUTestContexts;
1197 } else if (contextType == GrContextFactory::kNull_GLContextType) { 1197 } else if (contextType == GrContextFactory::kNull_GLContextType) {
1198 contextSelector |= kNull_GPUTestContexts; 1198 contextSelector |= kNull_GPUTestContexts;
1199 } else if (contextType == GrContextFactory::kDebug_GLContextType) { 1199 } else if (contextType == GrContextFactory::kDebug_GLContextType) {
1200 contextSelector |= kDebug_GPUTestContexts; 1200 contextSelector |= kDebug_GPUTestContexts;
1201 } 1201 }
1202 if ((testContexts & contextSelector) == 0) { 1202 if ((testContexts & contextSelector) == 0) {
1203 continue; 1203 continue;
1204 } 1204 }
1205 if (GrContextFactory::ContextInfo* context = factory->getContextInfo(con textType)) { 1205 GrContextFactory::ContextInfo context = factory->getContextInfo(contextT ype);
1206 if (context.fGrContext) {
1206 call_test(test, reporter, context); 1207 call_test(test, reporter, context);
1207 } 1208 }
1208 if (GrContextFactory::ContextInfo* context = 1209 context = factory->getContextInfo(contextType,
1209 factory->getContextInfo(contextType, GrContextFactory::kEnableNVPR_G LContextOptions)) { 1210 GrContextFactory::kEnableNVPR_GLContex tOptions);
1211 if (context.fGrContext) {
1210 call_test(test, reporter, context); 1212 call_test(test, reporter, context);
1211 } 1213 }
1212 } 1214 }
1213 #endif 1215 #endif
1214 } 1216 }
1215 1217
1216 template 1218 template
1217 void RunWithGPUTestContexts<TestWithGrContext>(TestWithGrContext test, 1219 void RunWithGPUTestContexts<TestWithGrContext>(TestWithGrContext test,
1218 GPUTestContexts testContexts, 1220 GPUTestContexts testContexts,
1219 Reporter* reporter, 1221 Reporter* reporter,
1220 GrContextFactory* factory); 1222 GrContextFactory* factory);
1221 template 1223 template
1222 void RunWithGPUTestContexts<TestWithGrContextAndGLContext>(TestWithGrContextAndG LContext test, 1224 void RunWithGPUTestContexts<TestWithGrContextAndGLContext>(TestWithGrContextAndG LContext test,
1223 GPUTestContexts testC ontexts, 1225 GPUTestContexts testC ontexts,
1224 Reporter* reporter, 1226 Reporter* reporter,
1225 GrContextFactory* fac tory); 1227 GrContextFactory* fac tory);
1226 } // namespace skiatest 1228 } // namespace skiatest
1227 1229
1228 #if !defined(SK_BUILD_FOR_IOS) 1230 #if !defined(SK_BUILD_FOR_IOS)
1229 int main(int argc, char** argv) { 1231 int main(int argc, char** argv) {
1230 SkCommandLineFlags::Parse(argc, argv); 1232 SkCommandLineFlags::Parse(argc, argv);
1231 return dm_main(); 1233 return dm_main();
1232 } 1234 }
1233 #endif 1235 #endif
OLDNEW
« no previous file with comments | « bench/nanobench.cpp ('k') | gyp/pathops_unittest.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698