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

Unified Diff: tests/RefCntTest.cpp

Issue 1773943004: Add sk_ref_sp helper function. (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/core/SkRefCnt.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/RefCntTest.cpp
diff --git a/tests/RefCntTest.cpp b/tests/RefCntTest.cpp
index 2932913c3da418ac60d5f5aa5ffddcd90bf2de2d..a9b461f352584b66b17421da3e40ec4be446dc78 100644
--- a/tests/RefCntTest.cpp
+++ b/tests/RefCntTest.cpp
@@ -385,3 +385,16 @@ DEF_TEST(sk_sp_reset, r) {
sp.reset(rc); // this should transfer our ownership over to sp
REPORTER_ASSERT(r, rc->unique());
}
+
+DEF_TEST(sk_sp_ref, r) {
+ SkRefCnt* rc = new SkRefCnt;
+ REPORTER_ASSERT(r, rc->unique());
+
+ {
+ sk_sp<SkRefCnt> sp = sk_ref_sp(rc);
+ REPORTER_ASSERT(r, !rc->unique());
+ }
+
+ REPORTER_ASSERT(r, rc->unique());
+ rc->unref();
+}
« 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