| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 size_t size() const { | 127 size_t size() const { |
| 128 RTC_DCHECK(IsConsistent()); | 128 RTC_DCHECK(IsConsistent()); |
| 129 return size_; | 129 return size_; |
| 130 } | 130 } |
| 131 | 131 |
| 132 size_t capacity() const { | 132 size_t capacity() const { |
| 133 RTC_DCHECK(IsConsistent()); | 133 RTC_DCHECK(IsConsistent()); |
| 134 return capacity_; | 134 return capacity_; |
| 135 } | 135 } |
| 136 | 136 |
| 137 bool empty() const { return size() == 0u; } |
| 138 |
| 137 BufferT& operator=(BufferT&& buf) { | 139 BufferT& operator=(BufferT&& buf) { |
| 138 RTC_DCHECK(IsConsistent()); | 140 RTC_DCHECK(IsConsistent()); |
| 139 RTC_DCHECK(buf.IsConsistent()); | 141 RTC_DCHECK(buf.IsConsistent()); |
| 140 size_ = buf.size_; | 142 size_ = buf.size_; |
| 141 capacity_ = buf.capacity_; | 143 capacity_ = buf.capacity_; |
| 142 data_ = std::move(buf.data_); | 144 data_ = std::move(buf.data_); |
| 143 buf.OnMovedFrom(); | 145 buf.OnMovedFrom(); |
| 144 return *this; | 146 return *this; |
| 145 } | 147 } |
| 146 | 148 |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 size_t capacity_; | 351 size_t capacity_; |
| 350 std::unique_ptr<T[]> data_; | 352 std::unique_ptr<T[]> data_; |
| 351 }; | 353 }; |
| 352 | 354 |
| 353 // By far the most common sort of buffer. | 355 // By far the most common sort of buffer. |
| 354 using Buffer = BufferT<uint8_t>; | 356 using Buffer = BufferT<uint8_t>; |
| 355 | 357 |
| 356 } // namespace rtc | 358 } // namespace rtc |
| 357 | 359 |
| 358 #endif // WEBRTC_BASE_BUFFER_H_ | 360 #endif // WEBRTC_BASE_BUFFER_H_ |
| OLD | NEW |