| Index: Source/wtf/ArrayBufferContents.h
|
| diff --git a/Source/wtf/ArrayBufferContents.h b/Source/wtf/ArrayBufferContents.h
|
| index 4bd137f02ce984f0fe9c70f30e1564b269498f7a..84c17ecd614ad6b905080308e0ef3d63aec42a2c 100644
|
| --- a/Source/wtf/ArrayBufferContents.h
|
| +++ b/Source/wtf/ArrayBufferContents.h
|
| @@ -27,7 +27,7 @@
|
| #ifndef ArrayBufferContents_h
|
| #define ArrayBufferContents_h
|
|
|
| -#include "wtf/ArrayBufferDeallocationObserver.h"
|
| +#include "wtf/Assertions.h"
|
| #include "wtf/Noncopyable.h"
|
| #include "wtf/WTFExport.h"
|
|
|
| @@ -40,6 +40,7 @@ public:
|
| ZeroInitialize,
|
| DontInitialize
|
| };
|
| + typedef void (*AllocationListener)(int size);
|
|
|
| ArrayBufferContents();
|
| ArrayBufferContents(unsigned numElements, unsigned elementByteSize, ArrayBufferContents::InitializationPolicy);
|
| @@ -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 setAllocationListener(AllocationListener listener)
|
| + {
|
| + ASSERT(!allocationListener);
|
| + allocationListener = listener;
|
| + }
|
|
|
| private:
|
| void* m_data;
|
| unsigned m_sizeInBytes;
|
| - ArrayBufferDeallocationObserver* m_deallocationObserver;
|
| + static AllocationListener allocationListener;
|
| };
|
|
|
| } // namespace WTF
|
|
|