1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 03:57:44 +00:00

LibGfx: Make Gfx::Bitmap::set_nonvolatile() report allocation failure

Making a bitmap non-volatile after being volatile may fail to allocate
physical pages after the kernel stole the old pages in a purge.

This is different from the pages being purged, but reallocated. In that
case, they are simply replaced with zero-fill-on-demand pages as if
they were freshly allocated.
This commit is contained in:
Andreas Kling 2021-07-24 22:49:48 +02:00
parent 24b5295b30
commit 143443e0b6
23 changed files with 57 additions and 46 deletions

View file

@ -33,7 +33,7 @@ public:
virtual RefPtr<Gfx::Bitmap> bitmap() = 0;
virtual void set_volatile() = 0;
[[nodiscard]] virtual bool set_nonvolatile() = 0;
[[nodiscard]] virtual bool set_nonvolatile(bool& was_purged) = 0;
virtual bool sniff() = 0;
@ -63,7 +63,7 @@ public:
if (m_plugin)
m_plugin->set_volatile();
}
[[nodiscard]] bool set_nonvolatile() { return m_plugin ? m_plugin->set_nonvolatile() : false; }
[[nodiscard]] bool set_nonvolatile(bool& was_purged) { return m_plugin ? m_plugin->set_nonvolatile(was_purged) : false; }
bool sniff() const { return m_plugin ? m_plugin->sniff() : false; }
bool is_animated() const { return m_plugin ? m_plugin->is_animated() : false; }
size_t loop_count() const { return m_plugin ? m_plugin->loop_count() : 0; }