Feat: runtime profile override with getenv 85/306785/3
authorLeonid <l.sawin@samsung.com>
Tue, 27 Feb 2024 12:05:39 +0000 (13:05 +0100)
committerDae-Hyun Ko <dhyuna.ko@samsung.com>
Wed, 13 Mar 2024 00:50:28 +0000 (00:50 +0000)
Rebasing previous change 301607 from tizen.riscv

Change-Id: I411fa84ced46e5220c59e7b43e3bd7a840044dde
Signed-off-by: Leonid <l.sawin@samsung.com>
tizen_src/chromium_impl/tizen/system_info.cc
tizen_src/chromium_impl/tizen/system_info.h

index 07392b2..30223cd 100644 (file)
 
 #if BUILDFLAG(IS_TIZEN)
 #include <system_info.h>
+#if defined(ARCH_CPU_RISCV_FAMILY)
+#include <cstring>
+#define PROFILE_ENV_STRING "CHROMIUM_PROFILE"
+#endif
 #endif
 
 
@@ -24,11 +28,22 @@ void GetProfile(void) {
 #if BUILDFLAG(IS_TIZEN)
   char *profileName;
   system_info_get_platform_string("http://tizen.org/feature/profile", &profileName);
+#if defined(ARCH_CPU_RISCV_FAMILY)
+  if (const char* env_profile = std::getenv(PROFILE_ENV_STRING))
+  {
+    free(profileName);
+    profileName = strdup(env_profile);
+  }
+#endif
   switch (*profileName) {
   case 'm':
   case 'M':
     g_profile__ = PROFILE_MOBILE;
     break;
+  case 'd':
+  case 'D':
+    g_profile__ = PROFILE_DESKTOP;
+    break;
   case 'w':
   case 'W':
     g_profile__ = PROFILE_WEARABLE;
@@ -98,6 +113,12 @@ void GetArch(void) {
   else if (strncmp(archName, "x86_64", archNamelen) == 0) {
     g_arch__ = ARCH_X86_64;
   }
+  else if (strncmp(archName, "rv32", archNamelen) == 0) {
+    g_arch__ = ARCH_RV32;
+  }
+  else if (strncmp(archName, "rv64", archNamelen) == 0) {
+    g_arch__ = ARCH_RV64;
+  }
   else {
     g_arch__ = ARCH_UNKNOWN;
   }
index e6e17e7..540d64d 100644 (file)
@@ -30,7 +30,9 @@ typedef enum {
     ARCH_ARMV7   = 1 << 2,
     ARCH_AARCH64 = 1 << 3,
     ARCH_X86     = 1 << 4,
-    ARCH_X86_64  = 1 << 5
+    ARCH_X86_64  = 1 << 5,
+    ARCH_RV32    = 1 << 6,
+    ARCH_RV64    = 1 << 7,
 } Arch_Inform;
 
 #ifdef __cplusplus