| 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 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 baz = EffectImpl::Create(); | 267 baz = EffectImpl::Create(); |
| 268 check(reporter, 0, 0, 1, 0); | 268 check(reporter, 0, 0, 1, 0); |
| 269 paint.set(baz); | 269 paint.set(baz); |
| 270 check(reporter, 1, 0, 1, 0); | 270 check(reporter, 1, 0, 1, 0); |
| 271 baz = nullptr; | 271 baz = nullptr; |
| 272 check(reporter, 1, 1, 1, 0); | 272 check(reporter, 1, 1, 1, 0); |
| 273 paint.set(nullptr); | 273 paint.set(nullptr); |
| 274 check(reporter, 1, 2, 1, 1); | 274 check(reporter, 1, 2, 1, 1); |
| 275 } | 275 } |
| 276 | 276 |
| 277 namespace { |
| 278 struct FooAbstract : public SkRefCnt { |
| 279 virtual void f() = 0; |
| 280 }; |
| 281 struct FooConcrete : public FooAbstract { |
| 282 void f() override {} |
| 283 }; |
| 284 } |
| 285 static sk_sp<FooAbstract> make_foo() { |
| 286 // can not cast FooConcrete to FooAbstract. |
| 287 // can cast FooConcrete* to FooAbstract*. |
| 288 return sk_make_sp<FooConcrete>(); |
| 289 } |
| 290 DEF_TEST(sk_make_sp, r) { |
| 291 auto x = make_foo(); |
| 292 } |
| OLD | NEW |