mirror of
https://github.com/RGBCube/serenity
synced 2025-05-18 18:55:07 +00:00
LibC: Add mmap_with_name() that names the allocation immediately.
This allows us to skip the separate call to set_mmap_name() in code that we control, e.g malloc() and GraphicsBitmap.
This commit is contained in:
parent
5f26f83451
commit
189b342e6f
8 changed files with 28 additions and 13 deletions
|
@ -19,10 +19,9 @@ GraphicsBitmap::GraphicsBitmap(Format format, const Size& size)
|
|||
{
|
||||
if (format == Format::Indexed8)
|
||||
m_palette = new RGBA32[256];
|
||||
m_data = (RGBA32*)mmap(nullptr, size_in_bytes(), PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_PRIVATE, 0, 0);
|
||||
m_data = (RGBA32*)mmap_with_name(nullptr, size_in_bytes(), PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_PRIVATE, 0, 0, String::format("GraphicsBitmap [%dx%d]", width(), height()).characters());
|
||||
ASSERT(m_data && m_data != (void*)-1);
|
||||
m_needs_munmap = true;
|
||||
set_mmap_name(String::format("GraphicsBitmap [%dx%d]", width(), height()).characters());
|
||||
}
|
||||
|
||||
Retained<GraphicsBitmap> GraphicsBitmap::create_wrapper(Format format, const Size& size, RGBA32* data)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue