| 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 <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 | 74 |
| 75 // Constructs a RefCountedBytes object by _copying_ from |initializer|. | 75 // Constructs a RefCountedBytes object by _copying_ from |initializer|. |
| 76 explicit RefCountedBytes(const std::vector<unsigned char>& initializer); | 76 explicit RefCountedBytes(const std::vector<unsigned char>& initializer); |
| 77 | 77 |
| 78 // Constructs a RefCountedBytes object by copying |size| bytes from |p|. | 78 // Constructs a RefCountedBytes object by copying |size| bytes from |p|. |
| 79 RefCountedBytes(const unsigned char* p, size_t size); | 79 RefCountedBytes(const unsigned char* p, size_t size); |
| 80 | 80 |
| 81 // Constructs a RefCountedBytes object by performing a swap. (To non | 81 // Constructs a RefCountedBytes object by performing a swap. (To non |
| 82 // destructively build a RefCountedBytes, use the constructor that takes a | 82 // destructively build a RefCountedBytes, use the constructor that takes a |
| 83 // vector.) | 83 // vector.) |
| 84 static RefCountedBytes* TakeVector(std::vector<unsigned char>* to_destroy); | 84 static scoped_refptr<RefCountedBytes> TakeVector( |
| 85 std::vector<unsigned char>* to_destroy); |
| 85 | 86 |
| 86 // Overridden from RefCountedMemory: | 87 // Overridden from RefCountedMemory: |
| 87 const unsigned char* front() const override; | 88 const unsigned char* front() const override; |
| 88 size_t size() const override; | 89 size_t size() const override; |
| 89 | 90 |
| 90 const std::vector<unsigned char>& data() const { return data_; } | 91 const std::vector<unsigned char>& data() const { return data_; } |
| 91 std::vector<unsigned char>& data() { return data_; } | 92 std::vector<unsigned char>& data() { return data_; } |
| 92 | 93 |
| 93 private: | 94 private: |
| 94 ~RefCountedBytes() override; | 95 ~RefCountedBytes() override; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 120 ~RefCountedString() override; | 121 ~RefCountedString() override; |
| 121 | 122 |
| 122 std::string data_; | 123 std::string data_; |
| 123 | 124 |
| 124 DISALLOW_COPY_AND_ASSIGN(RefCountedString); | 125 DISALLOW_COPY_AND_ASSIGN(RefCountedString); |
| 125 }; | 126 }; |
| 126 | 127 |
| 127 } // namespace base | 128 } // namespace base |
| 128 | 129 |
| 129 #endif // BASE_MEMORY_REF_COUNTED_MEMORY_H_ | 130 #endif // BASE_MEMORY_REF_COUNTED_MEMORY_H_ |
| OLD | NEW |