From fc5903c9176105918965e044501daa6b176b5a42 Mon Sep 17 00:00:00 2001 From: Alexander Boettcher Date: Wed, 12 May 2021 15:50:13 +0200 Subject: [PATCH] themed_decorator: upgrade cap and memory on demand Issue #4150 --- repos/gems/src/app/themed_decorator/main.cc | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/repos/gems/src/app/themed_decorator/main.cc b/repos/gems/src/app/themed_decorator/main.cc index 7262326676..1a0346403a 100644 --- a/repos/gems/src/app/themed_decorator/main.cc +++ b/repos/gems/src/app/themed_decorator/main.cc @@ -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); + } + } } /**