nitpicker: reflect Handle_registry::Out_of_memory

In the event where a nitpicker session's quota was depleted by the
allocation of view handles, nitpicker would abort. The patch prevents
the abort by reflecting this condition as an Out_of_metadata exception
to the client. This way, the client can upgrade its session as needed.

The problem was triggered by running the decorator_stress test (changed
to generate 40 windows) with the themed_decorator.
This commit is contained in:
Norman Feske 2015-11-21 11:17:13 +01:00 committed by Christian Helmuth
parent a1c0c99045
commit 0ab49dff3a
1 changed files with 9 additions and 2 deletions

View File

@ -776,6 +776,8 @@ class Nitpicker::Session_component : public Genode::Rpc_object<Session>,
}
catch (View_handle_registry::Lookup_failed) {
return View_handle(); }
catch (View_handle_registry::Out_of_memory) {
throw Nitpicker::Session::Out_of_metadata(); }
catch (Genode::Allocator::Out_of_memory) {
throw Nitpicker::Session::Out_of_metadata(); }
}
@ -799,7 +801,9 @@ class Nitpicker::Session_component : public Genode::Rpc_object<Session>,
_view_list.insert(view);
_ep.manage(view);
return _view_handle_registry.alloc(*view);
try { return _view_handle_registry.alloc(*view); }
catch (View_handle_registry::Out_of_memory) {
throw Nitpicker::Session::Out_of_metadata(); }
}
void destroy_view(View_handle handle) override
@ -835,7 +839,10 @@ class Nitpicker::Session_component : public Genode::Rpc_object<Session>,
return (view) ? _view_handle_registry.alloc(*view, handle)
: View_handle();
};
return _ep.apply(view_cap, lambda);
try { return _ep.apply(view_cap, lambda); }
catch (View_handle_registry::Out_of_memory) {
throw Nitpicker::Session::Out_of_metadata(); }
}
View_capability view_capability(View_handle handle) override