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:
@@ -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()) {
|
||||
|
||||
Reference in New Issue
Block a user