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 #include "base/memory/ref_counted_memory.h" | 5 #include "base/memory/ref_counted_memory.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 | 8 |
9 RefCountedMemory::RefCountedMemory() { | 9 RefCountedMemory::RefCountedMemory() { |
10 } | 10 } |
11 | 11 |
12 RefCountedMemory::~RefCountedMemory() { | 12 RefCountedMemory::~RefCountedMemory() { |
13 } | 13 } |
14 | 14 |
| 15 namespace base { |
| 16 |
15 const unsigned char* RefCountedStaticMemory::front() const { | 17 const unsigned char* RefCountedStaticMemory::front() const { |
16 return data_; | 18 return data_; |
17 } | 19 } |
18 | 20 |
19 size_t RefCountedStaticMemory::size() const { | 21 size_t RefCountedStaticMemory::size() const { |
20 return length_; | 22 return length_; |
21 } | 23 } |
22 | 24 |
23 namespace base { | |
24 | |
25 RefCountedBytes::RefCountedBytes() { | 25 RefCountedBytes::RefCountedBytes() { |
26 } | 26 } |
27 | 27 |
28 RefCountedBytes::RefCountedBytes(const std::vector<unsigned char>& initializer) | 28 RefCountedBytes::RefCountedBytes(const std::vector<unsigned char>& initializer) |
29 : data_(initializer) { | 29 : data_(initializer) { |
30 } | 30 } |
31 | 31 |
32 RefCountedBytes* RefCountedBytes::TakeVector( | 32 RefCountedBytes* RefCountedBytes::TakeVector( |
33 std::vector<unsigned char>* to_destroy) { | 33 std::vector<unsigned char>* to_destroy) { |
34 RefCountedBytes* bytes = new RefCountedBytes; | 34 RefCountedBytes* bytes = new RefCountedBytes; |
(...skipping 28 matching lines...) Expand all Loading... |
63 const unsigned char* RefCountedString::front() const { | 63 const unsigned char* RefCountedString::front() const { |
64 return data_.empty() ? NULL : | 64 return data_.empty() ? NULL : |
65 reinterpret_cast<const unsigned char*>(data_.data()); | 65 reinterpret_cast<const unsigned char*>(data_.data()); |
66 } | 66 } |
67 | 67 |
68 size_t RefCountedString::size() const { | 68 size_t RefCountedString::size() const { |
69 return data_.size(); | 69 return data_.size(); |
70 } | 70 } |
71 | 71 |
72 } // namespace base | 72 } // namespace base |
OLD | NEW |