Chromium Code Reviews| Index: Source/wtf/ArrayBufferContents.h |
| diff --git a/Source/wtf/ArrayBufferContents.h b/Source/wtf/ArrayBufferContents.h |
| index 4bd137f02ce984f0fe9c70f30e1564b269498f7a..385cfb414d2877baabeda612cc10f645ec2d2e22 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(!adjustAmountOfExternalAllocatedMemoryFunction); |
| + adjustAmountOfExternalAllocatedMemoryFunction = function; |
| + } |
| private: |
| void* m_data; |
| unsigned m_sizeInBytes; |
| - ArrayBufferDeallocationObserver* m_deallocationObserver; |
| + static AdjustAmountOfExternalAllocatedMemoryFunction adjustAmountOfExternalAllocatedMemoryFunction; |
|
tkent
2015/06/15 23:21:32
adjustAmountOfExternalAllocatedMemoryFunction -> s
binji
2015/06/16 06:20:56
Done.
|
| }; |
| } // namespace WTF |