OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 "SkRefCnt.h" | 8 #include "SkRefCnt.h" |
9 #include "SkThreadUtils.h" | 9 #include "SkThreadUtils.h" |
10 #include "SkTypes.h" | 10 #include "SkTypes.h" |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 if (0 == --fRefCnt) { | 113 if (0 == --fRefCnt) { |
114 gDeleteCounter += 1; | 114 gDeleteCounter += 1; |
115 delete this; | 115 delete this; |
116 } | 116 } |
117 } | 117 } |
118 | 118 |
119 int* method() const { return new int; } | 119 int* method() const { return new int; } |
120 }; | 120 }; |
121 | 121 |
122 static sk_sp<Effect> Create() { | 122 static sk_sp<Effect> Create() { |
123 return sk_sp<Effect>(new Effect); | 123 return sk_make_sp<Effect>(); |
124 } | 124 } |
125 | 125 |
126 class Paint { | 126 class Paint { |
127 public: | 127 public: |
128 sk_sp<Effect> fEffect; | 128 sk_sp<Effect> fEffect; |
129 | 129 |
130 const sk_sp<Effect>& get() const { return fEffect; } | 130 const sk_sp<Effect>& get() const { return fEffect; } |
131 | 131 |
132 void set(sk_sp<Effect> value) { | 132 void set(sk_sp<Effect> value) { |
133 fEffect = std::move(value); | 133 fEffect = std::move(value); |
(...skipping 28 matching lines...) Expand all Loading... |
162 | 162 |
163 Paint paint2; | 163 Paint paint2; |
164 paint2.set(paint.get()); | 164 paint2.set(paint.get()); |
165 check(reporter, 2, 1, 2, 1); | 165 check(reporter, 2, 1, 2, 1); |
166 REPORTER_ASSERT(reporter, paint.fEffect.get()->fRefCnt == 3); | 166 REPORTER_ASSERT(reporter, paint.fEffect.get()->fRefCnt == 3); |
167 | 167 |
168 delete paint.get()->method(); | 168 delete paint.get()->method(); |
169 check(reporter, 2, 1, 2, 1); | 169 check(reporter, 2, 1, 2, 1); |
170 } | 170 } |
171 | 171 |
OLD | NEW |