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

Unified Diff: third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp

Issue 2249853008: Reject createImageBitmap promise when the cropRect or resize is too big (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: size_t + Uint8Array + null check (lots) Created 4 years, 4 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/modules/webgl/WebGLRenderingContextBase.cpp
diff --git a/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp b/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp
index a376b6c1e45025880a6e39a082736ecacc529a4a..b73c43bd4fc8c8106842ab2495df4c62ba6d534b 100644
--- a/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp
+++ b/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp
@@ -4529,7 +4529,6 @@ void WebGLRenderingContextBase::texImageHelperImageBitmap(TexImageFunctionID fun
}
RefPtr<SkImage> skImage = bitmap->bitmapImage()->imageForCurrentFrame();
SkPixmap pixmap;
- std::unique_ptr<uint8_t[]> pixelData;
uint8_t* pixelDataPtr = nullptr;
// In the case where an ImageBitmap is not texture backed, peekPixels() always succeed.
// However, when it is texture backed and !canUseTexImageByGPU, we do a GPU read back.
@@ -4537,8 +4536,7 @@ void WebGLRenderingContextBase::texImageHelperImageBitmap(TexImageFunctionID fun
if (peekSucceed) {
pixelDataPtr = static_cast<uint8_t*>(pixmap.writable_addr());
} else {
- pixelData = bitmap->copyBitmapData(bitmap->isPremultiplied() ? PremultiplyAlpha : DontPremultiplyAlpha);
- pixelDataPtr = pixelData.get();
+ pixelDataPtr = bitmap->copyBitmapData(bitmap->isPremultiplied() ? PremultiplyAlpha : DontPremultiplyAlpha).leakRef()->data();
}
Vector<uint8_t> data;
bool needConversion = true;

Powered by Google App Engine
This is Rietveld 408576698