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

Unified Diff: third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.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/bindings/core/v8/SerializedScriptValue.cpp
diff --git a/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.cpp b/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.cpp
index 0049d6e66d02c98acfbcea0a046416fcee5317d9..600951c14abd411eab16e384ca04cacfe557bb91 100644
--- a/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.cpp
+++ b/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.cpp
@@ -447,6 +447,13 @@ void SerializedScriptValue::
buffer.unregisterExternalAllocationWithCurrentContext();
m_transferablesNeedExternalAllocationRegistration = true;
}
+
+ if (m_imageBitmapContentsArray &&
+ !m_transferablesNeedExternalAllocationRegistration) {
+ for (auto& buffer : *m_imageBitmapContentsArray)
+ buffer->unregisterExternalAllocationWithCurrentContext();
+ m_transferablesNeedExternalAllocationRegistration = true;
jbroman 2017/04/04 15:44:56 This would need to be fused with the one above. Ot
+ }
}
void SerializedScriptValue::registerMemoryAllocatedWithCurrentScriptContext() {
@@ -465,6 +472,12 @@ void SerializedScriptValue::registerMemoryAllocatedWithCurrentScriptContext() {
for (auto& buffer : *m_arrayBufferContentsArray)
buffer.registerExternalAllocationWithCurrentContext();
}
+
+ if (m_imageBitmapContentsArray &&
+ m_transferablesNeedExternalAllocationRegistration) {
+ for (auto& buffer : *m_imageBitmapContentsArray)
+ buffer->registerExternalAllocationWithCurrentContext();
+ }
}
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698