| 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 26 matching lines...) Expand all Loading... |
| 37 static int F(char*); | 37 static int F(char*); |
| 38 | 38 |
| 39 public: | 39 public: |
| 40 using t = decltype(F(static_cast<T*>(nullptr))); | 40 using t = decltype(F(static_cast<T*>(nullptr))); |
| 41 }; | 41 }; |
| 42 | 42 |
| 43 } // namespace internal | 43 } // namespace internal |
| 44 | 44 |
| 45 // Basic buffer class, can be grown and shrunk dynamically. | 45 // Basic buffer class, can be grown and shrunk dynamically. |
| 46 // Unlike std::string/vector, does not initialize data when expanding capacity. | 46 // Unlike std::string/vector, does not initialize data when expanding capacity. |
| 47 class Buffer final { | 47 class Buffer { |
| 48 public: | 48 public: |
| 49 Buffer(); // An empty buffer. | 49 Buffer(); // An empty buffer. |
| 50 Buffer(const Buffer& buf); // Copy size and contents of an existing buffer. | 50 Buffer(const Buffer& buf); // Copy size and contents of an existing buffer. |
| 51 Buffer(Buffer&& buf); // Move contents from an existing buffer. | 51 Buffer(Buffer&& buf); // Move contents from an existing buffer. |
| 52 | 52 |
| 53 // Construct a buffer with the specified number of uninitialized bytes. | 53 // Construct a buffer with the specified number of uninitialized bytes. |
| 54 explicit Buffer(size_t size); | 54 explicit Buffer(size_t size); |
| 55 Buffer(size_t size, size_t capacity); | 55 Buffer(size_t size, size_t capacity); |
| 56 | 56 |
| 57 // Construct a buffer and copy the specified number of bytes into it. The | 57 // Construct a buffer and copy the specified number of bytes into it. The |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 } | 217 } |
| 218 | 218 |
| 219 size_t size_; | 219 size_t size_; |
| 220 size_t capacity_; | 220 size_t capacity_; |
| 221 scoped_ptr<uint8_t[]> data_; | 221 scoped_ptr<uint8_t[]> data_; |
| 222 }; | 222 }; |
| 223 | 223 |
| 224 } // namespace rtc | 224 } // namespace rtc |
| 225 | 225 |
| 226 #endif // WEBRTC_BASE_BUFFER_H_ | 226 #endif // WEBRTC_BASE_BUFFER_H_ |
| OLD | NEW |