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

Side by Side Diff: tests/OnceTest.cpp

Issue 806653007: Fix up all the easy virtual ... SK_OVERRIDE cases. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 5 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 | « tests/LazyPtrTest.cpp ('k') | tests/PDFInvalidBitmapTest.cpp » ('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 "SkOnce.h" 8 #include "SkOnce.h"
9 #include "SkRunnable.h" 9 #include "SkRunnable.h"
10 #include "SkTaskGroup.h" 10 #include "SkTaskGroup.h"
(...skipping 21 matching lines...) Expand all
32 *x += 6; 32 *x += 6;
33 } 33 }
34 34
35 namespace { 35 namespace {
36 36
37 class Racer : public SkRunnable { 37 class Racer : public SkRunnable {
38 public: 38 public:
39 SkOnceFlag* once; 39 SkOnceFlag* once;
40 int* ptr; 40 int* ptr;
41 41
42 virtual void run() SK_OVERRIDE { 42 void run() SK_OVERRIDE {
43 SkOnce(once, add_six, ptr); 43 SkOnce(once, add_six, ptr);
44 } 44 }
45 }; 45 };
46 46
47 } // namespace 47 } // namespace
48 48
49 DEF_TEST(SkOnce_Multithreaded, r) { 49 DEF_TEST(SkOnce_Multithreaded, r) {
50 const int kTasks = 16; 50 const int kTasks = 16;
51 51
52 // Make a bunch of tasks that will race to be the first to add six to x. 52 // Make a bunch of tasks that will race to be the first to add six to x.
(...skipping 19 matching lines...) Expand all
72 static int gX = 0; 72 static int gX = 0;
73 static void inc_gX() { gX++; } 73 static void inc_gX() { gX++; }
74 74
75 DEF_TEST(SkOnce_NoArg, r) { 75 DEF_TEST(SkOnce_NoArg, r) {
76 SK_DECLARE_STATIC_ONCE(once); 76 SK_DECLARE_STATIC_ONCE(once);
77 SkOnce(&once, inc_gX); 77 SkOnce(&once, inc_gX);
78 SkOnce(&once, inc_gX); 78 SkOnce(&once, inc_gX);
79 SkOnce(&once, inc_gX); 79 SkOnce(&once, inc_gX);
80 REPORTER_ASSERT(r, 1 == gX); 80 REPORTER_ASSERT(r, 1 == gX);
81 } 81 }
OLDNEW
« no previous file with comments | « tests/LazyPtrTest.cpp ('k') | tests/PDFInvalidBitmapTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698