mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-03 07:07:23 +00:00
Kernel: Make KBuffer::try_create_with_size() return KResultOr
This allows us to use TRY() in a lot of new places.
This commit is contained in:
@@ -274,10 +274,10 @@ bool PerformanceEventBuffer::to_json(KBufferBuilder& builder) const
|
||||
|
||||
OwnPtr<PerformanceEventBuffer> PerformanceEventBuffer::try_create_with_size(size_t buffer_size)
|
||||
{
|
||||
auto buffer = KBuffer::try_create_with_size(buffer_size, Memory::Region::Access::ReadWrite, "Performance events", AllocationStrategy::AllocateNow);
|
||||
if (!buffer)
|
||||
auto buffer_or_error = KBuffer::try_create_with_size(buffer_size, Memory::Region::Access::ReadWrite, "Performance events", AllocationStrategy::AllocateNow);
|
||||
if (buffer_or_error.is_error())
|
||||
return {};
|
||||
return adopt_own_if_nonnull(new (nothrow) PerformanceEventBuffer(buffer.release_nonnull()));
|
||||
return adopt_own_if_nonnull(new (nothrow) PerformanceEventBuffer(buffer_or_error.release_value()));
|
||||
}
|
||||
|
||||
void PerformanceEventBuffer::add_process(const Process& process, ProcessEventType event_type)
|
||||
|
||||
Reference in New Issue
Block a user