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

Unified Diff: third_party/WebKit/Source/platform/image-decoders/jpeg/JPEGImageDecoderTest.cpp

Issue 2050123002: Remove OwnPtr from Blink. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: First attempt to land. Created 4 years, 6 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
Index: third_party/WebKit/Source/platform/image-decoders/jpeg/JPEGImageDecoderTest.cpp
diff --git a/third_party/WebKit/Source/platform/image-decoders/jpeg/JPEGImageDecoderTest.cpp b/third_party/WebKit/Source/platform/image-decoders/jpeg/JPEGImageDecoderTest.cpp
index 4de383f72f2bde3bb713fc54b07ba97d30421b69..6295e54a5ffc2f5807ed765f31a1eba4f5fb118c 100644
--- a/third_party/WebKit/Source/platform/image-decoders/jpeg/JPEGImageDecoderTest.cpp
+++ b/third_party/WebKit/Source/platform/image-decoders/jpeg/JPEGImageDecoderTest.cpp
@@ -36,9 +36,9 @@
#include "public/platform/WebData.h"
#include "public/platform/WebSize.h"
#include "testing/gtest/include/gtest/gtest.h"
-#include "wtf/OwnPtr.h"
-#include "wtf/PassOwnPtr.h"
+#include "wtf/PtrUtil.h"
#include "wtf/typed_arrays/ArrayBuffer.h"
+#include <memory>
namespace blink {
@@ -46,12 +46,12 @@ static const size_t LargeEnoughSize = 1000 * 1000;
namespace {
-PassOwnPtr<ImageDecoder> createDecoder(size_t maxDecodedBytes)
+std::unique_ptr<ImageDecoder> createDecoder(size_t maxDecodedBytes)
{
- return adoptPtr(new JPEGImageDecoder(ImageDecoder::AlphaNotPremultiplied, ImageDecoder::GammaAndColorProfileApplied, maxDecodedBytes));
+ return wrapUnique(new JPEGImageDecoder(ImageDecoder::AlphaNotPremultiplied, ImageDecoder::GammaAndColorProfileApplied, maxDecodedBytes));
}
-PassOwnPtr<ImageDecoder> createDecoder()
+std::unique_ptr<ImageDecoder> createDecoder()
{
return createDecoder(ImageDecoder::noDecodedImageByteLimit);
}
@@ -63,7 +63,7 @@ void downsample(size_t maxDecodedBytes, unsigned* outputWidth, unsigned* outputH
RefPtr<SharedBuffer> data = readFile(imageFilePath);
ASSERT_TRUE(data);
- OwnPtr<ImageDecoder> decoder = createDecoder(maxDecodedBytes);
+ std::unique_ptr<ImageDecoder> decoder = createDecoder(maxDecodedBytes);
decoder->setData(data.get(), true);
ImageFrame* frame = decoder->frameBufferAtIndex(0);
@@ -78,11 +78,11 @@ void readYUV(size_t maxDecodedBytes, unsigned* outputYWidth, unsigned* outputYHe
RefPtr<SharedBuffer> data = readFile(imageFilePath);
ASSERT_TRUE(data);
- OwnPtr<ImageDecoder> decoder = createDecoder(maxDecodedBytes);
+ std::unique_ptr<ImageDecoder> decoder = createDecoder(maxDecodedBytes);
decoder->setData(data.get(), true);
// Setting a dummy ImagePlanes object signals to the decoder that we want to do YUV decoding.
- OwnPtr<ImagePlanes> dummyImagePlanes = adoptPtr(new ImagePlanes());
+ std::unique_ptr<ImagePlanes> dummyImagePlanes = wrapUnique(new ImagePlanes());
decoder->setImagePlanes(std::move(dummyImagePlanes));
bool sizeIsAvailable = decoder->isSizeAvailable();
@@ -114,7 +114,7 @@ void readYUV(size_t maxDecodedBytes, unsigned* outputYWidth, unsigned* outputYHe
planes[1] = ((char*) planes[0]) + rowBytes[0] * ySize.height();
planes[2] = ((char*) planes[1]) + rowBytes[1] * uSize.height();
- OwnPtr<ImagePlanes> imagePlanes = adoptPtr(new ImagePlanes(planes, rowBytes));
+ std::unique_ptr<ImagePlanes> imagePlanes = wrapUnique(new ImagePlanes(planes, rowBytes));
decoder->setImagePlanes(std::move(imagePlanes));
ASSERT_TRUE(decoder->decodeToYUV());
@@ -123,7 +123,7 @@ void readYUV(size_t maxDecodedBytes, unsigned* outputYWidth, unsigned* outputYHe
// Tests failure on a too big image.
TEST(JPEGImageDecoderTest, tooBig)
{
- OwnPtr<ImageDecoder> decoder = createDecoder(100);
+ std::unique_ptr<ImageDecoder> decoder = createDecoder(100);
EXPECT_FALSE(decoder->setSize(10000, 10000));
EXPECT_TRUE(decoder->failed());
}
@@ -247,10 +247,10 @@ TEST(JPEGImageDecoderTest, yuv)
RefPtr<SharedBuffer> data = readFile(jpegFile);
ASSERT_TRUE(data);
- OwnPtr<ImageDecoder> decoder = createDecoder(230 * 230 * 4);
+ std::unique_ptr<ImageDecoder> decoder = createDecoder(230 * 230 * 4);
decoder->setData(data.get(), true);
- OwnPtr<ImagePlanes> imagePlanes = adoptPtr(new ImagePlanes());
+ std::unique_ptr<ImagePlanes> imagePlanes = wrapUnique(new ImagePlanes());
decoder->setImagePlanes(std::move(imagePlanes));
ASSERT_TRUE(decoder->isSizeAvailable());
ASSERT_FALSE(decoder->canDecodeToYUV());

Powered by Google App Engine
This is Rietveld 408576698