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

Unified Diff: third_party/WebKit/Source/platform/graphics/ImageFrameGenerator.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/graphics/ImageFrameGenerator.cpp
diff --git a/third_party/WebKit/Source/platform/graphics/ImageFrameGenerator.cpp b/third_party/WebKit/Source/platform/graphics/ImageFrameGenerator.cpp
index faf1444149966d4a3ee2162dcf4274f1cad25473..cebc233f45f5b01518cb3024353dc6b7cfe270b2 100644
--- a/third_party/WebKit/Source/platform/graphics/ImageFrameGenerator.cpp
+++ b/third_party/WebKit/Source/platform/graphics/ImageFrameGenerator.cpp
@@ -30,6 +30,8 @@
#include "platform/graphics/ImageDecodingStore.h"
#include "platform/image-decoders/ImageDecoder.h"
#include "third_party/skia/include/core/SkYUVSizeInfo.h"
+#include "wtf/PtrUtil.h"
+#include <memory>
namespace blink {
@@ -158,13 +160,13 @@ bool ImageFrameGenerator::decodeToYUV(SegmentReader* data, size_t index, const S
return false;
}
- OwnPtr<ImageDecoder> decoder = ImageDecoder::create(*data, ImageDecoder::AlphaPremultiplied, ImageDecoder::GammaAndColorProfileApplied);
+ std::unique_ptr<ImageDecoder> decoder = ImageDecoder::create(*data, ImageDecoder::AlphaPremultiplied, ImageDecoder::GammaAndColorProfileApplied);
// getYUVComponentSizes was already called and was successful, so ImageDecoder::create must succeed.
ASSERT(decoder);
decoder->setData(data, true);
- OwnPtr<ImagePlanes> imagePlanes = adoptPtr(new ImagePlanes(planes, rowBytes));
+ std::unique_ptr<ImagePlanes> imagePlanes = wrapUnique(new ImagePlanes(planes, rowBytes));
decoder->setImagePlanes(std::move(imagePlanes));
ASSERT(decoder->canDecodeToYUV());
@@ -199,9 +201,9 @@ SkBitmap ImageFrameGenerator::tryToResumeDecode(SegmentReader* data, bool allDat
// If we are not resuming decoding that means the decoder is freshly
// created and we have ownership. If we are resuming decoding then
// the decoder is owned by ImageDecodingStore.
- OwnPtr<ImageDecoder> decoderContainer;
+ std::unique_ptr<ImageDecoder> decoderContainer;
if (!resumeDecoding)
- decoderContainer = adoptPtr(decoder);
+ decoderContainer = wrapUnique(decoder);
if (fullSizeImage.isNull()) {
// If decoding has failed, we can save work in the future by
@@ -262,10 +264,10 @@ bool ImageFrameGenerator::decode(SegmentReader* data, bool allDataReceived, size
if (!*decoder) {
newDecoder = true;
if (m_imageDecoderFactory)
- *decoder = m_imageDecoderFactory->create().leakPtr();
+ *decoder = m_imageDecoderFactory->create().release();
if (!*decoder)
- *decoder = ImageDecoder::create(*data, ImageDecoder::AlphaPremultiplied, ImageDecoder::GammaAndColorProfileApplied).leakPtr();
+ *decoder = ImageDecoder::create(*data, ImageDecoder::AlphaPremultiplied, ImageDecoder::GammaAndColorProfileApplied).release();
if (!*decoder)
return false;
@@ -325,13 +327,13 @@ bool ImageFrameGenerator::getYUVComponentSizes(SegmentReader* data, SkYUVSizeInf
if (m_yuvDecodingFailed)
return false;
- OwnPtr<ImageDecoder> decoder = ImageDecoder::create(*data, ImageDecoder::AlphaPremultiplied, ImageDecoder::GammaAndColorProfileApplied);
+ std::unique_ptr<ImageDecoder> decoder = ImageDecoder::create(*data, ImageDecoder::AlphaPremultiplied, ImageDecoder::GammaAndColorProfileApplied);
if (!decoder)
return false;
// Setting a dummy ImagePlanes object signals to the decoder that we want to do YUV decoding.
decoder->setData(data, true);
- OwnPtr<ImagePlanes> dummyImagePlanes = adoptPtr(new ImagePlanes);
+ std::unique_ptr<ImagePlanes> dummyImagePlanes = wrapUnique(new ImagePlanes);
decoder->setImagePlanes(std::move(dummyImagePlanes));
return updateYUVComponentSizes(decoder.get(), sizeInfo->fSizes, sizeInfo->fWidthBytes);

Powered by Google App Engine
This is Rietveld 408576698