| 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 "SkOnce.h" | 8 #include "SkOnce.h" |
| 9 #include "SkRunnable.h" | |
| 10 #include "SkTaskGroup.h" | 9 #include "SkTaskGroup.h" |
| 11 #include "Test.h" | 10 #include "Test.h" |
| 12 | 11 |
| 13 static void add_five(int* x) { | 12 static void add_five(int* x) { |
| 14 *x += 5; | 13 *x += 5; |
| 15 } | 14 } |
| 16 | 15 |
| 17 SK_DECLARE_STATIC_ONCE(st_once); | 16 SK_DECLARE_STATIC_ONCE(st_once); |
| 18 DEF_TEST(SkOnce_Singlethreaded, r) { | 17 DEF_TEST(SkOnce_Singlethreaded, r) { |
| 19 int x = 0; | 18 int x = 0; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 44 static int gX = 0; | 43 static int gX = 0; |
| 45 static void inc_gX() { gX++; } | 44 static void inc_gX() { gX++; } |
| 46 | 45 |
| 47 SK_DECLARE_STATIC_ONCE(noarg_once); | 46 SK_DECLARE_STATIC_ONCE(noarg_once); |
| 48 DEF_TEST(SkOnce_NoArg, r) { | 47 DEF_TEST(SkOnce_NoArg, r) { |
| 49 SkOnce(&noarg_once, inc_gX); | 48 SkOnce(&noarg_once, inc_gX); |
| 50 SkOnce(&noarg_once, inc_gX); | 49 SkOnce(&noarg_once, inc_gX); |
| 51 SkOnce(&noarg_once, inc_gX); | 50 SkOnce(&noarg_once, inc_gX); |
| 52 REPORTER_ASSERT(r, 1 == gX); | 51 REPORTER_ASSERT(r, 1 == gX); |
| 53 } | 52 } |
| OLD | NEW |