summaryrefslogtreecommitdiff
path: root/SharedGraphics
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-05-19 15:54:56 +0200
committerAndreas Kling <awesomekling@gmail.com>2019-05-19 15:54:56 +0200
commit189b342e6f372770395a764ffd88e96ab1ebc1a5 (patch)
tree7c574d48c8c03d1759f5e1556e7721fa50971528 /SharedGraphics
parent5f26f83451ea046f76d1bb019510548714408de6 (diff)
downloadserenity-189b342e6f372770395a764ffd88e96ab1ebc1a5.zip
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.
Diffstat (limited to 'SharedGraphics')
-rw-r--r--SharedGraphics/GraphicsBitmap.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/SharedGraphics/GraphicsBitmap.cpp b/SharedGraphics/GraphicsBitmap.cpp
index e8ec1ea8be..027dbbdaa8 100644
--- a/SharedGraphics/GraphicsBitmap.cpp
+++ b/SharedGraphics/GraphicsBitmap.cpp
@@ -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)