diff options
| author | 2016-07-21 17:06:58 -0700 | |
|---|---|---|
| committer | 2016-09-09 15:11:02 -0700 | |
| commit | 8211047138ea7892c73f4e6f6291a85a11759e0c (patch) | |
| tree | a203d0338086a05099054f2924a3e8c945f39bb1 /libs/gui/ConsumerBase.cpp | |
| parent | 083f4ecca201e508f0f5cbe0aa95882a82abdf5e (diff) | |
DO NOT MERGE ANYWHERE: BufferQueue consumers: Add discardFreeBuffer method
This method releases all free buffers owned by the buffer queue,
in order to save memory (at the cost of potential future
reallocation of buffers).
Bug: 28695173
Change-Id: I458d10373e639e3144faf673af2ba01aca36e65a
Diffstat (limited to 'libs/gui/ConsumerBase.cpp')
| -rw-r--r-- | libs/gui/ConsumerBase.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/libs/gui/ConsumerBase.cpp b/libs/gui/ConsumerBase.cpp index a6a971282e..c00526dd9c 100644 --- a/libs/gui/ConsumerBase.cpp +++ b/libs/gui/ConsumerBase.cpp @@ -235,6 +235,15 @@ status_t ConsumerBase::setDefaultBufferDataSpace( return mConsumer->setDefaultBufferDataSpace(defaultDataSpace); } +status_t ConsumerBase::discardFreeBuffers() { + Mutex::Autolock _l(mMutex); + if (mAbandoned) { + CB_LOGE("discardFreeBuffers: ConsumerBase is abandoned!"); + return NO_INIT; + } + return mConsumer->discardFreeBuffers(); +} + void ConsumerBase::dump(String8& result) const { dump(result, ""); } |