[Tizen] Add codes for Dali Windows Backend
[platform/core/uifw/dali-adaptor.git] / dali / internal / system / common / singleton-service-impl.cpp
old mode 100644 (file)
new mode 100755 (executable)
index 57ff83c..cb7830b
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -20,6 +20,9 @@
 
 // EXTERNAL INCLUDES
 #include <dali/integration-api/debug.h>
+#include <dali/integration-api/core.h>
+#include <dali/integration-api/adaptor.h>
+#include <dali/internal/adaptor/common/adaptor-impl.h>
 
 // INTERNAL INCLUDES
 #if defined(DEBUG_ENABLED)
@@ -30,12 +33,11 @@ Debug::Filter* gSingletonServiceLogFilter = Debug::Filter::New( Debug::NoLogging
 #define DALI_LOG_SINGLETON_SERVICE_DIRECT(level, message)                        \
     if(gSingletonServiceLogFilter && gSingletonServiceLogFilter->IsEnabledFor(level)) { std::string string(message); Dali::TizenPlatform::LogMessage( Debug::DebugInfo, string );  }
 
-#define DALI_LOG_SINGLETON_SERVICE(level, format, args...) DALI_LOG_INFO(gSingletonServiceLogFilter, level, format, ## args )
-
+#define DALI_LOG_SINGLETON_SERVICE(level, format, ...) DALI_LOG_INFO(gSingletonServiceLogFilter, level, format, ## __VA_ARGS__ )
 #else
 
 #define DALI_LOG_SINGLETON_SERVICE_DIRECT(level, message)
-#define DALI_LOG_SINGLETON_SERVICE(level, format, args...)
+#define DALI_LOG_SINGLETON_SERVICE(level, format, ...)
 
 #endif
 
@@ -75,6 +77,15 @@ void SingletonService::Register( const std::type_info& info, BaseHandle singleto
   {
     DALI_LOG_SINGLETON_SERVICE( Debug::General, "Singleton Added: %s\n", info.name() );
     mSingletonContainer.push_back( SingletonPair( info.name(), singleton ) );
+
+    Integration::Processor* processor = dynamic_cast<Integration::Processor*>( &singleton.GetBaseObject() );
+    if( processor )
+    {
+      Dali::Adaptor& adaptor = Dali::Adaptor::Get();
+      Dali::Internal::Adaptor::Adaptor& adaptorImpl = Adaptor::GetImplementation( adaptor );
+      Integration::Core& core = adaptorImpl.GetCore();
+      core.RegisterProcessor( *processor );
+    }
   }
 }
 
@@ -123,4 +134,3 @@ SingletonService::~SingletonService()
 } // namespace Internal
 
 } // namespace Dali
-