Index: base/memory/ref_counted_memory.cc |
diff --git a/base/memory/ref_counted_memory.cc b/base/memory/ref_counted_memory.cc |
index b048a6e0d8d2352936e9cb995479058c13f17ba4..b1deee1120167d8517e41b782b7e8690d4e11b80 100644 |
--- a/base/memory/ref_counted_memory.cc |
+++ b/base/memory/ref_counted_memory.cc |
@@ -4,6 +4,8 @@ |
#include "base/memory/ref_counted_memory.h" |
+#include <stdlib.h> |
+ |
#include "base/logging.h" |
namespace base { |
@@ -74,4 +76,22 @@ size_t RefCountedString::size() const { |
return data_.size(); |
} |
+RefCountedMallocedMemory::RefCountedMallocedMemory( |
+ void* data, size_t length) |
+ : data_(reinterpret_cast<unsigned char*>(data)), length_(length) { |
+ DCHECK(data || length == 0); |
+} |
+ |
+const unsigned char* RefCountedMallocedMemory::front() const { |
+ return length_ ? data_ : NULL; |
+} |
+ |
+size_t RefCountedMallocedMemory::size() const { |
+ return length_; |
+} |
+ |
+RefCountedMallocedMemory::~RefCountedMallocedMemory() { |
+ free(data_); |
+} |
+ |
} // namespace base |