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

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

Issue 2796103002: WIP: Adjust externally allocated memory when ImageBitmap is transferred (Closed)
Patch Set: Created 3 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/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 c3cd961a5b12b29186bb1a6b3c37db276e19f1b6..4727f706183a62051ac1f588ea95c339bc88092d 100644
--- a/third_party/WebKit/Source/core/frame/ImageBitmap.cpp
+++ b/third_party/WebKit/Source/core/frame/ImageBitmap.cpp
@@ -981,7 +981,10 @@ PassRefPtr<StaticBitmapImage> ImageBitmap::transfer() {
return std::move(m_image);
}
-ImageBitmap::~ImageBitmap() {}
+ImageBitmap::~ImageBitmap() {
+ if (m_image)
+ m_image->unregisterExternalAllocationWithCurrentContext();
jbroman 2017/04/04 15:44:56 Is this balanced by a corresponding increase somew
Justin Novosad 2017/04/04 16:15:15 I think It would be cleaner to take care of regist
+}
ImageBitmap* ImageBitmap::create(HTMLImageElement* image,
Optional<IntRect> cropRect,
@@ -1043,6 +1046,8 @@ ImageBitmap* ImageBitmap::create(const void* pixelData,
void ImageBitmap::close() {
if (!m_image || m_isNeutered)
return;
+ if (m_image)
+ m_image->unregisterExternalAllocationWithCurrentContext();
m_image.clear();
m_isNeutered = true;
}

Powered by Google App Engine
This is Rietveld 408576698