Allow the SwapQueue to utilize user-define swap capability

The SwapQueue class provides efficient and thread-safe queueing of objects that
have swap capabilities. However, the current implementation does not utilize the
user-defined swap capabilites. This CL addresses that.

Bug: b/168693942
Change-Id: Id5c97c8c9cc04579b3c26c7f1dc5f8b3362126c4
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/184361
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32118}
This commit is contained in:
Per Åhgren 2020-09-16 15:26:17 +02:00 committed by Commit Bot
parent fe132e6bd9
commit c8b3183711

View File

@ -141,7 +141,8 @@ class SwapQueue {
return false;
}
std::swap(*input, queue_[next_write_index_]);
using std::swap;
swap(*input, queue_[next_write_index_]);
// Increment the value of num_elements_ to account for the inserted element.
// Release memory ordering prevents the reads and writes to
@ -181,7 +182,8 @@ class SwapQueue {
return false;
}
std::swap(*output, queue_[next_read_index_]);
using std::swap;
swap(*output, queue_[next_read_index_]);
// Decrement the value of num_elements_ to account for the removed element.
// Release memory ordering prevents the reads and writes to