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

Unified Diff: third_party/WebKit/Source/platform/graphics/ImageFrameGenerator.cpp

Issue 1880993003: Use RefPtr for SkBitmap::Allocator in ImageDecoder (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@sharedBufferInterface6
Patch Set: Rebase to ToT Created 4 years, 8 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 cd29a647aa62f825ed433ad82dbce547dd99c979..58a4ca20dfb517a3b2e3982791271db5bf8caf5f 100644
--- a/third_party/WebKit/Source/platform/graphics/ImageFrameGenerator.cpp
+++ b/third_party/WebKit/Source/platform/graphics/ImageFrameGenerator.cpp
@@ -127,9 +127,7 @@ bool ImageFrameGenerator::decodeAndScale(SegmentReader* data, bool allDataReceiv
SkISize scaledSize = SkISize::Make(info.width(), info.height());
ASSERT(m_fullSize == scaledSize);
- // TODO (scroggo): Convert tryToResumeDecode() and decode() to take a
- // PassRefPtr<SkBitmap::Allocator> instead of a bare pointer.
- SkBitmap bitmap = tryToResumeDecode(data, allDataReceived, index, scaledSize, externalAllocator.get());
+ SkBitmap bitmap = tryToResumeDecode(data, allDataReceived, index, scaledSize, externalAllocator.release());
if (bitmap.isNull())
return false;
@@ -178,7 +176,7 @@ bool ImageFrameGenerator::decodeToYUV(SegmentReader* data, size_t index, const S
return false;
}
-SkBitmap ImageFrameGenerator::tryToResumeDecode(SegmentReader* data, bool allDataReceived, size_t index, const SkISize& scaledSize, SkBitmap::Allocator* allocator)
+SkBitmap ImageFrameGenerator::tryToResumeDecode(SegmentReader* data, bool allDataReceived, size_t index, const SkISize& scaledSize, PassRefPtr<SkBitmap::Allocator> allocator)
{
TRACE_EVENT1("blink", "ImageFrameGenerator::tryToResumeDecode", "frame index", static_cast<int>(index));
@@ -250,7 +248,7 @@ void ImageFrameGenerator::setHasAlpha(size_t index, bool hasAlpha)
m_hasAlpha[index] = hasAlpha;
}
-bool ImageFrameGenerator::decode(SegmentReader* data, bool allDataReceived, size_t index, ImageDecoder** decoder, SkBitmap* bitmap, SkBitmap::Allocator* allocator)
+bool ImageFrameGenerator::decode(SegmentReader* data, bool allDataReceived, size_t index, ImageDecoder** decoder, SkBitmap* bitmap, PassRefPtr<SkBitmap::Allocator> allocator)
{
ASSERT(m_decodeMutex.locked());
TRACE_EVENT2("blink", "ImageFrameGenerator::decode", "width", m_fullSize.width(), "height", m_fullSize.height());
@@ -289,7 +287,7 @@ bool ImageFrameGenerator::decode(SegmentReader* data, bool allDataReceived, size
(*decoder)->setData(PassRefPtr<SegmentReader>(nullptr), false); // Unref SegmentReader from ImageDecoder.
(*decoder)->clearCacheExceptFrame(index);
- (*decoder)->setMemoryAllocator(0);
+ (*decoder)->setMemoryAllocator(nullptr);
if (!frame || frame->getStatus() == ImageFrame::FrameEmpty)
return false;

Powered by Google App Engine
This is Rietveld 408576698