OLD | NEW |
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 Loading... |
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 |
| 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_ |
OLD | NEW |