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

Side by Side Diff: base/memory/ref_counted_memory.h

Issue 78603002: Added RefCountedMallocedMemory (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « no previous file | base/memory/ref_counted_memory.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef BASE_MEMORY_REF_COUNTED_MEMORY_H_ 5 #ifndef BASE_MEMORY_REF_COUNTED_MEMORY_H_
6 #define BASE_MEMORY_REF_COUNTED_MEMORY_H_ 6 #define BASE_MEMORY_REF_COUNTED_MEMORY_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 std::string& data() { return data_; } 106 std::string& data() { return data_; }
107 107
108 private: 108 private:
109 virtual ~RefCountedString(); 109 virtual ~RefCountedString();
110 110
111 std::string data_; 111 std::string data_;
112 112
113 DISALLOW_COPY_AND_ASSIGN(RefCountedString); 113 DISALLOW_COPY_AND_ASSIGN(RefCountedString);
114 }; 114 };
115 115
116 // An implementation of RefCountedMemory, that holds a chunk of memory
brettw 2013/11/21 23:29:50 Grammar: no comma before "that"
117 // previously allocated with malloc or calloc, and that therefore must be freed
118 // using free().
119 class BASE_EXPORT RefCountedMallocedMemory : public base::RefCountedMemory {
120 public:
121 RefCountedMallocedMemory(void* data, size_t length);
122
123 // Overridden from RefCountedMemory:
124 virtual const unsigned char* front() const OVERRIDE;
125 virtual size_t size() const OVERRIDE;
126
127 private:
128 virtual ~RefCountedMallocedMemory();
129
130 unsigned char* data_;
131 size_t length_;
132
133 DISALLOW_COPY_AND_ASSIGN(RefCountedMallocedMemory);
134 };
135
116 } // namespace base 136 } // namespace base
117 137
118 #endif // BASE_MEMORY_REF_COUNTED_MEMORY_H_ 138 #endif // BASE_MEMORY_REF_COUNTED_MEMORY_H_
OLDNEW
« 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