recycle pageId when frontEnd destroy

Signed-off-by: huzeqi <huzeqi@huawei.com>
Change-Id: I0a93f9c0a14611e328628540ba7a091e6edff8a4
This commit is contained in:
huzeqi
2022-03-22 19:44:14 +08:00
parent 3af2a0203d
commit 0f4ad0e4e4
@@ -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 = sizeof(uint64_t) * 8;
constexpr int32_t MAX_PAGE_ID_SIZE = 1024;
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;
@@ -130,6 +130,9 @@ FrontendDelegateDeclarative::~FrontendDelegateDeclarative()
{
CHECK_RUN_ON(JS);
LOG_DESTROY();
for (auto item = pageRouteStack_.begin(); item != pageRouteStack_.end(); ++item) {
RecyclePageId(item->pageId);
}
}
int32_t FrontendDelegateDeclarative::GetMinPlatformVersion()
@@ -1761,7 +1764,7 @@ void FrontendDelegateDeclarative::LoadReplacePage(int32_t pageId, const PageTarg
pageParamMap_[pageId] = params;
}
auto url = target.url;
LOGD("FrontendDelegateDeclarative LoadReplacePage[%{private}d]: %{private}s.", pageId, url.c_str());
LOGI("FrontendDelegateDeclarative LoadReplacePage[%{private}d]: %{private}s.", pageId, url.c_str());
if (pageId == INVALID_PAGE_ID) {
LOGW("FrontendDelegateDeclarative, invalid page id");
EventReport::SendPageRouterException(PageRouterExcepType::REPLACE_PAGE_ERR, url);