Create separated candidate process to preload NUI (#245) accepted/tizen/unified/20200703.155019 submit/tizen/20200703.075955 submit/tizen_5.5/20200629.221218
author조웅석/Common Platform Lab(SR)/Principal Engineer/삼성전자 <ws77.cho@samsung.com>
Thu, 2 Jul 2020 02:33:16 +0000 (11:33 +0900)
committer이형주/Common Platform Lab(SR)/Staff Engineer/삼성전자 <leee.lee@samsung.com>
Thu, 2 Jul 2020 02:33:16 +0000 (11:33 +0900)
NUI cannot be preloaded with ElmSharp because those two UI related
module create window while preloading.

When multiple windows are created, it not only increases the memory usage,
but also affects the launching effect and splash screen.

So, create new candidate process for NUI

Assumption
  NUI app has their own apptype "dotnet-nui"
  There are two candidate process. One is for "ElmSharp" and The other is for "NUI"
  XSF is related to "ElmSharp"

Basic Operation
  Set extra value "TIZEN_UIFW" to bundle by loader script. (ElmSharp and NUI)
  Get extra value from bundle in the *__loader_create_cb function and set that to environment.
  Get environment in the preload() method in the Tizen.Runtime.cs
  Skip "ElmSharp" or "NUI" preloading by TIZEN_UIFW

Managed/Tizen.Runtime/Preloader.cs
NativeLauncher/CMakeLists.txt
NativeLauncher/dotnet-nui.debugger [new file with mode: 0644]
NativeLauncher/dotnet-nui.launcher [new file with mode: 0644]
NativeLauncher/dotnet-nui.loader [new file with mode: 0644]
NativeLauncher/dotnet.loader
NativeLauncher/launcher/exec/loader.cc
packaging/dotnet-launcher.spec

index 5a9f132..63a4a76 100644 (file)
@@ -52,6 +52,15 @@ namespace Tizen.Runtime
                 if (fileName.IndexOf('.') != 2)
                     continue;
 
+                string value = System.Environment.GetEnvironmentVariable("TIZEN_UIFW");
+                // if TIZEN_UIFW is not set, do not preload UI related dll
+                if (value == null && (fileName.Contains("NUI") || fileName.Contains("ElmSharp") || fileName.Contains("XSF") ))
+                    continue;
+                else if (value == "ElmSharp" && fileName.Contains("NUI"))
+                    continue;
+                else if (value == "NUI" && (fileName.Contains("ElmSharp") || fileName.Contains("XSF")))
+                    continue;
+
                 try
                 {
                     Console.WriteLine("Start preload : " + fileName);
index 1252576..17fb44f 100644 (file)
@@ -249,6 +249,9 @@ INSTALL(TARGETS ${PREFER_NUGET_CACHE_PLUGIN} DESTINATION ${INSTALL_MDPLUGIN_DIR}
 INSTALL(FILES dotnet.loader DESTINATION ${LOADERDIR})
 INSTALL(FILES dotnet.launcher DESTINATION ${LOADERDIR})
 INSTALL(FILES dotnet.debugger DESTINATION ${LOADERDIR})
+INSTALL(FILES dotnet-nui.loader DESTINATION ${LOADERDIR})
+INSTALL(FILES dotnet-nui.launcher DESTINATION ${LOADERDIR})
+INSTALL(FILES dotnet-nui.debugger DESTINATION ${LOADERDIR})
 INSTALL(FILES inc/coreclr_host.h DESTINATION ${INCLUDEDIR})
 INSTALL(FILES inc/dotnet_launcher_plugin.h DESTINATION ${INCLUDEDIR})
 INSTALL(FILES inc/ni_common.h DESTINATION ${INCLUDEDIR})
diff --git a/NativeLauncher/dotnet-nui.debugger b/NativeLauncher/dotnet-nui.debugger
new file mode 100644 (file)
index 0000000..cdff55c
--- /dev/null
@@ -0,0 +1,100 @@
+[DEBUGGER]
+NAME LLDB-SERVER
+EXE /home/owner/share/tmp/sdk_tools/lldb/bin/lldb-server
+APP_TYPE dotnet-nui
+EXTRA_KEY __DLP_DEBUG_ARG__
+EXTRA_ENV CORECLR_GDBJIT
+EXTRA_ENV COMPlus_ZapDisable
+
+[DEBUGGER]
+NAME LLDB-MI
+EXE /opt/usr/home/owner/share/tmp/sdk_tools/lldb/bin/lldb-mi
+APP_TYPE dotnet-nui
+EXTRA_KEY __DLP_ATTACH_ARG__
+ATTACH true
+
+[DEBUGGER]
+NAME NETCOREDBG
+EXE          /home/owner/share/tmp/sdk_tools/netcoredbg/netcoredbg
+APP_TYPE     dotnet-nui
+EXTRA_KEY    __DLP_DEBUG_ARG__
+
+[DEBUGGER]
+NAME HEAPTRACK
+EXE /home/owner/share/tmp/sdk_tools/profctl/profctl
+APP_TYPE dotnet-nui
+DEFAULT_OPT -v
+DEFAULT_OPT -p
+DEFAULT_OPT /home/owner/share/tmp/sdk_tools/heaptrack/heaptrack_fifo
+DEFAULT_OPT -w
+DEFAULT_OPT -e
+DEFAULT_OPT /home/owner/share/tmp/sdk_tools/heaptrack/heaptrack_interpret
+DEFAULT_OPT -o
+DEFAULT_OPT /home/owner/share/tmp/sdk_tools/profctl/profctl_heaptrack.log
+DEFAULT_OPT -E
+DEFAULT_OPT    DUMP_HEAPTRACK_OUTPUT=/home/owner/share/tmp/sdk_tools/heaptrack/heaptrack_fifo
+DEFAULT_OPT    CORECLR_PROFILER={C7BAD323-25F0-4C0B-B354-566390B215CA}
+DEFAULT_OPT    CORECLR_PROFILER_PATH=/home/owner/share/tmp/sdk_tools/heaptrack/libprofiler.so
+DEFAULT_OPT    CORECLR_ENABLE_PROFILING=1
+DEFAULT_OPT    COMPlus_LogEnable=1
+DEFAULT_OPT -c
+DEFAULT_OPT 6005
+DEFAULT_OPT -d
+DEFAULT_OPT 6006
+DEFAULT_OPT --
+
+[DEBUGGER]
+NAME COREPROFILER
+EXE /home/owner/share/tmp/sdk_tools/profctl/profctl
+APP_TYPE dotnet-nui
+DEFAULT_OPT -v
+DEFAULT_OPT -i
+DEFAULT_OPT -p
+DEFAULT_OPT /home/owner/share/tmp/sdk_tools/coreprofiler/trace.log
+DEFAULT_OPT -w
+DEFAULT_OPT -o
+DEFAULT_OPT /home/owner/share/tmp/sdk_tools/profctl/profctl_coreprofiler.log
+DEFAULT_OPT -E
+DEFAULT_OPT    CORECLR_PROFILER={101DA8FE-FDCA-4D0E-9712-7639CDE48EBA}
+DEFAULT_OPT    CORECLR_PROFILER_PATH=/home/owner/share/tmp/sdk_tools/coreprofiler/libcoreprof.so
+DEFAULT_OPT    PROF_TRACE_FILENAME=/home/owner/share/tmp/sdk_tools/coreprofiler/trace.log
+DEFAULT_OPT    PROF_CONFIG_FILENAME=/home/owner/share/tmp/sdk_tools/coreprofiler/profiler.config
+DEFAULT_OPT    CORECLR_ENABLE_PROFILING=1
+DEFAULT_OPT    COMPlus_EnableEventLog=1
+DEFAULT_OPT    COMPlus_ZapDisable=1
+DEFAULT_OPT -c
+DEFAULT_OPT 6001
+DEFAULT_OPT -d
+DEFAULT_OPT 6002
+DEFAULT_OPT -s
+DEFAULT_OPT 6003
+DEFAULT_OPT --
+
+[DEBUGGER]
+NAME LIVEPROFILER
+EXE /home/owner/share/tmp/sdk_tools/profctl/profctl
+APP_TYPE dotnet-nui
+DEFAULT_OPT -v
+DEFAULT_OPT -i
+DEFAULT_OPT -p
+DEFAULT_OPT /home/owner/share/tmp/sdk_tools/coreprofiler/trace.log
+DEFAULT_OPT -w
+DEFAULT_OPT -o
+DEFAULT_OPT /home/owner/share/tmp/sdk_tools/profctl/profctl_liveprofiler.log
+DEFAULT_OPT -E
+DEFAULT_OPT    CORECLR_PROFILER={101DA8FE-FDCA-4D0E-9712-7639CDE48EBA}
+DEFAULT_OPT    CORECLR_PROFILER_PATH=/home/owner/share/tmp/sdk_tools/coreprofiler/libcoreprof.so
+DEFAULT_OPT    PROF_TRACE_FILENAME=/home/owner/share/tmp/sdk_tools/coreprofiler/trace.log
+DEFAULT_OPT    PROF_CONFIG_FILENAME=/home/owner/share/tmp/sdk_tools/coreprofiler/profiler.config
+DEFAULT_OPT    CORECLR_ENABLE_PROFILING=1
+DEFAULT_OPT    COMPlus_EnableEventLog=1
+DEFAULT_OPT    COMPlus_ZapDisable=1
+DEFAULT_OPT -c
+DEFAULT_OPT 6001
+DEFAULT_OPT -d
+DEFAULT_OPT 6002
+DEFAULT_OPT -s
+DEFAULT_OPT 6003
+DEFAULT_OPT --
+DEFAULT_OPT /home/owner/share/tmp/sdk_tools/netcoredbg/netcoredbg
+EXTRA_KEY __DLP_DEBUG_ARG__
diff --git a/NativeLauncher/dotnet-nui.launcher b/NativeLauncher/dotnet-nui.launcher
new file mode 100644 (file)
index 0000000..6226c1d
--- /dev/null
@@ -0,0 +1,7 @@
+[LAUNCHER]
+NAME         dotnet-nui-launcher
+EXE          /usr/bin/dotnet-launcher
+APP_TYPE     dotnet-nui
+EXTRA_ARG    --PADDING_TO_CHANGE_CMDLINE_PADDING_TO_CHANGE_CMDLINE_PADDING_TO_CHANGE_CMDLINE_PADDING_TO_CHANGE_CMDLINE
+EXTRA_ARG    --standalone
+
diff --git a/NativeLauncher/dotnet-nui.loader b/NativeLauncher/dotnet-nui.loader
new file mode 100644 (file)
index 0000000..ac9f465
--- /dev/null
@@ -0,0 +1,9 @@
+[LOADER]
+NAME                   dotnet-nui-loader
+EXE                    /usr/bin/dotnet-loader
+APP_TYPE               dotnet-nui
+DETECTION_METHOD       TIMEOUT|DEMAND
+TIMEOUT                5000
+ON_BOOT                OFF
+HYDRA                  OFF
+EXTRA                  TIZEN_UIFW              NUI
index 6cc183f..94a3b37 100644 (file)
@@ -10,3 +10,4 @@ TIMEOUT                5000
 ON_BOOT                OFF
 HYDRA                  OFF
 EXTRA                  --appType                dotnet
+EXTRA                  TIZEN_UIFW              ElmSharp
index 0669593..7455008 100644 (file)
@@ -33,6 +33,7 @@
 using tizen::runtime::dotnetcore::CoreRuntime;
 
 static const char* KEY_APP_TYPE = "--appType";
+static const char* KEY_TIZEN_UIFW = "TIZEN_UIFW";
 
 static Ecore_Fd_Handler *__fd_handler;
 static loader_receiver_cb __receiver;
@@ -121,6 +122,22 @@ static void __loader_create_cb(bundle *extra, int type, void *user_data)
                appType = NULL;
        }
 
+       char *uifw = NULL;
+       char *cmdName = "dotnet-loader";
+
+       bundle_get_str(extra, KEY_TIZEN_UIFW, &uifw);
+       if (uifw != NULL) {
+               setenv(KEY_TIZEN_UIFW, uifw, 1);
+               _INFO("TIZEN_UIFW is set to %s", uifw);
+
+               if (strcmp(uifw, "NUI") == 0) {
+                       cmdName = "nui-loader";
+               }
+       }
+
+       setCmdName(cmdName);
+
+       // initialize CoreRuntime (launchmode, dlog redirection enable, root path NULL)
        if (CoreRuntime::initialize(appType ? appType : "dotnet", LaunchMode::loader) != 0) {
                _ERR("Failed to initialized");
        } else {
@@ -172,8 +189,6 @@ extern "C" int realMain(int argc, char *argv[])
                                                "/usr/bin/dotnet-loader");
        }
 
-       setCmdName("dotnet-loader");
-
        loader_lifecycle_callback_s callbacks = {
                .create = __loader_create_cb,
                .launch = __loader_launch_cb,
index fb2a67c..00ad53a 100644 (file)
@@ -165,6 +165,9 @@ chsmack -t -a User::App::Shared /opt/etc/skel/.dotnet
 %{_loaderdir}/dotnet.loader
 %{_loaderdir}/dotnet.launcher
 %{_loaderdir}/dotnet.debugger
+%{_loaderdir}/dotnet-nui.loader
+%{_loaderdir}/dotnet-nui.launcher
+%{_loaderdir}/dotnet-nui.debugger
 %{_native_lib_dir}/libsqlite3.so
 %{_bindir}/nitool
 %{_bindir}/tpatool