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

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

Issue 2080623002: Revert "Remove OwnPtr from Blink." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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/ImageDecoder.cpp
diff --git a/third_party/WebKit/Source/platform/image-decoders/ImageDecoder.cpp b/third_party/WebKit/Source/platform/image-decoders/ImageDecoder.cpp
index 8a09dec8ed2dd5db684c31b2455859b19195b656..6a88796935e60f1951be51faee22c0769e4a4cb5 100644
--- a/third_party/WebKit/Source/platform/image-decoders/ImageDecoder.cpp
+++ b/third_party/WebKit/Source/platform/image-decoders/ImageDecoder.cpp
@@ -27,8 +27,7 @@
#include "platform/image-decoders/jpeg/JPEGImageDecoder.h"
#include "platform/image-decoders/png/PNGImageDecoder.h"
#include "platform/image-decoders/webp/WEBPImageDecoder.h"
-#include "wtf/PtrUtil.h"
-#include <memory>
+#include "wtf/PassOwnPtr.h"
namespace blink {
@@ -80,7 +79,7 @@ inline bool matchesBMPSignature(const char* contents)
return !memcmp(contents, "BM", 2);
}
-std::unique_ptr<ImageDecoder> ImageDecoder::create(const char* contents, size_t length, AlphaOption alphaOption, GammaAndColorProfileOption colorOptions)
+PassOwnPtr<ImageDecoder> ImageDecoder::create(const char* contents, size_t length, AlphaOption alphaOption, GammaAndColorProfileOption colorOptions)
{
const size_t longestSignatureLength = sizeof("RIFF????WEBPVP") - 1;
ASSERT(longestSignatureLength == 14);
@@ -91,34 +90,34 @@ std::unique_ptr<ImageDecoder> ImageDecoder::create(const char* contents, size_t
size_t maxDecodedBytes = Platform::current() ? Platform::current()->maxDecodedImageBytes() : noDecodedImageByteLimit;
if (matchesJPEGSignature(contents))
- return wrapUnique(new JPEGImageDecoder(alphaOption, colorOptions, maxDecodedBytes));
+ return adoptPtr(new JPEGImageDecoder(alphaOption, colorOptions, maxDecodedBytes));
if (matchesPNGSignature(contents))
- return wrapUnique(new PNGImageDecoder(alphaOption, colorOptions, maxDecodedBytes));
+ return adoptPtr(new PNGImageDecoder(alphaOption, colorOptions, maxDecodedBytes));
if (matchesGIFSignature(contents))
- return wrapUnique(new GIFImageDecoder(alphaOption, colorOptions, maxDecodedBytes));
+ return adoptPtr(new GIFImageDecoder(alphaOption, colorOptions, maxDecodedBytes));
if (matchesWebPSignature(contents))
- return wrapUnique(new WEBPImageDecoder(alphaOption, colorOptions, maxDecodedBytes));
+ return adoptPtr(new WEBPImageDecoder(alphaOption, colorOptions, maxDecodedBytes));
if (matchesICOSignature(contents) || matchesCURSignature(contents))
- return wrapUnique(new ICOImageDecoder(alphaOption, colorOptions, maxDecodedBytes));
+ return adoptPtr(new ICOImageDecoder(alphaOption, colorOptions, maxDecodedBytes));
if (matchesBMPSignature(contents))
- return wrapUnique(new BMPImageDecoder(alphaOption, colorOptions, maxDecodedBytes));
+ return adoptPtr(new BMPImageDecoder(alphaOption, colorOptions, maxDecodedBytes));
return nullptr;
}
-std::unique_ptr<ImageDecoder> ImageDecoder::create(const SharedBuffer& data, AlphaOption alphaOption, GammaAndColorProfileOption colorOptions)
+PassOwnPtr<ImageDecoder> ImageDecoder::create(const SharedBuffer& data, AlphaOption alphaOption, GammaAndColorProfileOption colorOptions)
{
const char* contents;
const size_t length = data.getSomeData<size_t>(contents);
return create(contents, length, alphaOption, colorOptions);
}
-std::unique_ptr<ImageDecoder> ImageDecoder::create(const SegmentReader& data, AlphaOption alphaOption, GammaAndColorProfileOption colorOptions)
+PassOwnPtr<ImageDecoder> ImageDecoder::create(const SegmentReader& data, AlphaOption alphaOption, GammaAndColorProfileOption colorOptions)
{
const char* contents;
const size_t length = data.getSomeData(contents, 0);

Powered by Google App Engine
This is Rietveld 408576698