mirror of
https://github.com/openharmony/ace_engine_lite.git
synced 2026-07-19 13:31:06 -04:00
!294 【挑单】2.2-Beta-支持加载框架外的系统内置module(不需import)
Merge pull request !294 from piggyguy_jdx/2.2-Beta-support-extra-preset-modules-loading
This commit is contained in:
@@ -86,6 +86,14 @@ enum TEDispatchingResult : uint8_t {
|
||||
ACCEPT_FAILED, // on forground, but TE event can not be received, vsync should be retried to send to ACE again
|
||||
};
|
||||
|
||||
/**
|
||||
* The wrapper data structure for get native memory pool info.
|
||||
*/
|
||||
struct ExtraPresetModulesHook {
|
||||
VoidFuncHook loadingHandler;
|
||||
VoidFuncHook unloadingHandler;
|
||||
};
|
||||
|
||||
/**
|
||||
* The wrapper class for some product feature implementation, since some interfaces are provided by specific product.
|
||||
*/
|
||||
@@ -111,6 +119,7 @@ public:
|
||||
static void SetDefaultFontStyle(const char *defaultFontFamily, uint8_t defaultFontSize);
|
||||
static void SetScreenSize(uint16_t width, uint16_t height);
|
||||
static void RegSetScreenOnVisibleHandler(SetScreenOnVisibleHandler handler);
|
||||
static void RegExtraPresetModulesHook(ExtraPresetModulesHook hook);
|
||||
|
||||
// wrapper functions, for ace internal calling
|
||||
static void PrintEventTrace(uint8_t info2, uint8_t info3, uint8_t info4);
|
||||
@@ -126,6 +135,8 @@ public:
|
||||
static void UpdateRenderTickAcceptable(bool acceptable);
|
||||
static void GetScreenSize(uint16_t &width, uint16_t &height);
|
||||
static bool SetScreenOnVisible(bool visible);
|
||||
static void LoadExtraPresetModules();
|
||||
static void UnloadExtraPresetModules();
|
||||
};
|
||||
} // namespace ACELite
|
||||
} // namespace OHOS
|
||||
|
||||
@@ -52,6 +52,7 @@ static DFXWrapper g_dfxWrapper;
|
||||
static TEHandlingHooks g_teHandlingHooks = {nullptr, nullptr};
|
||||
static TerminateAbilityHandler g_termiantingHandler = nullptr;
|
||||
static SetScreenOnVisibleHandler g_setScreenOnHandler = nullptr;
|
||||
static ExtraPresetModulesHook g_extraPresetModulesHooks = {nullptr, nullptr};
|
||||
// default font styles
|
||||
static char *g_defaultFontFamilyName = nullptr;
|
||||
static uint8_t g_defaultFontSize = 30;
|
||||
@@ -232,5 +233,25 @@ bool ProductAdapter::SetScreenOnVisible(bool visible)
|
||||
{
|
||||
return (g_setScreenOnHandler != nullptr) ? g_setScreenOnHandler(visible) : false;
|
||||
}
|
||||
|
||||
void ProductAdapter::RegExtraPresetModulesHook(ExtraPresetModulesHook hook)
|
||||
{
|
||||
g_extraPresetModulesHooks.loadingHandler = hook.loadingHandler;
|
||||
g_extraPresetModulesHooks.unloadingHandler = hook.unloadingHandler;
|
||||
}
|
||||
|
||||
void ProductAdapter::LoadExtraPresetModules()
|
||||
{
|
||||
if (g_extraPresetModulesHooks.loadingHandler != nullptr) {
|
||||
g_extraPresetModulesHooks.loadingHandler();
|
||||
}
|
||||
}
|
||||
|
||||
void ProductAdapter::UnloadExtraPresetModules()
|
||||
{
|
||||
if (g_extraPresetModulesHooks.unloadingHandler != nullptr) {
|
||||
g_extraPresetModulesHooks.unloadingHandler();
|
||||
}
|
||||
}
|
||||
} // namespace ACELite
|
||||
} // namespace OHOS
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
#include "presets/require_module.h"
|
||||
#include "presets/timer_module.h"
|
||||
#include "presets/version_module.h"
|
||||
#include "product_adapter.h"
|
||||
#ifdef JS_ENGINE_STATIC_MULTI_CONTEXTS_ENABLED
|
||||
extern "C" {
|
||||
#include "generate-bytecode.h"
|
||||
@@ -79,6 +80,7 @@ void JsAppEnvironment::InitJsFramework() const
|
||||
#endif // JSFWK_TEST
|
||||
AsyncTaskManager::GetInstance().Init();
|
||||
LoadAceBuiltInModules();
|
||||
ProductAdapter::LoadExtraPresetModules();
|
||||
LoadFramework();
|
||||
LocalModule::Load();
|
||||
STOP_TRACING();
|
||||
@@ -116,6 +118,7 @@ void JsAppEnvironment::Cleanup()
|
||||
{
|
||||
Debugger::GetInstance().TearDownDebugger();
|
||||
FeaAbilityModule::Release();
|
||||
ProductAdapter::UnloadExtraPresetModules();
|
||||
|
||||
// clean up engine, NOTE: all JS value must be released properly befor cleanup
|
||||
jerry_cleanup();
|
||||
|
||||
Reference in New Issue
Block a user