X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=NativeLauncher%2Flauncher%2Flib%2Fcore_runtime.cc;h=ee23fde3b1a1f301d98f8fe0e5cec0a3ae873bba;hb=4cd7db4adf5ede5acb3b0af94c0e1f953bf7da77;hp=eafb586e9d9b753c2634f82d653491b2063f70e5;hpb=876a0b45d4785c8351c9f3a1ef8da728614736ab;p=platform%2Fcore%2Fdotnet%2Flauncher.git diff --git a/NativeLauncher/launcher/lib/core_runtime.cc b/NativeLauncher/launcher/lib/core_runtime.cc index eafb586..ee23fde 100644 --- a/NativeLauncher/launcher/lib/core_runtime.cc +++ b/NativeLauncher/launcher/lib/core_runtime.cc @@ -154,36 +154,38 @@ 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"); + } + + if (getenv("XDG_VIDEOS_DIR") == NULL) { + setSpecialFolder(STORAGE_DIRECTORY_VIDEOS, "XDG_VIDEOS_DIR"); } } @@ -275,12 +277,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 +293,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, @@ -396,6 +402,11 @@ int CoreRuntime::initialize(const char* appType, LaunchMode launchMode) __pm->addNativeDllSearchingPaths(pluginNativePaths, true); } + char* pluginExtraDllPaths = pluginGetExtraDllPath(); + if (pluginExtraDllPaths && pluginExtraDllPaths[0] != '\0') { + __pm->setExtraDllPaths(pluginExtraDllPaths); + } + pluginHasLogControl(); std::string libCoreclr(concatPath(__pm->getRuntimePath(), "libcoreclr.so")); @@ -569,24 +580,31 @@ 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("Completed loading of profile data for the %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("Create the profile data for the %s", appId); } } free(localDataPath); } + if (exist(__pm->getAppRootPath() + "/bin/" + DISABLE_IPV6_FILE)) { + setSwitch("System.Net.DisableIPv6", true); + } + setSwitch("Switch.System.Diagnostics.StackTrace.ShowILOffsets", true); vconf_ignore_key_changed(VCONFKEY_LANGSET, langChangedCB);