[M108 Migration][WRTjs][VD] Optimize the policy of clear dead mount point 45/289645/3
authorzhaosy <shiyusy.zhao@samsung.com>
Mon, 13 Mar 2023 03:03:23 +0000 (11:03 +0800)
committerBot Blink <blinkbot@samsung.com>
Mon, 13 Mar 2023 05:16:48 +0000 (05:16 +0000)
1. The init value of "rtc/memory/WebApp/wrtloadercount" is -1;
and not all loop device is used by wrt, so define the timing
of checking dead mount is 6.

2. Not check mount path is exist or not, bcz WRT move this logic
to app process, if we check it, smack issue will happen.

Reference:
https://review.tizen.org/gerrit/288695/

Change-Id: Ia87b67a59553cc8a8cebe143f3b02849171d4a79
Signed-off-by: zhaosy <shiyusy.zhao@samsung.com>
wrt/src/browser/tv/mounter.cc
wrt/src/browser/tv/native_web_runtime_delegate_tv.cc

index 92d542f..ae774bf 100755 (executable)
@@ -69,6 +69,10 @@ int CountMountedLoopDevices() {
 namespace wrt {
 
 Mounter::~Mounter() {
+  if (!base::PathExists(base::FilePath(mount_path_))) {
+    LOG(ERROR) << "Mount point does not exist: [" << mount_path_ << "]";
+    return;
+  }
   PrivilegedService::GetInstance().Umount(mount_path_);
 }
 
@@ -178,19 +182,16 @@ bool PrivilegedService::Mknod() {
 }
 
 bool PrivilegedService::Umount(const std::string& mount_path) {
-  if (!PS_Umount)
+  if (!PS_Umount) {
+    LOG(ERROR) << "PS_Umount not ready, that " << mount_path;
     return false;
+  }
 
   if (mount_path.empty()) {
     LOG(INFO) << "Mount point is empty";
     return false;
   }
 
-  if (!base::PathExists(base::FilePath(mount_path))) {
-    LOG(ERROR) << "Mount point does not exist: [" << mount_path << "]";
-    return false;
-  }
-
   LOG(INFO) << "PS_Umount : " << mount_path;
   auto result = 0;
   auto ret_value = PS_Umount(mount_path.c_str(), mount_path.size(), 0, &result);
index b38861f..428e0a3 100644 (file)
@@ -39,6 +39,7 @@
 #include "net/ssl/ssl_cert_request_info.h"
 #include "net/ssl/ssl_platform_key_nss.h"
 #include "sandbox/linux/services/credentials.h"
+#include "shell/browser/browser.h"
 #include "tizen_src/chromium_impl/content/common/paths_efl.h"
 #if !defined(WRT_JS_BRINGUP)
 #include "tizen_src/chromium_impl/content/public/browser/certificates_utils.h"
@@ -225,6 +226,7 @@ std::vector<std::string> SearchDeadMount() {
       if (app_status == AUL_R_ERROR || app_status == AUL_R_EINVAL)
         dead_mount_path.push_back(mount_path);
 
+      LOG(INFO) << main_app_id << "is running(" << app_status << "), so skip";
       pkgmgrinfo_pkginfo_destroy_pkginfo(pkg_info);
     }
   }
@@ -459,7 +461,6 @@ bool NativeWebRuntimeDelegateTV::IsRunningAsBackground() {
 }
 
 void NativeWebRuntimeDelegateTV::HandleLowMemory() {
-#if !defined(WRT_JS_BRINGUP)
   if (electron::Browser::Get()->is_quitting()) {
     LOG(ERROR) << "app is quiting, just return";
     return;
@@ -473,7 +474,6 @@ void NativeWebRuntimeDelegateTV::HandleLowMemory() {
       NativeWebRuntime::GetInstance().RequestQuit();
     }
   }
-#endif
 }
 
 base::FilePath NativeWebRuntimeDelegateTV::GetTmgFilePath() {