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

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

Issue 2734173002: postMessage(): transfer allocation costs along with value. (Closed)
Patch Set: rebased upto r455878 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 b610b640aedbcd9a0e3b4efdc3e24e4c63c62cee..e74e3dfd8b5f3a190600d1d26a335f5663dd7ab5 100644
--- a/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.h
+++ b/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.h
@@ -129,13 +129,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();
+
const uint8_t* data() const { return m_dataBuffer.get(); }
size_t dataLengthInBytes() const { return m_dataBufferSize; }
@@ -180,7 +188,8 @@ class CORE_EXPORT SerializedScriptValue
std::unique_ptr<ArrayBufferContentsArray> m_arrayBufferContentsArray;
std::unique_ptr<ImageBitmapContentsArray> m_imageBitmapContentsArray;
BlobDataHandleMap m_blobDataHandles;
- intptr_t m_externallyAllocatedMemory;
+ size_t m_externallyAllocatedMemory;
+ bool m_adjustTransferableExternalAllocationOnContextTransfer;
};
template <>
« no previous file with comments | « no previous file | third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698