mirror of
https://github.com/zebrajr/ladybird.git
synced 2025-12-06 00:19:53 +01:00
LibThreading: Pass ownership of a BackgroundAction result to its caller
There is no need to create a copy of potentially expensive structures.
This commit is contained in:
parent
f20aa82c27
commit
5f9ed343b3
|
|
@ -65,7 +65,7 @@ private:
|
|||
promise->on_resolution = [](NonnullRefPtr<Core::EventReceiver>& object) -> ErrorOr<void> {
|
||||
auto self = static_ptr_cast<BackgroundAction<Result>>(object);
|
||||
VERIFY(self->m_result.has_value());
|
||||
if (auto maybe_error = self->m_on_complete(self->m_result.value()); maybe_error.is_error())
|
||||
if (auto maybe_error = self->m_on_complete(self->m_result.release_value()); maybe_error.is_error())
|
||||
self->m_on_error(maybe_error.release_error());
|
||||
|
||||
return {};
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user