libgui: Plumb detachBuffer through ConsumerBase

Exposes IGraphicBufferConsumer::detachBuffer as a ConsumerBase
method. attachBuffer is not currently exposed, because all current
clients will be recycling buffers through the allocator.

Bug: 19628705
Change-Id: I3e519767fa43d5d880c1d5695e31b60f6ad588af
This commit is contained in:
Dan Stoza 2015-04-03 14:22:05 -07:00
parent 1cd030be59
commit 634f5ee6a7
2 changed files with 18 additions and 0 deletions

View File

@ -76,6 +76,9 @@ public:
// when a new frame becomes available. // when a new frame becomes available.
void setFrameAvailableListener(const wp<FrameAvailableListener>& listener); void setFrameAvailableListener(const wp<FrameAvailableListener>& listener);
// See IGraphicBufferConsumer::detachBuffer
status_t detachBuffer(int slot);
private: private:
ConsumerBase(const ConsumerBase&); ConsumerBase(const ConsumerBase&);
void operator=(const ConsumerBase&); void operator=(const ConsumerBase&);

View File

@ -163,6 +163,21 @@ void ConsumerBase::setFrameAvailableListener(
mFrameAvailableListener = listener; mFrameAvailableListener = listener;
} }
status_t ConsumerBase::detachBuffer(int slot) {
CB_LOGV("detachBuffer");
Mutex::Autolock lock(mMutex);
status_t result = mConsumer->detachBuffer(slot);
if (result != NO_ERROR) {
CB_LOGE("Failed to detach buffer: %d", result);
return result;
}
freeBufferLocked(slot);
return result;
}
void ConsumerBase::dump(String8& result) const { void ConsumerBase::dump(String8& result) const {
dump(result, ""); dump(result, "");
} }