themed_decorator: upgrade cap and memory on demand

Issue #4150
This commit is contained in:
Alexander Boettcher 2021-05-12 15:50:13 +02:00 committed by Christian Helmuth
parent 7f6f710bd2
commit fc5903c917

View File

@ -170,9 +170,21 @@ struct Decorator::Main : Window_factory_base
*/
Window_base *create(Xml_node window_node) override
{
return new (_heap)
Window(_env, window_node.attribute_value("id", 0UL),
_gui, _animator, _theme, _decorator_config);
for (;;) {
try {
return new (_heap)
Window(_env, window_node.attribute_value("id", 0UL),
_gui, _animator, _theme, _decorator_config);
}
catch (Out_of_ram) {
log("Handle Out_of_ram of GUI session - upgrade by 8K");
_gui.upgrade_ram(8192);
}
catch (Out_of_caps) {
log("Handle Out_of_caps of GUI session - upgrade by 2");
_gui.upgrade_caps(2);
}
}
}
/**