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

Unified Diff: base/memory/ref_counted_memory.h

Issue 78603002: Added RefCountedMallocedMemory (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: grammar fix Created 7 years, 1 month 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 | « no previous file | base/memory/ref_counted_memory.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_
« no previous file with comments | « no previous file | base/memory/ref_counted_memory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698