OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 "SkChecksum.h" | 8 #include "SkChecksum.h" |
9 #include "SkString.h" | 9 #include "SkString.h" |
10 #include "SkTHash.h" | 10 #include "SkTHash.h" |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 REPORTER_ASSERT(r, set.count() == 1); | 87 REPORTER_ASSERT(r, set.count() == 1); |
88 | 88 |
89 set.reset(); | 89 set.reset(); |
90 REPORTER_ASSERT(r, set.count() == 0); | 90 REPORTER_ASSERT(r, set.count() == 0); |
91 } | 91 } |
92 | 92 |
93 namespace { | 93 namespace { |
94 | 94 |
95 class CopyCounter { | 95 class CopyCounter { |
96 public: | 96 public: |
97 CopyCounter() : fID(0), fCounter(NULL) {} | 97 CopyCounter() : fID(0), fCounter(nullptr) {} |
98 | 98 |
99 CopyCounter(uint32_t id, uint32_t* counter) : fID(id), fCounter(counter) {} | 99 CopyCounter(uint32_t id, uint32_t* counter) : fID(id), fCounter(counter) {} |
100 | 100 |
101 CopyCounter(const CopyCounter& other) | 101 CopyCounter(const CopyCounter& other) |
102 : fID(other.fID) | 102 : fID(other.fID) |
103 , fCounter(other.fCounter) { | 103 , fCounter(other.fCounter) { |
104 SkASSERT(fCounter); | 104 SkASSERT(fCounter); |
105 *fCounter += 1; | 105 *fCounter += 1; |
106 } | 106 } |
107 | 107 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 set.add(copyCounter2); | 145 set.add(copyCounter2); |
146 REPORTER_ASSERT(r, globalCounter == 3); | 146 REPORTER_ASSERT(r, globalCounter == 3); |
147 REPORTER_ASSERT(r, set.contains(copyCounter1)); | 147 REPORTER_ASSERT(r, set.contains(copyCounter1)); |
148 REPORTER_ASSERT(r, set.contains(copyCounter2)); | 148 REPORTER_ASSERT(r, set.contains(copyCounter2)); |
149 REPORTER_ASSERT(r, globalCounter == 3); | 149 REPORTER_ASSERT(r, globalCounter == 3); |
150 set.add(copyCounter1); | 150 set.add(copyCounter1); |
151 set.add(copyCounter2); | 151 set.add(copyCounter2); |
152 // We allow copies for same-value adds for now. | 152 // We allow copies for same-value adds for now. |
153 REPORTER_ASSERT(r, globalCounter == 5); | 153 REPORTER_ASSERT(r, globalCounter == 5); |
154 } | 154 } |
OLD | NEW |