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

Side by Side Diff: webrtc/modules/include/module_common_types.h

Issue 3002283002: Implement move constructor for RTPFragmentationHeader. (Closed)
Patch Set: Address comments 2. Created 3 years, 3 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 84
85 class RTPFragmentationHeader { 85 class RTPFragmentationHeader {
86 public: 86 public:
87 RTPFragmentationHeader() 87 RTPFragmentationHeader()
88 : fragmentationVectorSize(0), 88 : fragmentationVectorSize(0),
89 fragmentationOffset(NULL), 89 fragmentationOffset(NULL),
90 fragmentationLength(NULL), 90 fragmentationLength(NULL),
91 fragmentationTimeDiff(NULL), 91 fragmentationTimeDiff(NULL),
92 fragmentationPlType(NULL) {} 92 fragmentationPlType(NULL) {}
93 93
94 RTPFragmentationHeader(RTPFragmentationHeader&& other)
95 : RTPFragmentationHeader() {
96 std::swap(*this, other);
97 }
98
94 ~RTPFragmentationHeader() { 99 ~RTPFragmentationHeader() {
95 delete[] fragmentationOffset; 100 delete[] fragmentationOffset;
96 delete[] fragmentationLength; 101 delete[] fragmentationLength;
97 delete[] fragmentationTimeDiff; 102 delete[] fragmentationTimeDiff;
98 delete[] fragmentationPlType; 103 delete[] fragmentationPlType;
99 } 104 }
100 105
106 void operator=(RTPFragmentationHeader&& other) { std::swap(*this, other); }
107
108 friend void swap(RTPFragmentationHeader& a, RTPFragmentationHeader& b) {
109 using std::swap;
110 swap(a.fragmentationVectorSize, b.fragmentationVectorSize);
111 swap(a.fragmentationOffset, b.fragmentationOffset);
112 swap(a.fragmentationLength, b.fragmentationLength);
113 swap(a.fragmentationTimeDiff, b.fragmentationTimeDiff);
114 swap(a.fragmentationPlType, b.fragmentationPlType);
115 }
116
101 void CopyFrom(const RTPFragmentationHeader& src) { 117 void CopyFrom(const RTPFragmentationHeader& src) {
102 if (this == &src) { 118 if (this == &src) {
103 return; 119 return;
104 } 120 }
105 121
106 if (src.fragmentationVectorSize != fragmentationVectorSize) { 122 if (src.fragmentationVectorSize != fragmentationVectorSize) {
107 // new size of vectors 123 // new size of vectors
108 124
109 // delete old 125 // delete old
110 delete[] fragmentationOffset; 126 delete[] fragmentationOffset;
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after
622 static constexpr int kNotAProbe = -1; 638 static constexpr int kNotAProbe = -1;
623 int send_bitrate_bps = -1; 639 int send_bitrate_bps = -1;
624 int probe_cluster_id = kNotAProbe; 640 int probe_cluster_id = kNotAProbe;
625 int probe_cluster_min_probes = -1; 641 int probe_cluster_min_probes = -1;
626 int probe_cluster_min_bytes = -1; 642 int probe_cluster_min_bytes = -1;
627 }; 643 };
628 644
629 } // namespace webrtc 645 } // namespace webrtc
630 646
631 #endif // WEBRTC_MODULES_INCLUDE_MODULE_COMMON_TYPES_H_ 647 #endif // WEBRTC_MODULES_INCLUDE_MODULE_COMMON_TYPES_H_
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698