OSDN Git Service

GD-Common: Add CircularBuffer::Drain() method
authorJack He <siyuanh@google.com>
Thu, 18 Feb 2021 07:44:57 +0000 (23:44 -0800)
committerJack He <siyuanh@google.com>
Thu, 18 Feb 2021 07:52:13 +0000 (23:52 -0800)
commit837bdd0db933b25860ae672ca9772765c8c76483
tree073537769433f92fb95cd7ec47ece78b8377b7f7
parent66e64da87a5f1a12e18bf3976a9f0e7444897520
GD-Common: Add CircularBuffer::Drain() method

* Drain() allows a circular buffer to return and clear
  its content so that one can clear a circular buffer
  in-place
* Moreover, Drain() uses move semantic to avoid copying
  its content and hence is more efficient
* Modify Pull() to use range-based initialization to do
  blocked copy that tends to be more efficient
* Add circular buffer unit test to compilation target
  and presubmit

Bug: 180569201
Test: gd/cert/run
Test: bluetooth_test_gd
Tag: #gd-refactor
Change-Id: Ic94f70fc862f244dcdc6b9d5f2526c45d0b8eb52
gd/common/Android.bp
gd/common/circular_buffer.h
gd/common/circular_buffer_test.cc