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

Side by Side Diff: tests/LazyPtrTest.cpp

Issue 1037793002: C++11 override should now be supported by all of {bots,Chrome,Android,Mozilla} (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: git cl web Created 5 years, 9 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/LayerDrawLooperTest.cpp ('k') | tests/OnceTest.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 #include "Test.h" 1 #include "Test.h"
2 #include "SkLazyPtr.h" 2 #include "SkLazyPtr.h"
3 #include "SkRunnable.h" 3 #include "SkRunnable.h"
4 #include "SkTaskGroup.h" 4 #include "SkTaskGroup.h"
5 5
6 namespace { 6 namespace {
7 7
8 struct CreateIntFromFloat { 8 struct CreateIntFromFloat {
9 CreateIntFromFloat(float val) : fVal(val) {} 9 CreateIntFromFloat(float val) : fVal(val) {}
10 int* operator()() const { return SkNEW_ARGS(int, ((int)fVal)); } 10 int* operator()() const { return SkNEW_ARGS(int, ((int)fVal)); }
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 REPORTER_ASSERT(r, 99 == *ptr); 42 REPORTER_ASSERT(r, 99 == *ptr);
43 // Since custom_destroy didn't actually delete ptr, we do now. 43 // Since custom_destroy didn't actually delete ptr, we do now.
44 SkDELETE(ptr); 44 SkDELETE(ptr);
45 } 45 }
46 46
47 namespace { 47 namespace {
48 48
49 struct Racer : public SkRunnable { 49 struct Racer : public SkRunnable {
50 Racer() : fLazy(NULL), fSeen(NULL) {} 50 Racer() : fLazy(NULL), fSeen(NULL) {}
51 51
52 void run() SK_OVERRIDE { fSeen = fLazy->get(); } 52 void run() override { fSeen = fLazy->get(); }
53 53
54 SkLazyPtr<int>* fLazy; 54 SkLazyPtr<int>* fLazy;
55 int* fSeen; 55 int* fSeen;
56 }; 56 };
57 57
58 } // namespace 58 } // namespace
59 59
60 DEF_TEST(LazyPtr_Threaded, r) { 60 DEF_TEST(LazyPtr_Threaded, r) {
61 static const int kRacers = 321; 61 static const int kRacers = 321;
62 62
63 SkLazyPtr<int> lazy; 63 SkLazyPtr<int> lazy;
64 64
65 Racer racers[kRacers]; 65 Racer racers[kRacers];
66 for (int i = 0; i < kRacers; i++) { 66 for (int i = 0; i < kRacers; i++) {
67 racers[i].fLazy = &lazy; 67 racers[i].fLazy = &lazy;
68 } 68 }
69 69
70 SkTaskGroup tg; 70 SkTaskGroup tg;
71 for (int i = 0; i < kRacers; i++) { 71 for (int i = 0; i < kRacers; i++) {
72 tg.add(racers + i); 72 tg.add(racers + i);
73 } 73 }
74 tg.wait(); 74 tg.wait();
75 75
76 for (int i = 1; i < kRacers; i++) { 76 for (int i = 1; i < kRacers; i++) {
77 REPORTER_ASSERT(r, racers[i].fSeen); 77 REPORTER_ASSERT(r, racers[i].fSeen);
78 REPORTER_ASSERT(r, racers[i].fSeen == racers[0].fSeen); 78 REPORTER_ASSERT(r, racers[i].fSeen == racers[0].fSeen);
79 } 79 }
80 } 80 }
OLDNEW
« no previous file with comments | « tests/LayerDrawLooperTest.cpp ('k') | tests/OnceTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698