summaryrefslogtreecommitdiff
path: root/libs/gui/ConsumerBase.cpp
diff options
context:
space:
mode:
author Eino-Ville Talvala <etalvala@google.com> 2016-07-21 17:06:58 -0700
committer Eino-Ville Talvala <etalvala@google.com> 2016-07-22 12:27:04 -0700
commitbc2df65a3f3f4b8abaaaa2a4e576a3a42c2d30f3 (patch)
tree1d161800a08d5ea3ed3088a5c224173665267769 /libs/gui/ConsumerBase.cpp
parentd16f6ae2bd1083ee29717829a39e93908bba2bf5 (diff)
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.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/libs/gui/ConsumerBase.cpp b/libs/gui/ConsumerBase.cpp
index 84965ef6da..a1bdf4a4a1 100644
--- a/libs/gui/ConsumerBase.cpp
+++ b/libs/gui/ConsumerBase.cpp
@@ -245,6 +245,15 @@ status_t ConsumerBase::getOccupancyHistory(bool forceFlush,
return mConsumer->getOccupancyHistory(forceFlush, outHistory);
}
+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, "");
}