Modularity: add infrastructure for very early initialization
This commit is contained in:
parent
56e2ae7257
commit
df63b08993
5 changed files with 17 additions and 3 deletions
|
@ -133,6 +133,14 @@ int AppShell::run(int argc, char** argv)
|
||||||
commandLine.apply();
|
commandLine.apply();
|
||||||
framework::IApplication::RunMode runMode = muapplication()->runMode();
|
framework::IApplication::RunMode runMode = muapplication()->runMode();
|
||||||
|
|
||||||
|
// ====================================================
|
||||||
|
// Setup modules: onPreInit
|
||||||
|
// ====================================================
|
||||||
|
globalModule.onPreInit(runMode);
|
||||||
|
for (mu::modularity::IModuleSetup* m : m_modules) {
|
||||||
|
m->onPreInit(runMode);
|
||||||
|
}
|
||||||
|
|
||||||
SplashScreen splashScreen;
|
SplashScreen splashScreen;
|
||||||
if (runMode == framework::IApplication::RunMode::Editor) {
|
if (runMode == framework::IApplication::RunMode::Editor) {
|
||||||
splashScreen.show();
|
splashScreen.show();
|
||||||
|
|
|
@ -68,7 +68,7 @@ void GlobalModule::registerExports()
|
||||||
ioc()->registerExport<ICryptographicHash>(moduleName(), new CryptographicHash());
|
ioc()->registerExport<ICryptographicHash>(moduleName(), new CryptographicHash());
|
||||||
}
|
}
|
||||||
|
|
||||||
void GlobalModule::onInit(const IApplication::RunMode& mode)
|
void GlobalModule::onPreInit(const IApplication::RunMode& mode)
|
||||||
{
|
{
|
||||||
mu::runtime::mainThreadId(); //! NOTE Needs only call
|
mu::runtime::mainThreadId(); //! NOTE Needs only call
|
||||||
mu::runtime::setThreadName("main");
|
mu::runtime::setThreadName("main");
|
||||||
|
|
|
@ -34,7 +34,7 @@ public:
|
||||||
|
|
||||||
std::string moduleName() const override;
|
std::string moduleName() const override;
|
||||||
void registerExports() override;
|
void registerExports() override;
|
||||||
void onInit(const IApplication::RunMode& mode) override;
|
void onPreInit(const IApplication::RunMode& mode) override;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,6 +41,7 @@ public:
|
||||||
virtual void registerResources() {}
|
virtual void registerResources() {}
|
||||||
virtual void registerUiTypes() {}
|
virtual void registerUiTypes() {}
|
||||||
|
|
||||||
|
virtual void onPreInit(const framework::IApplication::RunMode& mode) { (void)mode; }
|
||||||
virtual void onInit(const framework::IApplication::RunMode& mode) { (void)mode; }
|
virtual void onInit(const framework::IApplication::RunMode& mode) { (void)mode; }
|
||||||
virtual void onAllInited(const framework::IApplication::RunMode& mode) { (void)mode; }
|
virtual void onAllInited(const framework::IApplication::RunMode& mode) { (void)mode; }
|
||||||
virtual void onDelayedInit() {}
|
virtual void onDelayedInit() {}
|
||||||
|
|
|
@ -69,13 +69,18 @@ void Environment::setup()
|
||||||
m->resolveImports();
|
m->resolveImports();
|
||||||
}
|
}
|
||||||
|
|
||||||
globalModule.onInit(runMode);
|
globalModule.onPreInit(runMode);
|
||||||
//! NOTE Now we can use logger and profiler
|
//! NOTE Now we can use logger and profiler
|
||||||
|
|
||||||
|
for (mu::modularity::IModuleSetup* m : m_dependencyModules) {
|
||||||
|
m->onPreInit(runMode);
|
||||||
|
}
|
||||||
|
|
||||||
if (m_preInit) {
|
if (m_preInit) {
|
||||||
m_preInit();
|
m_preInit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
globalModule.onInit(runMode);
|
||||||
for (mu::modularity::IModuleSetup* m : m_dependencyModules) {
|
for (mu::modularity::IModuleSetup* m : m_dependencyModules) {
|
||||||
m->onInit(runMode);
|
m->onInit(runMode);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue