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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 DISALLOW_COPY_AND_ASSIGN(RefCountedStaticMemory); | 55 DISALLOW_COPY_AND_ASSIGN(RefCountedStaticMemory); |
56 }; | 56 }; |
57 | 57 |
58 // An implementation of RefCountedMemory, where we own our the data in a | 58 // An implementation of RefCountedMemory, where we own our the data in a |
59 // vector. | 59 // vector. |
60 class BASE_EXPORT RefCountedBytes : public RefCountedMemory { | 60 class BASE_EXPORT RefCountedBytes : public RefCountedMemory { |
61 public: | 61 public: |
62 RefCountedBytes(); | 62 RefCountedBytes(); |
63 | 63 |
64 // Constructs a RefCountedBytes object by _copying_ from |initializer|. | 64 // Constructs a RefCountedBytes object by _copying_ from |initializer|. |
65 RefCountedBytes(const std::vector<unsigned char>& initializer); | 65 explicit RefCountedBytes(const std::vector<unsigned char>& initializer); |
66 | 66 |
67 // Constructs a RefCountedBytes object by performing a swap. (To non | 67 // Constructs a RefCountedBytes object by performing a swap. (To non |
68 // destructively build a RefCountedBytes, use the constructor that takes a | 68 // destructively build a RefCountedBytes, use the constructor that takes a |
69 // vector.) | 69 // vector.) |
70 static RefCountedBytes* TakeVector(std::vector<unsigned char>* to_destroy); | 70 static RefCountedBytes* TakeVector(std::vector<unsigned char>* to_destroy); |
71 | 71 |
72 // Overridden from RefCountedMemory: | 72 // Overridden from RefCountedMemory: |
73 virtual const unsigned char* front() const OVERRIDE; | 73 virtual const unsigned char* front() const OVERRIDE; |
74 virtual size_t size() const OVERRIDE; | 74 virtual size_t size() const OVERRIDE; |
75 | 75 |
(...skipping 30 matching lines...) Expand all Loading... |
106 virtual ~RefCountedString(); | 106 virtual ~RefCountedString(); |
107 | 107 |
108 std::string data_; | 108 std::string data_; |
109 | 109 |
110 DISALLOW_COPY_AND_ASSIGN(RefCountedString); | 110 DISALLOW_COPY_AND_ASSIGN(RefCountedString); |
111 }; | 111 }; |
112 | 112 |
113 } // namespace base | 113 } // namespace base |
114 | 114 |
115 #endif // BASE_MEMORY_REF_COUNTED_MEMORY_H_ | 115 #endif // BASE_MEMORY_REF_COUNTED_MEMORY_H_ |
OLD | NEW |