diff --git a/frameworks/native/appkit/app/main_thread.cpp b/frameworks/native/appkit/app/main_thread.cpp index 529647299a7fa4666346e3a0de5cb9219fc67377..bc01de4c71ea47eb315485312238d1e8b85adc4b 100644 --- a/frameworks/native/appkit/app/main_thread.cpp +++ b/frameworks/native/appkit/app/main_thread.cpp @@ -1844,11 +1844,6 @@ void MainThread::HandleLaunchApplication(const AppLaunchData &appLaunchData, con TAG_LOGE(AAFwkTag::APPKIT, "null pAppEvnIml"); } -#if defined(NWEB) - if (!isSystemApp) { - PreLoadWebLib(); - } -#endif #if defined(NWEB) && defined(NWEB_GRAPHIC) if (appLaunchData.IsAllowedNWebPreload()) { HandleNWebPreload(); @@ -1859,45 +1854,6 @@ void MainThread::HandleLaunchApplication(const AppLaunchData &appLaunchData, con } } -#if defined(NWEB) -void MainThread::PreLoadWebLib() -{ - auto task = [this]() { - std::weak_ptr weakApp = application_; - std::thread([weakApp] { - auto app = weakApp.lock(); - if (app == nullptr) { - TAG_LOGW(AAFwkTag::APPKIT, "null app"); - return; - } - - if (prctl(PR_SET_NAME, "preStartNWeb") < 0) { - TAG_LOGW(AAFwkTag::APPKIT, "Set thread name failed with %{public}d", errno); - } - - std::string nwebPath = app->GetAppContext()->GetCacheDir() + WEB_CACHE_DIR; - struct stat file_stat; - if (stat(nwebPath.c_str(), &file_stat) == -1) { - TAG_LOGW(AAFwkTag::APPKIT, "can not get file_stat"); - return; - } - - time_t current_time = time(nullptr); - double time_difference = difftime(current_time, file_stat.st_mtime); - if (time_difference > CACHE_EFFECTIVE_RANGE) { - TAG_LOGW(AAFwkTag::APPKIT, "web page started more than %{public}d seconds", CACHE_EFFECTIVE_RANGE); - return; - } - - bool isFirstStartUpWeb = (access(nwebPath.c_str(), F_OK) != 0); - TAG_LOGD(AAFwkTag::APPKIT, "TryPreReadLib pre dlopen web so"); - OHOS::NWeb::NWebHelper::TryPreReadLib(isFirstStartUpWeb, app->GetAppContext()->GetBundleCodeDir()); - }).detach(); - }; - mainHandler_->PostTask(task, "MainThread::NWEB_PRELOAD_SO", PRELOAD_DELAY_TIME); -} -#endif - #if defined(NWEB) && defined(NWEB_GRAPHIC) void MainThread::HandleNWebPreload() { diff --git a/interfaces/kits/native/appkit/app/main_thread.h b/interfaces/kits/native/appkit/app/main_thread.h index 773da48fc7c920b11be7848f221d5a3066481133..74c3fea9c20cdac960491893904fe417821043e2 100644 --- a/interfaces/kits/native/appkit/app/main_thread.h +++ b/interfaces/kits/native/appkit/app/main_thread.h @@ -658,10 +658,6 @@ private: void HandleNWebPreload(); #endif -#if defined(NWEB) - void PreLoadWebLib(); -#endif - class MainHandler : public EventHandler { public: MainHandler(const std::shared_ptr &runner, const sptr &thread);