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 e74e3dfd8b5f3a190600d1d26a335f5663dd7ab5..e62beb43276575356555856fcc55b703fd4668a5 100644 |
--- a/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.h |
+++ b/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.h |
@@ -139,10 +139,24 @@ class CORE_EXPORT SerializedScriptValue |
// 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(); |
+ // ownership of the value. As we're potentially working across threads, this |
+ // transfer of cost is handled in three stages: |
+ // |
+ // - prepareForTransferringContext(): prepares and marks this |
+ // SerializedScriptValue as being destined for transfer to another |
+ // context. |
+ // - finalizeTransferringContext(): checks if the transfer was successful, |
+ // and if so, discounts allocation costs from the context just left. |
+ // - registerMemoryAllocatedWithCurrentScriptContext() - called by the |
+ // 'target' once ownership has been assumed. It registers the allocation |
+ // costs of the resources that the SerializedScriptValue holds onto in |
+ // that new context. |
+ // |
+ // The first two are called by 'origining' context, before and after actual |
+ // transfer. |
+ // |
+ void prepareForTransferringContext(); |
+ void finalizeTransferringContext(); |
const uint8_t* data() const { return m_dataBuffer.get(); } |
size_t dataLengthInBytes() const { return m_dataBufferSize; } |