libcamera: request: Store fence EventNotifier directly

Simplify a bit by storing the `EventNotifier` objects directly in the
`std::map` instead of wrapping them in unique_ptr. An other advantage
is that it removes one allocation per fence.

Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
This commit is contained in:
Barnabás Pőcze
2025-02-06 15:09:37 +01:00
parent eca695f291
commit 4f8b1290e4
2 changed files with 6 additions and 9 deletions
+5 -8
View File
@@ -228,15 +228,12 @@ void Request::Private::prepare(std::chrono::milliseconds timeout)
if (!fence)
continue;
std::unique_ptr<EventNotifier> notifier =
std::make_unique<EventNotifier>(fence->fd().get(),
EventNotifier::Read);
auto [it, inserted] = notifiers_.try_emplace(buffer, fence->fd().get(), EventNotifier::Type::Read);
ASSERT(inserted);
notifier->activated.connect(this, [this, buffer] {
notifierActivated(buffer);
});
notifiers_[buffer] = std::move(notifier);
it->second.activated.connect(this, [this, buffer] {
notifierActivated(buffer);
});
}
if (notifiers_.empty()) {