Index: base/memory/ref_counted_memory.h |
diff --git a/base/memory/ref_counted_memory.h b/base/memory/ref_counted_memory.h |
index fd5e8a0b8fc51c05598ab861c52dbed6248d76c3..d2987c5d21bd3d1cb1c6ebd6bf3c7f827b341491 100644 |
--- a/base/memory/ref_counted_memory.h |
+++ b/base/memory/ref_counted_memory.h |
@@ -113,6 +113,26 @@ class BASE_EXPORT RefCountedString : public RefCountedMemory { |
DISALLOW_COPY_AND_ASSIGN(RefCountedString); |
}; |
+// An implementation of RefCountedMemory that holds a chunk of memory |
+// previously allocated with malloc or calloc, and that therefore must be freed |
+// using free(). |
+class BASE_EXPORT RefCountedMallocedMemory : public base::RefCountedMemory { |
+ public: |
+ RefCountedMallocedMemory(void* data, size_t length); |
+ |
+ // Overridden from RefCountedMemory: |
+ virtual const unsigned char* front() const OVERRIDE; |
+ virtual size_t size() const OVERRIDE; |
+ |
+ private: |
+ virtual ~RefCountedMallocedMemory(); |
+ |
+ unsigned char* data_; |
+ size_t length_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(RefCountedMallocedMemory); |
+}; |
+ |
} // namespace base |
#endif // BASE_MEMORY_REF_COUNTED_MEMORY_H_ |