mirror of
https://github.com/openharmony/ace_ace_engine.git
synced 2026-07-21 09:55:23 -04:00
each frontEnd use own pageIdPool
Signed-off-by: huzeqi <huzeqi@huawei.com> Change-Id: Ie2da4f7dd80023b5a5435124697e01023dc9846d
This commit is contained in:
@@ -687,8 +687,6 @@ void JsiDeclarativeEngineInstance::InitGroupJsBridge()
|
||||
}
|
||||
}
|
||||
|
||||
thread_local std::unordered_map<int32_t, panda::Global<panda::ObjectRef>> JsiDeclarativeEngineInstance::rootViewMap_;
|
||||
|
||||
void JsiDeclarativeEngineInstance::RootViewHandle(panda::Local<panda::ObjectRef> value)
|
||||
{
|
||||
LOGD("RootViewHandle");
|
||||
@@ -699,7 +697,18 @@ void JsiDeclarativeEngineInstance::RootViewHandle(panda::Local<panda::ObjectRef>
|
||||
LOGE("ark engine is null");
|
||||
return;
|
||||
}
|
||||
rootViewMap_.emplace(page->GetPageId(), panda::Global<panda::ObjectRef>(arkRuntime->GetEcmaVm(), value));
|
||||
auto engine = EngineHelper::GetCurrentEngine();
|
||||
auto jsiEngine = AceType::DynamicCast<JsiDeclarativeEngine>(engine);
|
||||
if (!jsiEngine) {
|
||||
LOGE("jsiEngine is null");
|
||||
return;
|
||||
}
|
||||
auto engineInstance = jsiEngine->GetEngineInstance();
|
||||
if (engineInstance == nullptr) {
|
||||
LOGE("engineInstance is nullptr");
|
||||
return;
|
||||
}
|
||||
engineInstance->SetRootView(page->GetPageId(), panda::Global<panda::ObjectRef>(arkRuntime->GetEcmaVm(), value));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -123,6 +123,11 @@ public:
|
||||
isDebugMode_ = isDebugMode;
|
||||
}
|
||||
|
||||
void SetRootView(int32_t pageId, panda::Global<panda::ObjectRef> value)
|
||||
{
|
||||
rootViewMap_.emplace(pageId, value);
|
||||
}
|
||||
|
||||
private:
|
||||
void InitGlobalObjectTemplate();
|
||||
void InitConsoleModule(); // add Console object to global
|
||||
@@ -133,7 +138,7 @@ private:
|
||||
void InitJsContextModuleObject();
|
||||
void InitGroupJsBridge();
|
||||
|
||||
static thread_local std::unordered_map<int32_t, panda::Global<panda::ObjectRef>> rootViewMap_;
|
||||
std::unordered_map<int32_t, panda::Global<panda::ObjectRef>> rootViewMap_;
|
||||
static std::unique_ptr<JsonValue> currentConfigResourceData_;
|
||||
static std::map<std::string, std::string> mediaResourceFileMap_;
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ constexpr int32_t INVALID_PAGE_ID = -1;
|
||||
constexpr int32_t MAX_ROUTER_STACK = 32;
|
||||
constexpr int32_t TOAST_TIME_MAX = 10000; // ms
|
||||
constexpr int32_t TOAST_TIME_DEFAULT = 1500; // ms
|
||||
constexpr int32_t MAX_PAGE_ID_SIZE = 1024;
|
||||
constexpr int32_t MAX_PAGE_ID_SIZE = sizeof(uint64_t) * 8;
|
||||
constexpr int32_t NANO_TO_MILLI = 1000000; // nanosecond to millisecond
|
||||
constexpr int32_t TO_MILLI = 1000; // second to millisecond
|
||||
constexpr int32_t CALLBACK_ERRORCODE_SUCCESS = 0;
|
||||
@@ -60,8 +60,6 @@ const char I18N_FILE_SUFFIX[] = "/properties/string.json";
|
||||
|
||||
} // namespace
|
||||
|
||||
std::atomic<uint64_t> FrontendDelegateDeclarative::pageIdPool_ = 0;
|
||||
|
||||
int32_t FrontendDelegateDeclarative::GenerateNextPageId()
|
||||
{
|
||||
for (int32_t idx = 0; idx < MAX_PAGE_ID_SIZE; ++idx) {
|
||||
@@ -130,9 +128,6 @@ FrontendDelegateDeclarative::~FrontendDelegateDeclarative()
|
||||
{
|
||||
CHECK_RUN_ON(JS);
|
||||
LOG_DESTROY();
|
||||
for (auto item = pageRouteStack_.begin(); item != pageRouteStack_.end(); ++item) {
|
||||
RecyclePageId(item->pageId);
|
||||
}
|
||||
}
|
||||
|
||||
int32_t FrontendDelegateDeclarative::GetMinPlatformVersion()
|
||||
|
||||
@@ -287,7 +287,7 @@ private:
|
||||
void ResetStagingPage();
|
||||
void FlushAnimationTasks();
|
||||
|
||||
static std::atomic<uint64_t> pageIdPool_;
|
||||
std::atomic<uint64_t> pageIdPool_;
|
||||
int32_t callbackCnt_ = 0;
|
||||
int32_t pageId_ = -1;
|
||||
bool isRouteStackFull_ = false;
|
||||
|
||||
Reference in New Issue
Block a user