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

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

Issue 2719883004: Adds support for ArrayBufferContents with external buffer. (Closed)
Patch Set: renames ScopedData -> DataHandle Created 3 years, 10 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/ImageBuffer.cpp
diff --git a/third_party/WebKit/Source/platform/graphics/ImageBuffer.cpp b/third_party/WebKit/Source/platform/graphics/ImageBuffer.cpp
index 2e38b192ed37b338fecca618ef940f34a33e00fa..99ca5209e4bbbe0a7d81c64943e4479e2843133b 100644
--- a/third_party/WebKit/Source/platform/graphics/ImageBuffer.cpp
+++ b/third_party/WebKit/Source/platform/graphics/ImageBuffer.cpp
@@ -346,12 +346,11 @@ bool ImageBuffer::getImageData(Multiply multiplied,
if (!isSurfaceValid()) {
size_t allocSizeInBytes = rect.width() * rect.height() * bytesPerPixel;
- void* data;
- WTF::ArrayBufferContents::allocateMemoryOrNull(
- allocSizeInBytes, WTF::ArrayBufferContents::ZeroInitialize, data);
+ auto data = WTF::ArrayBufferContents::createDataHandle(
+ allocSizeInBytes, WTF::ArrayBufferContents::ZeroInitialize);
if (!data)
return false;
- WTF::ArrayBufferContents result(data, allocSizeInBytes,
+ WTF::ArrayBufferContents result(std::move(data), allocSizeInBytes,
WTF::ArrayBufferContents::NotShared);
result.transfer(contents);
return true;
@@ -375,15 +374,14 @@ bool ImageBuffer::getImageData(Multiply multiplied,
rect.maxX() > m_surface->size().width() ||
rect.maxY() > m_surface->size().height();
size_t allocSizeInBytes = rect.width() * rect.height() * bytesPerPixel;
- void* data;
WTF::ArrayBufferContents::InitializationPolicy initializationPolicy =
mayHaveStrayArea ? WTF::ArrayBufferContents::ZeroInitialize
: WTF::ArrayBufferContents::DontInitialize;
- WTF::ArrayBufferContents::allocateMemoryOrNull(allocSizeInBytes,
- initializationPolicy, data);
+ auto data = WTF::ArrayBufferContents::createDataHandle(allocSizeInBytes,
+ initializationPolicy);
if (!data)
return false;
- WTF::ArrayBufferContents result(data, allocSizeInBytes,
+ WTF::ArrayBufferContents result(std::move(data), allocSizeInBytes,
WTF::ArrayBufferContents::NotShared);
// Skia does not support unpremultiplied read with an F16 to 8888 conversion

Powered by Google App Engine
This is Rietveld 408576698