From 86b3d366ca797e343ef2837b1444f514f7b615c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milie=20Feral?= Date: Tue, 11 Sep 2018 11:31:48 +0200 Subject: [PATCH] [apps] All apps are allocated in the same union --- apps/apps_container_storage.h | 4 ++++ apps/graph/app.cpp | 2 +- apps/hardware_test/app.cpp | 2 +- apps/home/app.cpp | 2 +- apps/on_boarding/app.cpp | 2 +- apps/probability/app.cpp | 2 +- apps/regression/app.cpp | 2 +- apps/sequence/app.cpp | 2 +- apps/settings/app.cpp | 2 +- apps/solver/app.cpp | 2 +- apps/statistics/app.cpp | 2 +- apps/usb/app.cpp | 2 +- 12 files changed, 15 insertions(+), 11 deletions(-) diff --git a/apps/apps_container_storage.h b/apps/apps_container_storage.h index 9e35962ae..e726b1161 100644 --- a/apps/apps_container_storage.h +++ b/apps/apps_container_storage.h @@ -23,6 +23,10 @@ private: ~Apps() {}; private: APPS_CONTAINER_APPS_DECLARATION + Home::App m_homeApp; + OnBoarding::App m_onBoardingApp; + HardwareTest::App m_hardwareTestApp; + USB::App m_usbApp; }; Apps m_apps; APPS_CONTAINER_SNAPSHOT_DECLARATIONS diff --git a/apps/graph/app.cpp b/apps/graph/app.cpp index 257165fe5..91e1bcdb3 100644 --- a/apps/graph/app.cpp +++ b/apps/graph/app.cpp @@ -28,7 +28,7 @@ App::Snapshot::Snapshot() : } App * App::Snapshot::unpack(Container * container) { - return new App(container, this); + return new (container->currentAppBuffer()) App(container, this); } void App::Snapshot::reset() { diff --git a/apps/hardware_test/app.cpp b/apps/hardware_test/app.cpp index fa0720758..ce18a656c 100644 --- a/apps/hardware_test/app.cpp +++ b/apps/hardware_test/app.cpp @@ -8,7 +8,7 @@ extern "C" { namespace HardwareTest { App * App::Snapshot::unpack(Container * container) { - return new App(container, this); + return new (container->currentAppBuffer()) App(container, this); } App::Descriptor * App::Snapshot::descriptor() { diff --git a/apps/home/app.cpp b/apps/home/app.cpp index 4d7d409e9..6404f410a 100644 --- a/apps/home/app.cpp +++ b/apps/home/app.cpp @@ -17,7 +17,7 @@ I18n::Message App::Descriptor::upperName() { } App * App::Snapshot::unpack(Container * container) { - return new App(container, this); + return new (container->currentAppBuffer()) App(container, this); } App::Descriptor * App::Snapshot::descriptor() { diff --git a/apps/on_boarding/app.cpp b/apps/on_boarding/app.cpp index d26dd518b..fa6fff20d 100644 --- a/apps/on_boarding/app.cpp +++ b/apps/on_boarding/app.cpp @@ -5,7 +5,7 @@ namespace OnBoarding { App * App::Snapshot::unpack(Container * container) { - return new App(container, this); + return new (container->currentAppBuffer()) App(container, this); } App::Descriptor * App::Snapshot::descriptor() { diff --git a/apps/probability/app.cpp b/apps/probability/app.cpp index f01915a40..eda77630a 100644 --- a/apps/probability/app.cpp +++ b/apps/probability/app.cpp @@ -35,7 +35,7 @@ App::Snapshot::~Snapshot() { } App * App::Snapshot::unpack(Container * container) { - return new App(container, this); + return new (container->currentAppBuffer()) App(container, this); } App::Descriptor * App::Snapshot::descriptor() { diff --git a/apps/regression/app.cpp b/apps/regression/app.cpp index 4f2aeaa58..783b86fdd 100644 --- a/apps/regression/app.cpp +++ b/apps/regression/app.cpp @@ -29,7 +29,7 @@ App::Snapshot::Snapshot() : } App * App::Snapshot::unpack(Container * container) { - return new App(container, this); + return new (container->currentAppBuffer()) App(container, this); } void App::Snapshot::reset() { diff --git a/apps/sequence/app.cpp b/apps/sequence/app.cpp index 0ccd7c74e..91742f15d 100644 --- a/apps/sequence/app.cpp +++ b/apps/sequence/app.cpp @@ -26,7 +26,7 @@ App::Snapshot::Snapshot() : } App * App::Snapshot::unpack(Container * container) { - return new App(container, this); + return new (container->currentAppBuffer()) App(container, this); } void App::Snapshot::reset() { diff --git a/apps/settings/app.cpp b/apps/settings/app.cpp index b9013a437..6a56f116f 100644 --- a/apps/settings/app.cpp +++ b/apps/settings/app.cpp @@ -17,7 +17,7 @@ const Image * App::Descriptor::icon() { } App * App::Snapshot::unpack(Container * container) { - return new App(container, this); + return new (container->currentAppBuffer()) App(container, this); } App::Descriptor * App::Snapshot::descriptor() { diff --git a/apps/solver/app.cpp b/apps/solver/app.cpp index 0bba04e14..024896588 100644 --- a/apps/solver/app.cpp +++ b/apps/solver/app.cpp @@ -24,7 +24,7 @@ App::Snapshot::Snapshot() : } App * App::Snapshot::unpack(Container * container) { - return new App(container, this); + return new (container->currentAppBuffer()) App(container, this); } App::Descriptor * App::Snapshot::descriptor() { diff --git a/apps/statistics/app.cpp b/apps/statistics/app.cpp index fd396fdaa..e674f7b9a 100644 --- a/apps/statistics/app.cpp +++ b/apps/statistics/app.cpp @@ -31,7 +31,7 @@ App::Snapshot::Snapshot() : } App * App::Snapshot::unpack(Container * container) { - return new App(container, this); + return new (container->currentAppBuffer()) App(container, this); } void App::Snapshot::reset() { diff --git a/apps/usb/app.cpp b/apps/usb/app.cpp index 0bfb343b2..7de9e909a 100644 --- a/apps/usb/app.cpp +++ b/apps/usb/app.cpp @@ -13,7 +13,7 @@ I18n::Message App::Descriptor::upperName() { } App * App::Snapshot::unpack(Container * container) { - return new App(container, this); + return new (container->currentAppBuffer()) App(container, this); } App::Descriptor * App::Snapshot::descriptor() {