| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 <ctype.h> | 8 #include <ctype.h> |
| 9 | 9 |
| 10 #include "nanobench.h" | 10 #include "nanobench.h" |
| (...skipping 1002 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1013 } | 1013 } |
| 1014 }; | 1014 }; |
| 1015 static SkThread* intentionallyLeaked = new SkThread(Loop::forever); | 1015 static SkThread* intentionallyLeaked = new SkThread(Loop::forever); |
| 1016 intentionallyLeaked->start(); | 1016 intentionallyLeaked->start(); |
| 1017 } | 1017 } |
| 1018 | 1018 |
| 1019 int nanobench_main(); | 1019 int nanobench_main(); |
| 1020 int nanobench_main() { | 1020 int nanobench_main() { |
| 1021 SetupCrashHandler(); | 1021 SetupCrashHandler(); |
| 1022 SkAutoGraphics ag; | 1022 SkAutoGraphics ag; |
| 1023 #if SK_SUPPORT_GPU |
| 1024 SkTaskGroup::Enabler enabled(FLAGS_threads, GrContextFactory::ReleaseGpuAPIs
InThread); |
| 1025 #else |
| 1023 SkTaskGroup::Enabler enabled(FLAGS_threads); | 1026 SkTaskGroup::Enabler enabled(FLAGS_threads); |
| 1027 #endif |
| 1024 | 1028 |
| 1025 #if SK_SUPPORT_GPU | 1029 #if SK_SUPPORT_GPU |
| 1026 GrContextOptions grContextOpts; | 1030 GrContextOptions grContextOpts; |
| 1027 grContextOpts.fDrawPathToCompressedTexture = FLAGS_gpuCompressAlphaMasks; | 1031 grContextOpts.fDrawPathToCompressedTexture = FLAGS_gpuCompressAlphaMasks; |
| 1028 gGrFactory.reset(new GrContextFactory(grContextOpts)); | 1032 gGrFactory.reset(new GrContextFactory(grContextOpts)); |
| 1029 #endif | 1033 #endif |
| 1030 | 1034 |
| 1031 if (FLAGS_veryVerbose) { | 1035 if (FLAGS_veryVerbose) { |
| 1032 FLAGS_verbose = true; | 1036 FLAGS_verbose = true; |
| 1033 } | 1037 } |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1265 | 1269 |
| 1266 log->bench("memory_usage", 0,0); | 1270 log->bench("memory_usage", 0,0); |
| 1267 log->config("meta"); | 1271 log->config("meta"); |
| 1268 log->metric("max_rss_mb", sk_tools::getMaxResidentSetSizeMB()); | 1272 log->metric("max_rss_mb", sk_tools::getMaxResidentSetSizeMB()); |
| 1269 | 1273 |
| 1270 #if SK_SUPPORT_GPU | 1274 #if SK_SUPPORT_GPU |
| 1271 // Make sure we clean up the global GrContextFactory here, otherwise we migh
t race with the | 1275 // Make sure we clean up the global GrContextFactory here, otherwise we migh
t race with the |
| 1272 // SkEventTracer destructor | 1276 // SkEventTracer destructor |
| 1273 gGrFactory.reset(nullptr); | 1277 gGrFactory.reset(nullptr); |
| 1274 #endif | 1278 #endif |
| 1275 | 1279 #if SK_SUPPORT_GPU |
| 1280 // The main thread maybe ran GPU code. |
| 1281 GrContextFactory::ReleaseGpuAPIsInThread(); |
| 1282 #endif |
| 1276 return 0; | 1283 return 0; |
| 1277 } | 1284 } |
| 1278 | 1285 |
| 1279 #if !defined SK_BUILD_FOR_IOS | 1286 #if !defined SK_BUILD_FOR_IOS |
| 1280 int main(int argc, char** argv) { | 1287 int main(int argc, char** argv) { |
| 1281 SkCommandLineFlags::Parse(argc, argv); | 1288 SkCommandLineFlags::Parse(argc, argv); |
| 1282 return nanobench_main(); | 1289 return nanobench_main(); |
| 1283 } | 1290 } |
| 1284 #endif | 1291 #endif |
| OLD | NEW |