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

Unified Diff: third_party/WebKit/Source/core/frame/ImageBitmap.cpp

Issue 2064273003: Fix a SkImage leak in ImageBitmap:cropImage() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: use a RefPtr 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/frame/ImageBitmap.cpp
diff --git a/third_party/WebKit/Source/core/frame/ImageBitmap.cpp b/third_party/WebKit/Source/core/frame/ImageBitmap.cpp
index 19d831308e299cff8b57d5825a9bd4400b1ecd03..a982f2fd39a22a73f5fe5dc6cbe998b10ef7ed2c 100644
--- a/third_party/WebKit/Source/core/frame/ImageBitmap.cpp
+++ b/third_party/WebKit/Source/core/frame/ImageBitmap.cpp
@@ -147,13 +147,13 @@ static PassRefPtr<StaticBitmapImage> cropImage(Image* image, const IntRect& crop
if (cropRect == srcRect) {
if (flipY)
return StaticBitmapImage::create(flipSkImageVertically(skiaImage->newSubset(srcRect), premultiplyAlpha ? PremultiplyAlpha : DontPremultiplyAlpha));
- SkImage* croppedSkImage = skiaImage->newSubset(srcRect);
+ RefPtr<SkImage> croppedSkImage = fromSkSp(skiaImage->makeSubset(srcRect));
// Special case: The first parameter image is unpremul but we need to turn it into premul.
if (premultiplyAlpha && imageFormat == DontPremultiplyAlpha)
- return StaticBitmapImage::create(unPremulSkImageToPremul(croppedSkImage));
+ return StaticBitmapImage::create(unPremulSkImageToPremul(croppedSkImage.get()));
// Call preroll to trigger image decoding.
croppedSkImage->preroll();
f(malita) 2016/06/15 08:41:54 Unrelated to this CL: I think I understand why we
xidachen 2016/06/15 08:56:11 The problem is that ImageBitmapLoader is not alway
xidachen 2016/06/15 08:57:29 sorry, I meant is there a way to check whether the
- return StaticBitmapImage::create(adoptRef(croppedSkImage));
+ return StaticBitmapImage::create(croppedSkImage.release());
}
sk_sp<SkSurface> surface = SkSurface::MakeRasterN32Premul(cropRect.width(), cropRect.height());
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698