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

Side by Side Diff: dm/DM.cpp

Issue 1733323002: Clean up EGL thread state at thread exit in nanobench and DM (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix main thread usage also Created 4 years, 10 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') | include/gpu/gl/SkGLContext.h » ('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 1087 matching lines...) Expand 10 before | Expand all | Expand 10 after
1098 #undef PORTABLE_FONT_PREFIX 1098 #undef PORTABLE_FONT_PREFIX
1099 1099
1100 extern SkTypeface* (*gCreateTypefaceDelegate)(const char [], SkTypeface::Style ) ; 1100 extern SkTypeface* (*gCreateTypefaceDelegate)(const char [], SkTypeface::Style ) ;
1101 1101
1102 int dm_main(); 1102 int dm_main();
1103 int dm_main() { 1103 int dm_main() {
1104 setup_crash_handler(); 1104 setup_crash_handler();
1105 1105
1106 JsonWriter::DumpJson(); // It's handy for the bots to assume this is ~never missing. 1106 JsonWriter::DumpJson(); // It's handy for the bots to assume this is ~never missing.
1107 SkAutoGraphics ag; 1107 SkAutoGraphics ag;
1108 #if SK_SUPPORT_GPU
1109 SkTaskGroup::Enabler enabled(FLAGS_threads, GrContextFactory::ReleaseGpuAPIs InThread);
1110 #else
1108 SkTaskGroup::Enabler enabled(FLAGS_threads); 1111 SkTaskGroup::Enabler enabled(FLAGS_threads);
1112 #endif
1109 gCreateTypefaceDelegate = &create_from_name; 1113 gCreateTypefaceDelegate = &create_from_name;
1110 1114
1111 { 1115 {
1112 SkString testResourcePath = GetResourcePath("color_wheel.png"); 1116 SkString testResourcePath = GetResourcePath("color_wheel.png");
1113 SkFILEStream testResource(testResourcePath.c_str()); 1117 SkFILEStream testResource(testResourcePath.c_str());
1114 if (!testResource.isValid()) { 1118 if (!testResource.isValid()) {
1115 SkDebugf("Some resources are missing. Do you need to set --resource Path?\n"); 1119 SkDebugf("Some resources are missing. Do you need to set --resource Path?\n");
1116 } 1120 }
1117 } 1121 }
1118 gather_gold(); 1122 gather_gold();
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
1176 SkDebugf("%d failures\n", gFailures.count()); 1180 SkDebugf("%d failures\n", gFailures.count());
1177 return 1; 1181 return 1;
1178 } 1182 }
1179 1183
1180 #ifdef SK_PDF_IMAGE_STATS 1184 #ifdef SK_PDF_IMAGE_STATS
1181 SkPDFImageDumpStats(); 1185 SkPDFImageDumpStats();
1182 #endif // SK_PDF_IMAGE_STATS 1186 #endif // SK_PDF_IMAGE_STATS
1183 1187
1184 print_status(); 1188 print_status();
1185 SkDebugf("Finished!\n"); 1189 SkDebugf("Finished!\n");
1190
1191 #if SK_SUPPORT_GPU
1192 // The main thread maybe ran GPU code.
1193 GrContextFactory::ReleaseGpuAPIsInThread();
1194 #endif
1186 return 0; 1195 return 0;
1187 } 1196 }
1188 1197
1189 // TODO: currently many GPU tests are declared outside SK_SUPPORT_GPU guards. 1198 // TODO: currently many GPU tests are declared outside SK_SUPPORT_GPU guards.
1190 // Thus we export the empty RunWithGPUTestContexts when SK_SUPPORT_GPU=0. 1199 // Thus we export the empty RunWithGPUTestContexts when SK_SUPPORT_GPU=0.
1191 namespace skiatest { 1200 namespace skiatest {
1192 namespace { 1201 namespace {
1193 typedef void(*TestWithGrContext)(skiatest::Reporter*, GrContext*); 1202 typedef void(*TestWithGrContext)(skiatest::Reporter*, GrContext*);
1194 typedef void(*TestWithGrContextAndGLContext)(skiatest::Reporter*, GrContext*, Sk GLContext*); 1203 typedef void(*TestWithGrContextAndGLContext)(skiatest::Reporter*, GrContext*, Sk GLContext*);
1195 #if SK_SUPPORT_GPU 1204 #if SK_SUPPORT_GPU
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
1273 Reporter* reporter, 1282 Reporter* reporter,
1274 GrContextFactory* fac tory); 1283 GrContextFactory* fac tory);
1275 } // namespace skiatest 1284 } // namespace skiatest
1276 1285
1277 #if !defined(SK_BUILD_FOR_IOS) 1286 #if !defined(SK_BUILD_FOR_IOS)
1278 int main(int argc, char** argv) { 1287 int main(int argc, char** argv) {
1279 SkCommandLineFlags::Parse(argc, argv); 1288 SkCommandLineFlags::Parse(argc, argv);
1280 return dm_main(); 1289 return dm_main();
1281 } 1290 }
1282 #endif 1291 #endif
OLDNEW
« no previous file with comments | « bench/nanobench.cpp ('k') | include/gpu/gl/SkGLContext.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698