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

Unified Diff: tests/UtilsTest.cpp

Issue 393913002: Remove SkRefPtr. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix parameter. Created 6 years, 5 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 | « src/ports/SkFontConfigInterface_android.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/UtilsTest.cpp
diff --git a/tests/UtilsTest.cpp b/tests/UtilsTest.cpp
index 438a5cce4734f916250f25173cff451c888c7608..2c84c958ecef28aa0cef43a03a47489d93801fcb 100644
--- a/tests/UtilsTest.cpp
+++ b/tests/UtilsTest.cpp
@@ -53,14 +53,14 @@ static void test_autostarray(skiatest::Reporter* reporter) {
REPORTER_ASSERT(reporter, 1 == obj1.getRefCnt());
{
- SkAutoSTArray<2, SkRefPtr<RefClass> > tmp;
+ SkAutoSTArray<2, SkAutoTUnref<RefClass> > tmp;
REPORTER_ASSERT(reporter, 0 == tmp.count());
tmp.reset(0); // test out reset(0) when already at 0
tmp.reset(4); // this should force a new allocation
REPORTER_ASSERT(reporter, 4 == tmp.count());
- tmp[0] = &obj0;
- tmp[1] = &obj1;
+ tmp[0].reset(SkRef(&obj0));
+ tmp[1].reset(SkRef(&obj1));
REPORTER_ASSERT(reporter, 2 == obj0.getRefCnt());
REPORTER_ASSERT(reporter, 2 == obj1.getRefCnt());
@@ -72,8 +72,8 @@ static void test_autostarray(skiatest::Reporter* reporter) {
tmp.reset(2); // this should use the preexisting allocation
REPORTER_ASSERT(reporter, 2 == tmp.count());
- tmp[0] = &obj0;
- tmp[1] = &obj1;
+ tmp[0].reset(SkRef(&obj0));
+ tmp[1].reset(SkRef(&obj1));
}
// test out destructor with data in the array (and using existing allocation)
@@ -82,11 +82,11 @@ static void test_autostarray(skiatest::Reporter* reporter) {
{
// test out allocating ctor (this should allocate new memory)
- SkAutoSTArray<2, SkRefPtr<RefClass> > tmp(4);
+ SkAutoSTArray<2, SkAutoTUnref<RefClass> > tmp(4);
REPORTER_ASSERT(reporter, 4 == tmp.count());
- tmp[0] = &obj0;
- tmp[1] = &obj1;
+ tmp[0].reset(SkRef(&obj0));
+ tmp[1].reset(SkRef(&obj1));
REPORTER_ASSERT(reporter, 2 == obj0.getRefCnt());
REPORTER_ASSERT(reporter, 2 == obj1.getRefCnt());
@@ -96,8 +96,8 @@ static void test_autostarray(skiatest::Reporter* reporter) {
REPORTER_ASSERT(reporter, 1 == obj1.getRefCnt());
tmp.reset(2); // this should use the preexisting storage
- tmp[0] = &obj0;
- tmp[1] = &obj1;
+ tmp[0].reset(SkRef(&obj0));
+ tmp[1].reset(SkRef(&obj1));
REPORTER_ASSERT(reporter, 2 == obj0.getRefCnt());
REPORTER_ASSERT(reporter, 2 == obj1.getRefCnt());
@@ -105,8 +105,8 @@ static void test_autostarray(skiatest::Reporter* reporter) {
REPORTER_ASSERT(reporter, 1 == obj0.getRefCnt());
REPORTER_ASSERT(reporter, 1 == obj1.getRefCnt());
- tmp[0] = &obj0;
- tmp[1] = &obj1;
+ tmp[0].reset(SkRef(&obj0));
+ tmp[1].reset(SkRef(&obj1));
REPORTER_ASSERT(reporter, 2 == obj0.getRefCnt());
REPORTER_ASSERT(reporter, 2 == obj1.getRefCnt());
}
« no previous file with comments | « src/ports/SkFontConfigInterface_android.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698