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

Side by Side Diff: tests/RefCntTest.cpp

Issue 1771583002: sk_sp: fix contravariant constructors (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 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 | « include/core/SkRefCnt.h ('k') | no next file » | 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 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
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 }
OLDNEW
« no previous file with comments | « include/core/SkRefCnt.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698