| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 "BenchTimer.h" | 8 #include "BenchTimer.h" |
| 9 #include "ResultsWriter.h" | 9 #include "ResultsWriter.h" |
| 10 #include "SkBenchLogger.h" | 10 #include "SkBenchLogger.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 public: | 48 public: |
| 49 GMBenchFactory(const skiagm::GMRegistry* gmreg) | 49 GMBenchFactory(const skiagm::GMRegistry* gmreg) |
| 50 : fGMFactory(gmreg->factory()) { | 50 : fGMFactory(gmreg->factory()) { |
| 51 fSelfRegistry = SkNEW_ARGS(BenchRegistry, (this)); | 51 fSelfRegistry = SkNEW_ARGS(BenchRegistry, (this)); |
| 52 } | 52 } |
| 53 | 53 |
| 54 virtual ~GMBenchFactory() { SkDELETE(fSelfRegistry); } | 54 virtual ~GMBenchFactory() { SkDELETE(fSelfRegistry); } |
| 55 | 55 |
| 56 virtual SkBenchmark* operator()() const SK_OVERRIDE { | 56 virtual SkBenchmark* operator()() const SK_OVERRIDE { |
| 57 skiagm::GM* gm = fGMFactory(NULL); | 57 skiagm::GM* gm = fGMFactory(NULL); |
| 58 gm->setMode(skiagm::GM::kBench_Mode); |
| 58 return SkNEW_ARGS(SkGMBench, (gm)); | 59 return SkNEW_ARGS(SkGMBench, (gm)); |
| 59 } | 60 } |
| 60 | 61 |
| 61 private: | 62 private: |
| 62 skiagm::GMRegistry::Factory fGMFactory; | 63 skiagm::GMRegistry::Factory fGMFactory; |
| 63 BenchRegistry* fSelfRegistry; | 64 BenchRegistry* fSelfRegistry; |
| 64 }; | 65 }; |
| 65 | 66 |
| 66 static void register_gm_benches() { | 67 static void register_gm_benches() { |
| 67 static bool gOnce; | 68 static bool gOnce; |
| (...skipping 649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 717 gContextFactory.destroyContexts(); | 718 gContextFactory.destroyContexts(); |
| 718 #endif | 719 #endif |
| 719 return 0; | 720 return 0; |
| 720 } | 721 } |
| 721 | 722 |
| 722 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) | 723 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) |
| 723 int main(int argc, char * const argv[]) { | 724 int main(int argc, char * const argv[]) { |
| 724 return tool_main(argc, (char**) argv); | 725 return tool_main(argc, (char**) argv); |
| 725 } | 726 } |
| 726 #endif | 727 #endif |
| OLD | NEW |