[Tizen] Support web engine selection using environment variable 37/190637/3 accepted/tizen/5.0/unified/20181102.022712 accepted/tizen/unified/20181005.012328 submit/tizen/20181004.100218 submit/tizen/20181004.103602 submit/tizen_5.0/20181101.000005
authorJiyun Yang <ji.yang@samsung.com>
Thu, 4 Oct 2018 09:01:32 +0000 (18:01 +0900)
committerJiyun Yang <ji.yang@samsung.com>
Thu, 4 Oct 2018 09:35:01 +0000 (18:35 +0900)
Change-Id: I6e622d8e0c088e200e7fc6d4a01dc30fa79567ef
Signed-off-by: Jiyun Yang <ji.yang@samsung.com>
dali/internal/web-engine/common/web-engine-impl.cpp

index 988462d..0ef38d3 100644 (file)
 #include <dali/integration-api/debug.h>
 #include <dali/public-api/adaptor-framework/native-image-source.h>
 #include <dali/public-api/object/type-registry.h>
+#include <string.h>
+
+// INTERNAL INCLUDES
+#include <dali/devel-api/adaptor-framework/environment-variable.h>
 
 namespace Dali
 {
@@ -36,7 +40,14 @@ namespace Adaptor
 namespace // unnamed namespace
 {
 
+#define DALI_ENV_WEB_ENGINE_NAME "DALI_WEB_ENGINE_NAME"
+
+const char* WEB_ENGINE_CHROMIUM_NAME( "chromium" );
+const char* WEB_ENGINE_LITE_NAME( "lightweight" );
+
 const char* WEB_ENGINE_PLUGIN_SO( "libdali-web-engine-plugin.so" );
+const char* WEB_ENGINE_CHROMIUM_PLUGIN_SO( "libdali-web-engine-chromium-plugin.so" );
+const char* WEB_ENGINE_LITE_PLUGIN_SO( "libdali-web-engine-lite-plugin.so" );
 
 Dali::BaseHandle Create()
 {
@@ -88,7 +99,22 @@ bool WebEngine::Initialize()
 {
   char* error = NULL;
 
-  mHandle = dlopen( WEB_ENGINE_PLUGIN_SO, RTLD_LAZY );
+  const char* engineName = WEB_ENGINE_PLUGIN_SO;
+  const char* engineEnvName = EnvironmentVariable::GetEnvironmentVariable( DALI_ENV_WEB_ENGINE_NAME );
+
+  if ( engineEnvName )
+  {
+    if( 0 == strcmp( engineEnvName, WEB_ENGINE_CHROMIUM_NAME ) )
+    {
+      engineName = WEB_ENGINE_CHROMIUM_PLUGIN_SO;
+    }
+    else if( 0 == strcmp( engineEnvName, WEB_ENGINE_LITE_NAME ) )
+    {
+      engineName = WEB_ENGINE_LITE_PLUGIN_SO;
+    }
+  }
+
+  mHandle = dlopen( engineName, RTLD_LAZY );
 
   error = dlerror();
   if( mHandle == NULL || error != NULL )