X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=NativeLauncher%2Flauncher%2Flib%2Fcore_runtime.cc;h=5f1be89cfe28738c050c6cb9a411acfbcf41e283;hb=841a169fddd9c86764e081fbe2c9e56eab583785;hp=959210278dfc2545f5cc8b0fbde3d7c798c7529e;hpb=bdd5de55938eef8c775a8d340cebbda783bf9ec6;p=platform%2Fcore%2Fdotnet%2Flauncher.git diff --git a/NativeLauncher/launcher/lib/core_runtime.cc b/NativeLauncher/launcher/lib/core_runtime.cc index 9592102..5f1be89 100644 --- a/NativeLauncher/launcher/lib/core_runtime.cc +++ b/NativeLauncher/launcher/lib/core_runtime.cc @@ -154,45 +154,39 @@ static bool storage_cb(int id, storage_type_e type, storage_state_e state, const return true; } -static void initEnvForSpecialFolder() +static void setSpecialFolder(storage_directory_e type, const char* key) { - int storageId; int error; - char *path = NULL; + char* path = NULL; + static int __storageId = -1; - error = storage_foreach_device_supported(storage_cb, &storageId); - if (error != STORAGE_ERROR_NONE) { - return; + if (__storageId < 0) { + error = storage_foreach_device_supported(storage_cb, &__storageId); + if (error != STORAGE_ERROR_NONE) { + return; + } } - error = storage_get_directory(storageId, STORAGE_DIRECTORY_IMAGES, &path); + error = storage_get_directory(__storageId, type, &path); if (error == STORAGE_ERROR_NONE && path != NULL) { - setenv("XDG_PICTURES_DIR", const_cast(path), 1); + setenv(key, const_cast(path), 1); free(path); - path = NULL; } +} - error = storage_get_directory(storageId, STORAGE_DIRECTORY_MUSIC, &path); - if (error == STORAGE_ERROR_NONE && path != NULL) { - setenv("XDG_MUSIC_DIR", const_cast(path), 1); - free(path); - path = NULL; +static void initEnvForSpecialFolder() +{ + if (getenv("XDG_PICTURES_DIR") == NULL) { + setSpecialFolder(STORAGE_DIRECTORY_IMAGES, "XDG_PICTURES_DIR"); } - error = storage_get_directory(storageId, STORAGE_DIRECTORY_VIDEOS, &path); - if (error == STORAGE_ERROR_NONE && path != NULL) { - setenv("XDG_VIDEOS_DIR", const_cast(path), 1); - free(path); - path = NULL; + if (getenv("XDG_MUSIC_DIR") == NULL) { + setSpecialFolder(STORAGE_DIRECTORY_MUSIC, "XDG_MUSIC_DIR"); } -} -// terminate candidate process when language changed -// icu related data (CultureInfo, etc) should be recreated. -static void langChangedCB(keynode_t *key, void* data) -{ - _INFO("terminiate candidate process to update language."); - exit(0); + if (getenv("XDG_VIDEOS_DIR") == NULL) { + setSpecialFolder(STORAGE_DIRECTORY_VIDEOS, "XDG_VIDEOS_DIR"); + } } static void setLang() @@ -275,12 +269,15 @@ void preload() bool initializeCoreClr(PathManager* pm, const std::string& tpa) { + bool ncdbStartupHook = isNCDBStartupHookProvided(); + const char *propertyKeys[] = { "TRUSTED_PLATFORM_ASSEMBLIES", "APP_PATHS", "APP_NI_PATHS", "NATIVE_DLL_SEARCH_DIRECTORIES", - "AppDomainCompatSwitch" + "AppDomainCompatSwitch", + ncdbStartupHook ? "STARTUP_HOOKS" : "" // must be the last one }; const char *propertyValues[] = { @@ -288,14 +285,15 @@ bool initializeCoreClr(PathManager* pm, const std::string& tpa) pm->getAppPaths().c_str(), pm->getAppNIPaths().c_str(), pm->getNativeDllSearchingPaths().c_str(), - "UseLatestBehaviorWhenTFMNotSpecified" + "UseLatestBehaviorWhenTFMNotSpecified", + ncdbStartupHook ? getNCDBStartupHook() : "" // must be the last one }; std::string selfPath = readSelfPath(); int st = initializeClr(selfPath.c_str(), "TizenDotnetApp", - sizeof(propertyKeys) / sizeof(propertyKeys[0]), + sizeof(propertyKeys) / sizeof(propertyKeys[0]) - (ncdbStartupHook ? 0 : 1), propertyKeys, propertyValues, &__hostHandle, @@ -338,6 +336,7 @@ int CoreRuntime::initialize(const char* appType, LaunchMode launchMode) // So, plugin initialize should be called before creating threads. if (initializePluginManager(appType) < 0) { _ERR("Failed to initialize PluginManager"); + return -1; } // checkInjection checks dotnet-launcher run mode @@ -376,9 +375,6 @@ int CoreRuntime::initialize(const char* appType, LaunchMode launchMode) // Disable config cache to set environment after coreclr_initialize() putenv(const_cast("COMPlus_DisableConfigCache=1")); - // Disable IPv6 to solve Dual Mode issue (temporal patch) - putenv(const_cast("DOTNET_SYSTEM_NET_DISABLEIPV6=1")); - // read string from external file and set them to environment value. setEnvFromFile(); @@ -471,9 +467,6 @@ int CoreRuntime::initialize(const char* appType, LaunchMode launchMode) } if (launchMode == LaunchMode::loader) { - // terminate candidate process if language is changed. - // CurrentCulture created for preloaded dlls should be updated. - vconf_notify_key_changed(VCONFKEY_LANGSET, langChangedCB, NULL); // preload libraries and manage dlls for optimizing startup time preload(); @@ -577,27 +570,32 @@ int CoreRuntime::launch(const char* appId, const char* root, const char* path, i setEnvironmentVariable("COMPlus_MultiCoreJitProfile", multiCoreJitProfile); setEnvironmentVariable("COMPlus_MultiCoreJitMinNumCpus", "1"); - // stop profiling and write collected data after delay if env value is set. - char *env = getenv("CLR_MCJ_PROFILE_WRITE_DELAY"); - if (env != nullptr) { - int delay = std::atoi(env); - // To avoid undefined behavior by out-of-range input(atoi), set max delay value to 100. - if (delay > 0) { - if (delay > MAX_DELAY_SEC) delay = MAX_DELAY_SEC; - stopProfileAfterDelay(delay); - } - } - if (exist(multiCoreJitProfile)) { setEnvironmentVariable("COMPlus_MultiCoreJitNoProfileGather", "1"); + _INFO("MCJ playing start for %s", appId); + } else { + setEnvironmentVariable("COMPlus_MultiCoreJitNoProfileGather", "0"); + // stop profiling and write collected data after delay if env value is set. + char *env = getenv("CLR_MCJ_PROFILE_WRITE_DELAY"); + if (env != nullptr) { + int delay = std::atoi(env); + // To avoid undefined behavior by out-of-range input(atoi), set max delay value to 100. + if (delay > 0) { + if (delay > MAX_DELAY_SEC) delay = MAX_DELAY_SEC; + stopProfileAfterDelay(delay); + } + } + _INFO("MCJ recording start for %s", appId); } } free(localDataPath); } - setSwitch("Switch.System.Diagnostics.StackTrace.ShowILOffsets", true); + if (exist(__pm->getAppRootPath() + "/bin/" + DISABLE_IPV6_FILE)) { + setSwitch("System.Net.DisableIPv6", true); + } - vconf_ignore_key_changed(VCONFKEY_LANGSET, langChangedCB); + setSwitch("Switch.System.Diagnostics.StackTrace.ShowILOffsets", true); pluginBeforeExecute();