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

Unified Diff: third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.h

Issue 2734173002: postMessage(): transfer allocation costs along with value. (Closed)
Patch Set: update comment Created 3 years, 9 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.h
diff --git a/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.h b/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.h
index ceb9d63e64389f54d7ef4cec4ed2bf23c86c38de..271ec9a9d72cf2dd0f7238a647fbf720fdb67e77 100644
--- a/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.h
+++ b/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.h
@@ -128,13 +128,21 @@ class CORE_EXPORT SerializedScriptValue
const ImageBitmapArray&,
ExceptionState&);
- // Informs the V8 about external memory allocated and owned by this object.
+ // Informs V8 about external memory allocated and owned by this object.
// Large values should contribute to GC counters to eventually trigger a GC,
// otherwise flood of postMessage() can cause OOM.
// Ok to invoke multiple times (only adds memory once).
// The memory registration is revoked automatically in destructor.
void registerMemoryAllocatedWithCurrentScriptContext();
+ // Upon passing a serialized value from one context to another (via a
+ // postMessage()), the allocation amounts it has registered with the
+ // 'origining' context must be discharged, as the 'target' context will assume
+ // ownership of value. This method takes care of the first part of the
+ // external allocation bookkeeping, the above registration method the other
+ // half.
+ void unregisterMemoryAllocatedByCurrentScriptContext();
jbroman 2017/03/07 18:00:04 Can you clarify why this is needed now? It looks l
sof 2017/03/07 19:14:03 - transferables (arraybuffers) will be accounted w
jbroman 2017/03/07 19:29:05 Ah, it wasn't obvious to me that this was intended
sof 2017/03/08 07:07:17 Added a method on ArrayBufferContents to handle th
+
const uint8_t* data() const { return m_dataBuffer.get(); }
size_t dataLengthInBytes() const { return m_dataBufferSize; }

Powered by Google App Engine
This is Rietveld 408576698