Index: Source/wtf/ArrayBufferContents.h |
diff --git a/Source/wtf/ArrayBufferContents.h b/Source/wtf/ArrayBufferContents.h |
index 4bd137f02ce984f0fe9c70f30e1564b269498f7a..bc48d9c3b757e2b6a65441789f747433913891dc 100644 |
--- a/Source/wtf/ArrayBufferContents.h |
+++ b/Source/wtf/ArrayBufferContents.h |
@@ -27,8 +27,9 @@ |
#ifndef ArrayBufferContents_h |
#define ArrayBufferContents_h |
-#include "wtf/ArrayBufferDeallocationObserver.h" |
+#include "wtf/Assertions.h" |
#include "wtf/Noncopyable.h" |
+#include "wtf/WTF.h" |
#include "wtf/WTFExport.h" |
namespace WTF { |
@@ -49,7 +50,7 @@ public: |
// upon destruction. |
// This constructor will not call observer->StartObserving(), so it is a responsibility |
// of the caller to make sure JS knows about external memory. |
- ArrayBufferContents(void* data, unsigned sizeInBytes, ArrayBufferDeallocationObserver*); |
+ ArrayBufferContents(void* data, unsigned sizeInBytes); |
~ArrayBufferContents(); |
@@ -58,30 +59,21 @@ public: |
void* data() const { return m_data; } |
unsigned sizeInBytes() const { return m_sizeInBytes; } |
- void setDeallocationObserver(ArrayBufferDeallocationObserver& observer) |
- { |
- if (!m_deallocationObserver) { |
- m_deallocationObserver = &observer; |
- m_deallocationObserver->blinkAllocatedMemory(m_sizeInBytes); |
- } |
- } |
- void setDeallocationObserverWithoutAllocationNotification(ArrayBufferDeallocationObserver& observer) |
- { |
- if (!m_deallocationObserver) { |
- m_deallocationObserver = &observer; |
- } |
- } |
- |
void transfer(ArrayBufferContents& other); |
void copyTo(ArrayBufferContents& other); |
static void allocateMemory(size_t, InitializationPolicy, void*&); |
static void freeMemory(void*, size_t); |
+ static void setAdjustAmoutOfExternalAllocatedMemoryFunction(AdjustAmountOfExternalAllocatedMemoryFunction function) |
+ { |
+ ASSERT(!s_adjustAmountOfExternalAllocatedMemoryFunction); |
+ s_adjustAmountOfExternalAllocatedMemoryFunction = function; |
+ } |
private: |
void* m_data; |
unsigned m_sizeInBytes; |
- ArrayBufferDeallocationObserver* m_deallocationObserver; |
+ static AdjustAmountOfExternalAllocatedMemoryFunction s_adjustAmountOfExternalAllocatedMemoryFunction; |
}; |
} // namespace WTF |