diff options
author | mtklein <mtklein@chromium.org> | 2016-03-16 13:53:35 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-03-16 13:53:35 -0700 |
commit | 18300a3aa7cb6eb55d21bb0450dffa58b6fc062c (patch) | |
tree | d1c0f54567937ed7dd44fb17842c6c1b544815d0 /tests | |
parent | 830dfd87a7707f687e13da5be645e75c746a2cf5 (diff) |
detach -> release
The C++ standard library uses the name "release" for the operation we call "detach".
Rewriting each "detach(" to "release(" brings us a step closer to using standard library types directly (e.g. std::unique_ptr instead of SkAutoTDelete).
This was a fairly blind transformation. There may have been unintentional conversions in here, but it's probably for the best to have everything uniformly say "release".
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1809733002
Review URL: https://codereview.chromium.org/1809733002
Diffstat (limited to 'tests')
-rw-r--r-- | tests/BadIcoTest.cpp | 2 | ||||
-rw-r--r-- | tests/CachedDecodingPixelRefTest.cpp | 2 | ||||
-rw-r--r-- | tests/CodexTest.cpp | 16 | ||||
-rw-r--r-- | tests/ColorSpaceTest.cpp | 2 | ||||
-rw-r--r-- | tests/FontHostStreamTest.cpp | 2 | ||||
-rw-r--r-- | tests/FrontBufferedStreamTest.cpp | 2 | ||||
-rw-r--r-- | tests/GifTest.cpp | 2 | ||||
-rw-r--r-- | tests/SerializationTest.cpp | 2 | ||||
-rw-r--r-- | tests/UtilsTest.cpp | 4 | ||||
-rw-r--r-- | tests/YUVTest.cpp | 2 |
10 files changed, 18 insertions, 18 deletions
diff --git a/tests/BadIcoTest.cpp b/tests/BadIcoTest.cpp index c387e157be..5c01490f9b 100644 --- a/tests/BadIcoTest.cpp +++ b/tests/BadIcoTest.cpp @@ -31,7 +31,7 @@ DEF_TEST(BadImage, reporter) { for (size_t i = 0; i < SK_ARRAY_COUNT(badImages); ++i) { SkString fullPath = SkOSPath::Join(resourcePath.c_str(), badImages[i]); SkAutoTDelete<SkStream> stream(SkStream::NewFromFile(fullPath.c_str())); - SkAutoTDelete<SkCodec> codec(SkCodec::NewFromStream(stream.detach())); + SkAutoTDelete<SkCodec> codec(SkCodec::NewFromStream(stream.release())); // These images are corrupt. It's not important whether we succeed/fail in codec // creation or decoding. We just want to make sure that we don't crash. diff --git a/tests/CachedDecodingPixelRefTest.cpp b/tests/CachedDecodingPixelRefTest.cpp index a0d71bbd70..fe6b412cd1 100644 --- a/tests/CachedDecodingPixelRefTest.cpp +++ b/tests/CachedDecodingPixelRefTest.cpp @@ -255,7 +255,7 @@ static void check_pixelref(TestImageGenerator::TestType type, SkAutoTDelete<SkImageGenerator> gen(new TestImageGenerator(type, reporter, colorType)); REPORTER_ASSERT(reporter, gen.get() != nullptr); SkBitmap lazy; - bool success = SkDEPRECATED_InstallDiscardablePixelRef(gen.detach(), nullptr, &lazy, factory); + bool success = SkDEPRECATED_InstallDiscardablePixelRef(gen.release(), nullptr, &lazy, factory); REPORTER_ASSERT(reporter, success); if (TestImageGenerator::kSucceedGetPixels_TestType == type) { diff --git a/tests/CodexTest.cpp b/tests/CodexTest.cpp index 907fd7db9b..be25dc35b5 100644 --- a/tests/CodexTest.cpp +++ b/tests/CodexTest.cpp @@ -171,7 +171,7 @@ static void check(skiatest::Reporter* r, SkAutoTUnref<SkData> data((SkData::NewFromStream(stream, 2 * size / 3))); codec.reset(SkCodec::NewFromData(data)); } else { - codec.reset(SkCodec::NewFromStream(stream.detach())); + codec.reset(SkCodec::NewFromStream(stream.release())); } if (!codec) { ERRORF(r, "Unable to decode '%s'", path); @@ -300,7 +300,7 @@ static void check(skiatest::Reporter* r, SkAutoTUnref<SkData> data((SkData::NewFromStream(stream, 2 * size / 3))); androidCodec.reset(SkAndroidCodec::NewFromData(data)); } else { - androidCodec.reset(SkAndroidCodec::NewFromStream(stream.detach())); + androidCodec.reset(SkAndroidCodec::NewFromStream(stream.release())); } if (!androidCodec) { ERRORF(r, "Unable to decode '%s'", path); @@ -412,7 +412,7 @@ DEF_TEST(Codec_stripes, r) { SkDebugf("Missing resource '%s'\n", path); } - SkAutoTDelete<SkCodec> codec(SkCodec::NewFromStream(stream.detach())); + SkAutoTDelete<SkCodec> codec(SkCodec::NewFromStream(stream.release())); REPORTER_ASSERT(r, codec); if (!codec) { @@ -545,7 +545,7 @@ static void test_dimensions(skiatest::Reporter* r, const char path[]) { SkDebugf("Missing resource '%s'\n", path); return; } - SkAutoTDelete<SkAndroidCodec> codec(SkAndroidCodec::NewFromStream(stream.detach())); + SkAutoTDelete<SkAndroidCodec> codec(SkAndroidCodec::NewFromStream(stream.release())); if (!codec) { ERRORF(r, "Unable to create codec '%s'", path); return; @@ -610,7 +610,7 @@ static void test_invalid(skiatest::Reporter* r, const char path[]) { SkDebugf("Missing resource '%s'\n", path); return; } - SkAutoTDelete<SkCodec> codec(SkCodec::NewFromStream(stream.detach())); + SkAutoTDelete<SkCodec> codec(SkCodec::NewFromStream(stream.release())); REPORTER_ASSERT(r, nullptr == codec); } @@ -636,7 +636,7 @@ static void test_invalid_parameters(skiatest::Reporter* r, const char path[]) { SkDebugf("Missing resource '%s'\n", path); return; } - SkAutoTDelete<SkCodec> decoder(SkCodec::NewFromStream(stream.detach())); + SkAutoTDelete<SkCodec> decoder(SkCodec::NewFromStream(stream.release())); // This should return kSuccess because kIndex8 is supported. SkPMColor colorStorage[256]; @@ -954,7 +954,7 @@ DEF_TEST(Codec_wbmp_max_size, r) { 0x83, 0xFF, 0x7F, // W: 65535 0x83, 0xFF, 0x7F }; // H: 65535 SkAutoTDelete<SkStream> stream(new SkMemoryStream(maxSizeWbmp, sizeof(maxSizeWbmp), false)); - SkAutoTDelete<SkCodec> codec(SkCodec::NewFromStream(stream.detach())); + SkAutoTDelete<SkCodec> codec(SkCodec::NewFromStream(stream.release())); REPORTER_ASSERT(r, codec); if (!codec) return; @@ -968,7 +968,7 @@ DEF_TEST(Codec_wbmp_max_size, r) { 0x84, 0x80, 0x00, // W: 65536 0x84, 0x80, 0x00 }; // H: 65536 stream.reset(new SkMemoryStream(tooBigWbmp, sizeof(tooBigWbmp), false)); - codec.reset(SkCodec::NewFromStream(stream.detach())); + codec.reset(SkCodec::NewFromStream(stream.release())); REPORTER_ASSERT(r, !codec); } diff --git a/tests/ColorSpaceTest.cpp b/tests/ColorSpaceTest.cpp index 555f41ec6a..3361aa3420 100644 --- a/tests/ColorSpaceTest.cpp +++ b/tests/ColorSpaceTest.cpp @@ -27,7 +27,7 @@ DEF_TEST(ColorSpaceParseICCProfile, r) { SkAutoTDelete<SkStream> stream(resource("color_wheel_with_profile.png")); REPORTER_ASSERT(r, nullptr != stream); - SkAutoTDelete<SkCodec> codec(SkCodec::NewFromStream(stream.detach())); + SkAutoTDelete<SkCodec> codec(SkCodec::NewFromStream(stream.release())); REPORTER_ASSERT(r, nullptr != codec); #if (PNG_LIBPNG_VER_MAJOR > 1) || (PNG_LIBPNG_VER_MAJOR == 1 && PNG_LIBPNG_VER_MINOR >= 6) diff --git a/tests/FontHostStreamTest.cpp b/tests/FontHostStreamTest.cpp index f4cc5bf3a9..0b436552a3 100644 --- a/tests/FontHostStreamTest.cpp +++ b/tests/FontHostStreamTest.cpp @@ -98,7 +98,7 @@ DEF_TEST(FontHostStream, reporter) { int ttcIndex; SkAutoTDelete<SkStreamAsset> fontData(origTypeface->openStream(&ttcIndex)); - SkTypeface* streamTypeface = SkTypeface::CreateFromStream(fontData.detach()); + SkTypeface* streamTypeface = SkTypeface::CreateFromStream(fontData.release()); SkFontDescriptor desc; bool isLocalStream = false; diff --git a/tests/FrontBufferedStreamTest.cpp b/tests/FrontBufferedStreamTest.cpp index d2bb43ab3c..445f0bf4c9 100644 --- a/tests/FrontBufferedStreamTest.cpp +++ b/tests/FrontBufferedStreamTest.cpp @@ -285,5 +285,5 @@ DEF_TEST(ShortFrontBufferedStream, reporter) { // This will fail to create a codec. However, what we really want to test is that we // won't read past the end of the stream. - SkAutoTDelete<SkCodec> codec(SkCodec::NewFromStream(stream.detach())); + SkAutoTDelete<SkCodec> codec(SkCodec::NewFromStream(stream.release())); } diff --git a/tests/GifTest.cpp b/tests/GifTest.cpp index caa0f6ffc9..7f02cc1c6a 100644 --- a/tests/GifTest.cpp +++ b/tests/GifTest.cpp @@ -198,7 +198,7 @@ DEF_TEST(Gif_Sampled, r) { return; } - SkAutoTDelete<SkAndroidCodec> codec(SkAndroidCodec::NewFromStream(stream.detach())); + SkAutoTDelete<SkAndroidCodec> codec(SkAndroidCodec::NewFromStream(stream.release())); REPORTER_ASSERT(r, codec); if (!codec) { return; diff --git a/tests/SerializationTest.cpp b/tests/SerializationTest.cpp index eb84b3c957..d6a88cf465 100644 --- a/tests/SerializationTest.cpp +++ b/tests/SerializationTest.cpp @@ -372,7 +372,7 @@ static void TestPictureTypefaceSerialization(skiatest::Reporter* reporter) { } else { SkFixed axis = SK_FixedSqrt2; SkAutoTUnref<SkTypeface> typeface(SkTypeface::CreateFromFontData( - new SkFontData(distortable.detach(), 0, &axis, 1))); + new SkFontData(distortable.release(), 0, &axis, 1))); if (!typeface) { INFOF(reporter, "Could not run fontstream test because Distortable.ttf not created."); } else { diff --git a/tests/UtilsTest.cpp b/tests/UtilsTest.cpp index 4dad52b50c..c431abc5c3 100644 --- a/tests/UtilsTest.cpp +++ b/tests/UtilsTest.cpp @@ -33,9 +33,9 @@ static void test_autounref(skiatest::Reporter* reporter) { REPORTER_ASSERT(reporter, &obj == tmp.get()); REPORTER_ASSERT(reporter, obj.unique()); - REPORTER_ASSERT(reporter, &obj == tmp.detach()); + REPORTER_ASSERT(reporter, &obj == tmp.release()); REPORTER_ASSERT(reporter, obj.unique()); - REPORTER_ASSERT(reporter, nullptr == tmp.detach()); + REPORTER_ASSERT(reporter, nullptr == tmp.release()); REPORTER_ASSERT(reporter, nullptr == tmp.get()); obj.ref(); diff --git a/tests/YUVTest.cpp b/tests/YUVTest.cpp index e1d8961205..f7b3306b98 100644 --- a/tests/YUVTest.cpp +++ b/tests/YUVTest.cpp @@ -25,7 +25,7 @@ static void codec_yuv(skiatest::Reporter* reporter, INFOF(reporter, "Missing resource '%s'\n", path); return; } - SkAutoTDelete<SkCodec> codec(SkCodec::NewFromStream(stream.detach())); + SkAutoTDelete<SkCodec> codec(SkCodec::NewFromStream(stream.release())); REPORTER_ASSERT(reporter, codec); if (!codec) { return; |