consumer_base: Pass shared_ptr by const reference
Avoids churning atomic reference count increments and decrements.
This commit is contained in:
parent
260a495a23
commit
c0c4f6dfa6
|
@ -83,7 +83,7 @@ Status ConsumerBase::AcquireBufferLocked(BufferItem* item, std::chrono::nanoseco
|
||||||
}
|
}
|
||||||
|
|
||||||
Status ConsumerBase::AddReleaseFenceLocked(s32 slot,
|
Status ConsumerBase::AddReleaseFenceLocked(s32 slot,
|
||||||
const std::shared_ptr<GraphicBuffer> graphic_buffer,
|
const std::shared_ptr<GraphicBuffer>& graphic_buffer,
|
||||||
const Fence& fence) {
|
const Fence& fence) {
|
||||||
LOG_DEBUG(Service_NVFlinger, "slot={}", slot);
|
LOG_DEBUG(Service_NVFlinger, "slot={}", slot);
|
||||||
|
|
||||||
|
@ -100,7 +100,7 @@ Status ConsumerBase::AddReleaseFenceLocked(s32 slot,
|
||||||
}
|
}
|
||||||
|
|
||||||
Status ConsumerBase::ReleaseBufferLocked(s32 slot,
|
Status ConsumerBase::ReleaseBufferLocked(s32 slot,
|
||||||
const std::shared_ptr<GraphicBuffer> graphic_buffer) {
|
const std::shared_ptr<GraphicBuffer>& graphic_buffer) {
|
||||||
// If consumer no longer tracks this graphic_buffer (we received a new
|
// If consumer no longer tracks this graphic_buffer (we received a new
|
||||||
// buffer on the same slot), the buffer producer is definitely no longer
|
// buffer on the same slot), the buffer producer is definitely no longer
|
||||||
// tracking it.
|
// tracking it.
|
||||||
|
@ -121,7 +121,7 @@ Status ConsumerBase::ReleaseBufferLocked(s32 slot,
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ConsumerBase::StillTracking(s32 slot,
|
bool ConsumerBase::StillTracking(s32 slot,
|
||||||
const std::shared_ptr<GraphicBuffer> graphic_buffer) const {
|
const std::shared_ptr<GraphicBuffer>& graphic_buffer) const {
|
||||||
if (slot < 0 || slot >= BufferQueueDefs::NUM_BUFFER_SLOTS) {
|
if (slot < 0 || slot >= BufferQueueDefs::NUM_BUFFER_SLOTS) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,9 +36,9 @@ protected:
|
||||||
|
|
||||||
void FreeBufferLocked(s32 slot_index);
|
void FreeBufferLocked(s32 slot_index);
|
||||||
Status AcquireBufferLocked(BufferItem* item, std::chrono::nanoseconds present_when);
|
Status AcquireBufferLocked(BufferItem* item, std::chrono::nanoseconds present_when);
|
||||||
Status ReleaseBufferLocked(s32 slot, const std::shared_ptr<GraphicBuffer> graphic_buffer);
|
Status ReleaseBufferLocked(s32 slot, const std::shared_ptr<GraphicBuffer>& graphic_buffer);
|
||||||
bool StillTracking(s32 slot, const std::shared_ptr<GraphicBuffer> graphic_buffer) const;
|
bool StillTracking(s32 slot, const std::shared_ptr<GraphicBuffer>& graphic_buffer) const;
|
||||||
Status AddReleaseFenceLocked(s32 slot, const std::shared_ptr<GraphicBuffer> graphic_buffer,
|
Status AddReleaseFenceLocked(s32 slot, const std::shared_ptr<GraphicBuffer>& graphic_buffer,
|
||||||
const Fence& fence);
|
const Fence& fence);
|
||||||
|
|
||||||
struct Slot final {
|
struct Slot final {
|
||||||
|
|
Loading…
Reference in New Issue