Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(720)

Side by Side Diff: webrtc/base/buffer.cc

Issue 1717273002: Added functional variants of Buffer::SetData and Buffer::AppendData. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Fixed missing include of <algorithm> in buffer.cc and bufferqueue.cc Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright 2015 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2015 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
11 #include "webrtc/base/buffer.h" 11 #include "webrtc/base/buffer.h"
12 12
13 #include <algorithm>
13 #include <cassert> 14 #include <cassert>
14 #include <utility> 15 #include <utility>
15 16
16 namespace rtc { 17 namespace rtc {
17 18
18 Buffer::Buffer() : size_(0), capacity_(0), data_(nullptr) { 19 Buffer::Buffer() : size_(0), capacity_(0), data_(nullptr) {
19 assert(IsConsistent()); 20 assert(IsConsistent());
20 } 21 }
21 22
22 Buffer::Buffer(const Buffer& buf) : Buffer(buf.data(), buf.size()) { 23 Buffer::Buffer(const Buffer& buf) : Buffer(buf.data(), buf.size()) {
(...skipping 14 matching lines...) Expand all
37 : size_(size), 38 : size_(size),
38 capacity_(std::max(size, capacity)), 39 capacity_(std::max(size, capacity)),
39 data_(new uint8_t[capacity_]) { 40 data_(new uint8_t[capacity_]) {
40 assert(IsConsistent()); 41 assert(IsConsistent());
41 } 42 }
42 43
43 // Note: The destructor works even if the buffer has been moved from. 44 // Note: The destructor works even if the buffer has been moved from.
44 Buffer::~Buffer() = default; 45 Buffer::~Buffer() = default;
45 46
46 }; // namespace rtc 47 }; // namespace rtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698