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

Unified Diff: webrtc/modules/include/module_common_types.h

Issue 3002283002: Implement move constructor for RTPFragmentationHeader. (Closed)
Patch Set: Address comments 2. Created 3 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/modules/include/module_common_types.h
diff --git a/webrtc/modules/include/module_common_types.h b/webrtc/modules/include/module_common_types.h
index 23ed8f40bffc9f380a1f6f91683e4d248ae487a2..1ee428deed7ee12f17f58912c6e8ef318f873531 100644
--- a/webrtc/modules/include/module_common_types.h
+++ b/webrtc/modules/include/module_common_types.h
@@ -91,6 +91,11 @@ class RTPFragmentationHeader {
fragmentationTimeDiff(NULL),
fragmentationPlType(NULL) {}
+ RTPFragmentationHeader(RTPFragmentationHeader&& other)
+ : RTPFragmentationHeader() {
+ std::swap(*this, other);
+ }
+
~RTPFragmentationHeader() {
delete[] fragmentationOffset;
delete[] fragmentationLength;
@@ -98,6 +103,17 @@ class RTPFragmentationHeader {
delete[] fragmentationPlType;
}
+ void operator=(RTPFragmentationHeader&& other) { std::swap(*this, other); }
+
+ friend void swap(RTPFragmentationHeader& a, RTPFragmentationHeader& b) {
+ using std::swap;
+ swap(a.fragmentationVectorSize, b.fragmentationVectorSize);
+ swap(a.fragmentationOffset, b.fragmentationOffset);
+ swap(a.fragmentationLength, b.fragmentationLength);
+ swap(a.fragmentationTimeDiff, b.fragmentationTimeDiff);
+ swap(a.fragmentationPlType, b.fragmentationPlType);
+ }
+
void CopyFrom(const RTPFragmentationHeader& src) {
if (this == &src) {
return;
« 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