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

Unified Diff: Source/wtf/ArrayBufferContents.h

Issue 1183763003: Remove ArrayBufferDeallocationObserver (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: s_ prefix Created 5 years, 6 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 | « Source/wtf/ArrayBuffer.h ('k') | Source/wtf/ArrayBufferContents.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « Source/wtf/ArrayBuffer.h ('k') | Source/wtf/ArrayBufferContents.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698