From: Paul Wisbey Date: Mon, 17 Feb 2020 17:34:25 +0000 (+0000) Subject: Moved SingletonService into dali-core X-Git-Tag: dali_1.9.1~1^2 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git;a=commitdiff_plain;h=aae144428d03c9e315384225ad33c057b42ea408 Moved SingletonService into dali-core Change-Id: Id4b95d15c2a499e2e0f42bd6a697d9767397e286 --- diff --git a/automated-tests/src/dali-adaptor-internal/utc-Dali-Lifecycle-Controller.cpp b/automated-tests/src/dali-adaptor-internal/utc-Dali-Lifecycle-Controller.cpp index 3a2c8d2..6511f3b 100644 --- a/automated-tests/src/dali-adaptor-internal/utc-Dali-Lifecycle-Controller.cpp +++ b/automated-tests/src/dali-adaptor-internal/utc-Dali-Lifecycle-Controller.cpp @@ -91,6 +91,7 @@ int UtcDaliLifecycleControllerGet(void) lifecycleController = LifecycleController::Get(); DALI_TEST_CHECK( !lifecycleController ); + TestApplication app; Application application = Application::New(); lifecycleController = LifecycleController::Get(); @@ -101,6 +102,7 @@ int UtcDaliLifecycleControllerGet(void) int UtcDaliLifecycleControllerSignalInit(void) { + TestApplication app; Application application = Application::New(); DALI_TEST_CHECK( !g_OnInitCalled ); @@ -118,6 +120,7 @@ int UtcDaliLifecycleControllerSignalInit(void) int UtcDaliLifecycleControllerSignalTerminate(void) { + TestApplication app; Application application = Application::New(); DALI_TEST_CHECK( !g_OnTerminateCalled ); @@ -135,6 +138,7 @@ int UtcDaliLifecycleControllerSignalTerminate(void) int UtcDaliLifecycleControllerSignalPause(void) { + TestApplication app; Application application = Application::New(); DALI_TEST_CHECK( !g_OnPauseCalled ); @@ -152,6 +156,7 @@ int UtcDaliLifecycleControllerSignalPause(void) int UtcDaliLifecycleControllerSignalResume(void) { + TestApplication app; Application application = Application::New(); DALI_TEST_CHECK( !g_OnResumeCalled ); @@ -169,6 +174,7 @@ int UtcDaliLifecycleControllerSignalResume(void) int UtcDaliLifecycleControllerSignalReset(void) { + TestApplication app; Application application = Application::New(); DALI_TEST_CHECK( !g_OnResetCalled ); @@ -186,6 +192,7 @@ int UtcDaliLifecycleControllerSignalReset(void) int UtcDaliLifecycleControllerSignalResize(void) { + TestApplication app; Application application = Application::New(); DALI_TEST_CHECK( !g_OnResizeCalled ); @@ -203,6 +210,7 @@ int UtcDaliLifecycleControllerSignalResize(void) int UtcDaliLifecycleControllerSignalLanguageChanged(void) { + TestApplication app; Application application = Application::New(); DALI_TEST_CHECK( !g_OnLanguageChangedCalled ); diff --git a/automated-tests/src/dali-adaptor/CMakeLists.txt b/automated-tests/src/dali-adaptor/CMakeLists.txt index d7414fb..6545723 100644 --- a/automated-tests/src/dali-adaptor/CMakeLists.txt +++ b/automated-tests/src/dali-adaptor/CMakeLists.txt @@ -12,7 +12,6 @@ SET(TC_SOURCES utc-Dali-Key.cpp utc-Dali-NativeImageSource.cpp utc-Dali-PixelBuffer.cpp - utc-Dali-SingletonService.cpp utc-Dali-Timer.cpp utc-Dali-TtsPlayer.cpp utc-Dali-Window.cpp diff --git a/automated-tests/src/dali-adaptor/utc-Dali-SingletonService.cpp b/automated-tests/src/dali-adaptor/utc-Dali-SingletonService.cpp deleted file mode 100644 index 2ceb1f0..0000000 --- a/automated-tests/src/dali-adaptor/utc-Dali-SingletonService.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (c) 2014 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. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// EXTERNAL INCLUDES -#include -#include -#include -#include -#include - -using namespace Dali; - -namespace -{ - -class TestHandle : public BaseHandle -{ -public: - TestHandle() {} - TestHandle( BaseObject* object ) : BaseHandle( object ) {} -}; - -class TestObject : public BaseObject -{ -}; - -} // unnamed namespace - -void utc_dali_singleton_service_startup(void) -{ - test_return_value = TET_UNDEF; -} - -void utc_dali_singleton_service_cleanup(void) -{ - test_return_value = TET_PASS; -} - -int UtcDaliSingletonServiceGet(void) -{ - // Attempt to retrieve SingletonService before creating application - SingletonService singletonService; - singletonService = SingletonService::Get(); - DALI_TEST_CHECK( !singletonService ); - - // Create Application class, should be able to retrieve SingletonService now - Application application = Application::New(); - singletonService = SingletonService::Get(); - DALI_TEST_CHECK( singletonService ); - - END_TEST; -} - -int UtcDaliSingletonServiceRegisterAndGetSingleton(void) -{ - Application application = Application::New(); - SingletonService singletonService( SingletonService::Get() ); - - // Attempt to register an empty handle - TestHandle handle; - singletonService.Register( typeid( handle ), handle ); - DALI_TEST_CHECK( !singletonService.GetSingleton( typeid( handle ) ) ); - - // Create an actor instance and retrieve, should be valid this time - handle = TestHandle( new TestObject ); - singletonService.Register( typeid( handle ), handle ); - DALI_TEST_CHECK( singletonService.GetSingleton( typeid( handle ) ) ); - - END_TEST; -} diff --git a/dali/devel-api/adaptor-framework/singleton-service.cpp b/dali/devel-api/adaptor-framework/singleton-service.cpp deleted file mode 100644 index ca1b3a9..0000000 --- a/dali/devel-api/adaptor-framework/singleton-service.cpp +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2015 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. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// CLASS HEADER -#include - -// INTERNAL INCLUDES -#include - -namespace Dali -{ - -SingletonService::SingletonService() -{ -} - -SingletonService SingletonService::New() -{ - return Internal::Adaptor::SingletonService::New(); -} - -SingletonService SingletonService::Get() -{ - return Internal::Adaptor::SingletonService::Get(); -} - -SingletonService::~SingletonService() -{ -} - -void SingletonService::Register( const std::type_info& info, BaseHandle singleton ) -{ - GetImplementation( *this ).Register( info, singleton ); -} - -void SingletonService::UnregisterAll() -{ - GetImplementation( *this ).UnregisterAll(); -} - -BaseHandle SingletonService::GetSingleton( const std::type_info& info ) const -{ - return GetImplementation( *this ).GetSingleton( info ); -} - -SingletonService::SingletonService( Internal::Adaptor::SingletonService* singletonService ) -: BaseHandle( singletonService ) -{ -} - -} // namespace Dali diff --git a/dali/devel-api/adaptor-framework/singleton-service.h b/dali/devel-api/adaptor-framework/singleton-service.h deleted file mode 100755 index 7df5fc7..0000000 --- a/dali/devel-api/adaptor-framework/singleton-service.h +++ /dev/null @@ -1,117 +0,0 @@ -#ifndef DALI_SINGELTON_SERVICE_H -#define DALI_SINGELTON_SERVICE_H - -/* - * Copyright (c) 2019 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. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// EXTERNAL INCLUDES -#include -#include - -// INTERNAL INCLUDES -#include - -namespace Dali -{ - -namespace Internal DALI_INTERNAL -{ -namespace Adaptor -{ -class SingletonService; -} -} - -/** - * @brief Allows the registration of a class as a singleton - * - * @note This class is created by the Application class and is destroyed when the Application class is destroyed. - * - * @see Application - */ -class DALI_ADAPTOR_API SingletonService : public BaseHandle -{ -public: - - /** - * @brief Create an uninitialized handle. - * - * This can be initialized by calling SingletonService::Get(). - */ - SingletonService(); - - /** - * Create a SingletonService. - * This should only be called once by the Application class. - * @return A newly created SingletonService. - */ - static Dali::SingletonService New(); - - /** - * @brief Retrieves a handle to the SingletonService. - * - * @return A handle to the SingletonService if it is available. This will be an empty handle if - * the service is not available. - */ - static SingletonService Get(); - - /** - * @brief Destructor - * - * This is non-virtual since derived Handle types must not contain data or virtual methods. - */ - ~SingletonService(); - - /** - * @brief Registers the singleton of Dali handle with its type info. - * - * The singleton will be kept alive for the lifetime of the service. - * - * @note This is not intended for application developers. - * @param[in] info The type info of the Dali handle generated by the compiler. - * @param[in] singleton The Dali handle to be registered - */ - void Register( const std::type_info& info, BaseHandle singleton ); - - /** - * @brief Unregisters all singletons. - * - * @note This is not intended for application developers. - */ - void UnregisterAll(); - - /** - * @brief Gets the singleton for the given type. - * - * @note This is not intended for application developers. - * @param[in] info The type info of the given type. - * @return the Dali handle if it is registered as a singleton or an uninitialized handle. - */ - BaseHandle GetSingleton( const std::type_info& info ) const; - -public: // Not intended for application developers - - /** - * @brief This constructor is used by SingletonService::Get(). - * @param[in] singletonService A pointer to the internal singleton-service object. - */ - explicit DALI_INTERNAL SingletonService( Internal::Adaptor::SingletonService* singletonService ); -}; - -} // namespace Dali - -#endif // DALI_SINGELTON_SERVICE_H diff --git a/dali/devel-api/file.list b/dali/devel-api/file.list index e39b2e2..e85cb13 100755 --- a/dali/devel-api/file.list +++ b/dali/devel-api/file.list @@ -23,7 +23,6 @@ SET( devel_api_src_files ${adaptor_devel_api_dir}/adaptor-framework/physical-keyboard.cpp ${adaptor_devel_api_dir}/adaptor-framework/key-devel.cpp ${adaptor_devel_api_dir}/adaptor-framework/pixel-buffer.cpp - ${adaptor_devel_api_dir}/adaptor-framework/singleton-service.cpp ${adaptor_devel_api_dir}/adaptor-framework/sound-player.cpp ${adaptor_devel_api_dir}/adaptor-framework/style-monitor.cpp ${adaptor_devel_api_dir}/adaptor-framework/tilt-sensor.cpp @@ -68,7 +67,6 @@ SET( devel_api_adaptor_framework_header_files ${adaptor_devel_api_dir}/adaptor-framework/orientation.h ${adaptor_devel_api_dir}/adaptor-framework/performance-logger.h ${adaptor_devel_api_dir}/adaptor-framework/pixel-buffer.h - ${adaptor_devel_api_dir}/adaptor-framework/singleton-service.h ${adaptor_devel_api_dir}/adaptor-framework/sound-player.h ${adaptor_devel_api_dir}/adaptor-framework/style-monitor.h ${adaptor_devel_api_dir}/adaptor-framework/tilt-sensor.h diff --git a/dali/internal/accessibility/generic/accessibility-adaptor-impl-generic.cpp b/dali/internal/accessibility/generic/accessibility-adaptor-impl-generic.cpp index 05dda37..62cfcbf 100644 --- a/dali/internal/accessibility/generic/accessibility-adaptor-impl-generic.cpp +++ b/dali/internal/accessibility/generic/accessibility-adaptor-impl-generic.cpp @@ -20,9 +20,7 @@ // EXTERNAL INCLUDES #include - -// INTERNAL INCLUDES -#include +#include namespace Dali { diff --git a/dali/internal/accessibility/tizen-wayland/tizen-common/accessibility-adaptor-impl-tizen.cpp b/dali/internal/accessibility/tizen-wayland/tizen-common/accessibility-adaptor-impl-tizen.cpp index 18d57df..b2418f8 100644 --- a/dali/internal/accessibility/tizen-wayland/tizen-common/accessibility-adaptor-impl-tizen.cpp +++ b/dali/internal/accessibility/tizen-wayland/tizen-common/accessibility-adaptor-impl-tizen.cpp @@ -22,10 +22,10 @@ #include #include +#include #include // INTERNAL INCLUDES -#include #include namespace Dali diff --git a/dali/internal/accessibility/tizen-wayland/tizen-ivi/accessibility-adaptor-impl-ivi.cpp b/dali/internal/accessibility/tizen-wayland/tizen-ivi/accessibility-adaptor-impl-ivi.cpp index f75eff9..95f8809 100644 --- a/dali/internal/accessibility/tizen-wayland/tizen-ivi/accessibility-adaptor-impl-ivi.cpp +++ b/dali/internal/accessibility/tizen-wayland/tizen-ivi/accessibility-adaptor-impl-ivi.cpp @@ -29,11 +29,10 @@ #include #include -#include +#include #include // INTERNAL INCLUDES -#include #include #ifndef WAYLAND diff --git a/dali/internal/accessibility/tizen-wayland/tizen-mobile/accessibility-adaptor-impl-mobile.cpp b/dali/internal/accessibility/tizen-wayland/tizen-mobile/accessibility-adaptor-impl-mobile.cpp index f75eff9..95f8809 100644 --- a/dali/internal/accessibility/tizen-wayland/tizen-mobile/accessibility-adaptor-impl-mobile.cpp +++ b/dali/internal/accessibility/tizen-wayland/tizen-mobile/accessibility-adaptor-impl-mobile.cpp @@ -29,11 +29,10 @@ #include #include -#include +#include #include // INTERNAL INCLUDES -#include #include #ifndef WAYLAND diff --git a/dali/internal/accessibility/tizen-wayland/tizen-tv/accessibility-adaptor-impl-tv.cpp b/dali/internal/accessibility/tizen-wayland/tizen-tv/accessibility-adaptor-impl-tv.cpp index 18d57df..b2418f8 100644 --- a/dali/internal/accessibility/tizen-wayland/tizen-tv/accessibility-adaptor-impl-tv.cpp +++ b/dali/internal/accessibility/tizen-wayland/tizen-tv/accessibility-adaptor-impl-tv.cpp @@ -22,10 +22,10 @@ #include #include +#include #include // INTERNAL INCLUDES -#include #include namespace Dali diff --git a/dali/internal/accessibility/tizen-wayland/tizen-wearable/accessibility-adaptor-impl-wearable.cpp b/dali/internal/accessibility/tizen-wayland/tizen-wearable/accessibility-adaptor-impl-wearable.cpp index d382759..525faaf 100644 --- a/dali/internal/accessibility/tizen-wayland/tizen-wearable/accessibility-adaptor-impl-wearable.cpp +++ b/dali/internal/accessibility/tizen-wayland/tizen-wearable/accessibility-adaptor-impl-wearable.cpp @@ -29,11 +29,10 @@ #include #include -#include +#include #include // INTERNAL INCLUDES -#include #include #ifndef WAYLAND diff --git a/dali/internal/adaptor/common/application-impl.cpp b/dali/internal/adaptor/common/application-impl.cpp index 29e1b84..98ef0db 100755 --- a/dali/internal/adaptor/common/application-impl.cpp +++ b/dali/internal/adaptor/common/application-impl.cpp @@ -20,6 +20,7 @@ // EXTERNAL INCLUDES #include +#include // INTERNAL INCLUDES #include @@ -27,7 +28,6 @@ #include #include #include -#include #include #include #include @@ -108,7 +108,6 @@ Application::Application( int* argc, char** argv[], const std::string& styleshee mFramework( nullptr ), mContextLossConfiguration( Configuration::APPLICATION_DOES_NOT_HANDLE_CONTEXT_LOSS ), mCommandLineOptions( nullptr ), - mSingletonService( SingletonService::New() ), mAdaptorBuilder( nullptr ), mAdaptor( nullptr ), mMainWindow(), @@ -138,7 +137,12 @@ Application::Application( int* argc, char** argv[], const std::string& styleshee Application::~Application() { - mSingletonService.UnregisterAll(); + SingletonService service = SingletonService::Get(); + // Note this can be false i.e. if Application has never created a Core instance + if( service ) + { + service.UnregisterAll(); + } mMainWindow.Reset(); delete mAdaptor; diff --git a/dali/internal/adaptor/common/application-impl.h b/dali/internal/adaptor/common/application-impl.h index 1337f7b..82826cd 100755 --- a/dali/internal/adaptor/common/application-impl.h +++ b/dali/internal/adaptor/common/application-impl.h @@ -24,7 +24,7 @@ // INTERNAL INCLUDES #include -#include +#include #include #include @@ -398,7 +398,6 @@ private: Dali::Configuration::ContextLoss mContextLossConfiguration; CommandLineOptions* mCommandLineOptions; - Dali::SingletonService mSingletonService; Dali::Internal::Adaptor::AdaptorBuilder* mAdaptorBuilder; ///< The adaptor builder Dali::Adaptor* mAdaptor; diff --git a/dali/internal/adaptor/common/lifecycle-controller-impl.cpp b/dali/internal/adaptor/common/lifecycle-controller-impl.cpp index 5358f4f..e4cd45e 100644 --- a/dali/internal/adaptor/common/lifecycle-controller-impl.cpp +++ b/dali/internal/adaptor/common/lifecycle-controller-impl.cpp @@ -23,7 +23,7 @@ // INTERNAL INCLUDES #include -#include +#include namespace Dali { diff --git a/dali/internal/clipboard/common/clipboard-event-notifier-impl.cpp b/dali/internal/clipboard/common/clipboard-event-notifier-impl.cpp index e027472..ff5acd6 100644 --- a/dali/internal/clipboard/common/clipboard-event-notifier-impl.cpp +++ b/dali/internal/clipboard/common/clipboard-event-notifier-impl.cpp @@ -20,9 +20,7 @@ // EXTERNAL INCLUDES #include - -// INTERNAL INCLUDES -#include +#include namespace Dali { diff --git a/dali/internal/clipboard/generic/clipboard-impl-generic.cpp b/dali/internal/clipboard/generic/clipboard-impl-generic.cpp index fe5ab5e..8e08371 100755 --- a/dali/internal/clipboard/generic/clipboard-impl-generic.cpp +++ b/dali/internal/clipboard/generic/clipboard-impl-generic.cpp @@ -19,7 +19,7 @@ #include // INTERNAL INCLUDES -#include +#include namespace Dali { diff --git a/dali/internal/clipboard/tizen-wayland/clipboard-impl-ecore-wl.cpp b/dali/internal/clipboard/tizen-wayland/clipboard-impl-ecore-wl.cpp index 8721844..4204f1a 100644 --- a/dali/internal/clipboard/tizen-wayland/clipboard-impl-ecore-wl.cpp +++ b/dali/internal/clipboard/tizen-wayland/clipboard-impl-ecore-wl.cpp @@ -29,6 +29,7 @@ #include #include +#include #include #include @@ -36,9 +37,6 @@ #include #endif // DALI_ELDBUS_AVAILABLE -// INTERNAL INCLUDES -#include - #define CBHM_DBUS_OBJPATH "/org/tizen/cbhm/dbus" #ifndef CBHM_DBUS_INTERFACE #define CBHM_DBUS_INTERFACE "org.tizen.cbhm.dbus" diff --git a/dali/internal/clipboard/ubuntu-x11/clipboard-impl-x.cpp b/dali/internal/clipboard/ubuntu-x11/clipboard-impl-x.cpp index 38a488e..1cb8704 100644 --- a/dali/internal/clipboard/ubuntu-x11/clipboard-impl-x.cpp +++ b/dali/internal/clipboard/ubuntu-x11/clipboard-impl-x.cpp @@ -27,7 +27,7 @@ // INTERNAL INCLUDES #include #include -#include +#include #include namespace //unnamed namespace diff --git a/dali/internal/haptics/common/feedback-player-impl.cpp b/dali/internal/haptics/common/feedback-player-impl.cpp index ea4a5f0..7468372 100644 --- a/dali/internal/haptics/common/feedback-player-impl.cpp +++ b/dali/internal/haptics/common/feedback-player-impl.cpp @@ -21,11 +21,9 @@ // EXTERNAL INCLUDES #include #include +#include #include -// INTERNAL INCLUDES -#include - namespace Dali { diff --git a/dali/internal/input/common/input-method-context-impl.cpp b/dali/internal/input/common/input-method-context-impl.cpp index 566027e..3598bd0 100755 --- a/dali/internal/input/common/input-method-context-impl.cpp +++ b/dali/internal/input/common/input-method-context-impl.cpp @@ -18,7 +18,7 @@ #include #include #include -#include +#include namespace Dali { diff --git a/dali/internal/input/common/physical-keyboard-impl.cpp b/dali/internal/input/common/physical-keyboard-impl.cpp index cfd7320..ec7523a 100644 --- a/dali/internal/input/common/physical-keyboard-impl.cpp +++ b/dali/internal/input/common/physical-keyboard-impl.cpp @@ -20,8 +20,8 @@ // CLASS HEADER #include -// INTERNAL INCLUDES -#include +// EXTERNAL INCLUDES +#include namespace Dali { diff --git a/dali/internal/input/tizen-wayland/input-method-context-impl-ecore-wl.cpp b/dali/internal/input/tizen-wayland/input-method-context-impl-ecore-wl.cpp index ab7c78b..db15ce9 100755 --- a/dali/internal/input/tizen-wayland/input-method-context-impl-ecore-wl.cpp +++ b/dali/internal/input/tizen-wayland/input-method-context-impl-ecore-wl.cpp @@ -31,6 +31,7 @@ #include #include #include +#include #include // INTERNAL INCLUDES @@ -39,7 +40,6 @@ #include #include #include -#include #include #define TOKEN_STRING(x) #x diff --git a/dali/internal/input/ubuntu-x11/input-method-context-impl-x.cpp b/dali/internal/input/ubuntu-x11/input-method-context-impl-x.cpp index ce6a57c..7101b58 100755 --- a/dali/internal/input/ubuntu-x11/input-method-context-impl-x.cpp +++ b/dali/internal/input/ubuntu-x11/input-method-context-impl-x.cpp @@ -21,6 +21,7 @@ // EXTERNAL INCLUDES #include #include +#include #include // INTERNAL INCLUDES @@ -33,7 +34,6 @@ #include #include #include -#include #include namespace Dali diff --git a/dali/internal/input/windows/input-method-context-impl-win.cpp b/dali/internal/input/windows/input-method-context-impl-win.cpp index 1061aec..009f543 100755 --- a/dali/internal/input/windows/input-method-context-impl-win.cpp +++ b/dali/internal/input/windows/input-method-context-impl-win.cpp @@ -21,6 +21,7 @@ // EXTERNAL INCLUDES #include #include +#include #include // INTERNAL INCLUDES @@ -30,7 +31,6 @@ #include #include #include -#include namespace Dali { diff --git a/dali/internal/sensor/common/tilt-sensor-factory.cpp b/dali/internal/sensor/common/tilt-sensor-factory.cpp index c31836a..f5245b3 100644 --- a/dali/internal/sensor/common/tilt-sensor-factory.cpp +++ b/dali/internal/sensor/common/tilt-sensor-factory.cpp @@ -17,7 +17,7 @@ #include #include -#include +#include namespace Dali { @@ -65,4 +65,4 @@ Dali::TiltSensor Get() } // Internal -} // Dali \ No newline at end of file +} // Dali diff --git a/dali/internal/sensor/tizen/tilt-sensor-impl-tizen.cpp b/dali/internal/sensor/tizen/tilt-sensor-impl-tizen.cpp index d3773cf..13d3336 100644 --- a/dali/internal/sensor/tizen/tilt-sensor-impl-tizen.cpp +++ b/dali/internal/sensor/tizen/tilt-sensor-impl-tizen.cpp @@ -22,11 +22,9 @@ // EXTERNAL INCLUDES #include #include +#include #include -// INTERNAL INCLUDES -#include - namespace // unnamed namespace { const char* const SIGNAL_TILTED = "tilted"; diff --git a/dali/internal/sensor/ubuntu/tilt-sensor-impl-ubuntu.cpp b/dali/internal/sensor/ubuntu/tilt-sensor-impl-ubuntu.cpp index efe12e7..9a2b5ea 100644 --- a/dali/internal/sensor/ubuntu/tilt-sensor-impl-ubuntu.cpp +++ b/dali/internal/sensor/ubuntu/tilt-sensor-impl-ubuntu.cpp @@ -22,9 +22,7 @@ // EXTERNAL INCLUDES #include #include - -// INTERNAL INCLUDES -#include +#include namespace // unnamed namespace { diff --git a/dali/internal/styling/common/style-monitor-impl.cpp b/dali/internal/styling/common/style-monitor-impl.cpp index 9b23434..8e93285 100644 --- a/dali/internal/styling/common/style-monitor-impl.cpp +++ b/dali/internal/styling/common/style-monitor-impl.cpp @@ -20,12 +20,12 @@ // EXTERNAL INCLUDES #include +#include #include #include // INTERNAL INCLUDES #include -#include namespace Dali { diff --git a/dali/internal/system/common/color-controller-impl.cpp b/dali/internal/system/common/color-controller-impl.cpp index b8cf94d..c7630b2 100644 --- a/dali/internal/system/common/color-controller-impl.cpp +++ b/dali/internal/system/common/color-controller-impl.cpp @@ -22,9 +22,7 @@ #include #include #include - -// INTERNAL INCLUDES -#include +#include namespace Dali { diff --git a/dali/internal/system/common/singleton-service-impl.cpp b/dali/internal/system/common/singleton-service-impl.cpp deleted file mode 100755 index a1c3329..0000000 --- a/dali/internal/system/common/singleton-service-impl.cpp +++ /dev/null @@ -1,138 +0,0 @@ -/* - * Copyright (c) 2019 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. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// CLASS HEADER -#include - -// EXTERNAL INCLUDES -#include -#include -#include - -// INTERNAL INCLUDES -#include -#include - -#if defined(DEBUG_ENABLED) -#include -Debug::Filter* gSingletonServiceLogFilter = Debug::Filter::New( Debug::NoLogging, false, "LOG_SINGLETON_SERVICE" ); - -// Need to define own macro as the log function is not installed when this object is created so no logging is shown with DALI_LOG_INFO at construction and destruction -#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, ...) DALI_LOG_INFO(gSingletonServiceLogFilter, level, format, ## __VA_ARGS__ ) -#else - -#define DALI_LOG_SINGLETON_SERVICE_DIRECT(level, message) -#define DALI_LOG_SINGLETON_SERVICE(level, format, ...) - -#endif - -namespace Dali -{ - -namespace Internal -{ - -namespace Adaptor -{ - -namespace -{ -thread_local SingletonService * gSingletonService = 0; -} // unnamed namespace - -Dali::SingletonService SingletonService::New() -{ - Dali::SingletonService singletonService( new SingletonService ); - return singletonService; -} - -Dali::SingletonService SingletonService::Get() -{ - Dali::SingletonService singletonService; - if ( gSingletonService ) - { - singletonService = Dali::SingletonService( gSingletonService ); - } - return singletonService; -} - -void SingletonService::Register( const std::type_info& info, BaseHandle singleton ) -{ - if( singleton ) - { - DALI_LOG_SINGLETON_SERVICE( Debug::General, "Singleton Added: %s\n", info.name() ); - mSingletonContainer.push_back( SingletonPair( info.name(), singleton ) ); - - Integration::Processor* processor = dynamic_cast( &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 ); - } - } -} - -void SingletonService::UnregisterAll( ) -{ - mSingletonContainer.clear(); -} - -BaseHandle SingletonService::GetSingleton( const std::type_info& info ) const -{ - BaseHandle object; - - const SingletonContainer::const_iterator end = mSingletonContainer.end(); - for( SingletonContainer::const_iterator iter = mSingletonContainer.begin(); iter != end; ++iter ) - { - // comparing the addresses as these are allocated statically per library - if( ( *iter ).first == info.name() ) - { - object = ( *iter ).second; - } - } - - return object; -} - -SingletonService::SingletonService() -: mSingletonContainer() -{ - // Can only have one instance of SingletonService - DALI_ASSERT_ALWAYS( !gSingletonService && "Only one instance of SingletonService is allowed"); - - gSingletonService = this; - - DALI_LOG_SINGLETON_SERVICE_DIRECT( Debug::Concise, "SingletonService Created\n" ); -} - -SingletonService::~SingletonService() -{ - gSingletonService = 0; - - DALI_LOG_SINGLETON_SERVICE_DIRECT( Debug::Concise, "SingletonService Destroyed\n" ); -} - -} // namespace Adaptor - -} // namespace Internal - -} // namespace Dali diff --git a/dali/internal/system/common/singleton-service-impl.h b/dali/internal/system/common/singleton-service-impl.h deleted file mode 100644 index 986e72a..0000000 --- a/dali/internal/system/common/singleton-service-impl.h +++ /dev/null @@ -1,122 +0,0 @@ -#ifndef DALI_INTERNAL_SINGLETON_SERVICE_H -#define DALI_INTERNAL_SINGLETON_SERVICE_H - -/* - * Copyright (c) 2019 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. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// EXTERNAL INCLUDES -#include -#include - -// INTERNAL INCLUDES -#include - -namespace Dali -{ - -namespace Internal -{ - -namespace Adaptor -{ - -class SingletonService : public Dali::BaseObject -{ -public: - - /** - * Create a SingletonService. - * This should only be called once by the Application class. - * @return A newly created SingletonService. - */ - static Dali::SingletonService New(); - - /** - * @copydoc Dali::SingletonService::Get() - */ - static Dali::SingletonService Get(); - - /** - * @copydoc Dali::SingletonService::Register() - */ - void Register( const std::type_info& info, BaseHandle singleton ); - - /** - * @copydoc Dali::SingletonService::UnregisterAll() - */ - void UnregisterAll(); - - /** - * @copydoc Dali::SingletonService::GetSingleton() - */ - BaseHandle GetSingleton( const std::type_info& info ) const; - -private: - - /** - * Private Constructor - * @see SingletonService::New() - */ - SingletonService(); - - /** - * Virtual Destructor - */ - virtual ~SingletonService(); - - // Undefined - SingletonService( const SingletonService& ); - SingletonService& operator=( SingletonService& ); - -private: - - // using the address of the type name string as compiler will allocate these once per library - // and we don't support un/re-loading of dali libraries while singleton service is alive - typedef std::pair< const char*, BaseHandle> SingletonPair; - typedef std::vector< SingletonPair > SingletonContainer; - typedef SingletonContainer::const_iterator SingletonConstIter; - - SingletonContainer mSingletonContainer; ///< The container to look up singleton by its type name -}; - -} // namespace Adaptor - -} // namespace Internal - -// Helpers for public-api forwarding methods - -inline Internal::Adaptor::SingletonService& GetImplementation(Dali::SingletonService& player) -{ - DALI_ASSERT_ALWAYS( player && "SingletonService handle is empty" ); - - BaseObject& handle = player.GetBaseObject(); - - return static_cast(handle); -} - -inline const Internal::Adaptor::SingletonService& GetImplementation(const Dali::SingletonService& player) -{ - DALI_ASSERT_ALWAYS( player && "SingletonService handle is empty" ); - - const BaseObject& handle = player.GetBaseObject(); - - return static_cast(handle); -} - -} // namespace Dali - -#endif // DALI_INTERNAL_SINGLETON_SERVICE_H diff --git a/dali/internal/system/common/sound-player-impl.cpp b/dali/internal/system/common/sound-player-impl.cpp index 62084d5..572747d 100644 --- a/dali/internal/system/common/sound-player-impl.cpp +++ b/dali/internal/system/common/sound-player-impl.cpp @@ -20,9 +20,7 @@ // EXTERNAL INCLUDES #include - -// INTERNAL INCLUDES -#include +#include namespace Dali { diff --git a/dali/internal/system/file.list b/dali/internal/system/file.list index 0ac2ec5..3c5be55 100644 --- a/dali/internal/system/file.list +++ b/dali/internal/system/file.list @@ -16,7 +16,6 @@ SET( adaptor_system_common_src_files ${adaptor_system_dir}/common/performance-logger-impl.cpp ${adaptor_system_dir}/common/performance-marker.cpp ${adaptor_system_dir}/common/performance-server.cpp - ${adaptor_system_dir}/common/singleton-service-impl.cpp ${adaptor_system_dir}/common/sound-player-impl.cpp ${adaptor_system_dir}/common/stat-context.cpp ${adaptor_system_dir}/common/stat-context-manager.cpp diff --git a/dali/internal/text/text-abstraction/bidirectional-support-impl.cpp b/dali/internal/text/text-abstraction/bidirectional-support-impl.cpp index 2f5e7ab..7142ada 100755 --- a/dali/internal/text/text-abstraction/bidirectional-support-impl.cpp +++ b/dali/internal/text/text-abstraction/bidirectional-support-impl.cpp @@ -18,13 +18,11 @@ // CLASS HEADER #include -// INTERNAL INCLUDES -#include - // EXTERNAL INCLUDES #include #include #include +#include namespace Dali { diff --git a/dali/internal/text/text-abstraction/font-client-impl.cpp b/dali/internal/text/text-abstraction/font-client-impl.cpp index 862ff7b..1a653d6 100755 --- a/dali/internal/text/text-abstraction/font-client-impl.cpp +++ b/dali/internal/text/text-abstraction/font-client-impl.cpp @@ -24,7 +24,7 @@ #endif // INTERNAL INCLUDES -#include +#include #include #include diff --git a/dali/internal/text/text-abstraction/segmentation-impl.cpp b/dali/internal/text/text-abstraction/segmentation-impl.cpp index f585163..fd97c20 100644 --- a/dali/internal/text/text-abstraction/segmentation-impl.cpp +++ b/dali/internal/text/text-abstraction/segmentation-impl.cpp @@ -18,10 +18,8 @@ // CLASS HEADER #include -// INTERNAL INCLUDES -#include - // EXTERNAL INCLUDES +#include #include #include diff --git a/dali/internal/text/text-abstraction/shaping-impl.cpp b/dali/internal/text/text-abstraction/shaping-impl.cpp index 30dfbd0..b785c02 100755 --- a/dali/internal/text/text-abstraction/shaping-impl.cpp +++ b/dali/internal/text/text-abstraction/shaping-impl.cpp @@ -19,7 +19,6 @@ #include // INTERNAL INCLUDES -#include #include #include #include @@ -28,6 +27,7 @@ // EXTERNAL INCLUDES #include #include +#include namespace { diff --git a/dali/internal/text/text-abstraction/text-renderer-impl.cpp b/dali/internal/text/text-abstraction/text-renderer-impl.cpp index 449eaa1..a360361 100755 --- a/dali/internal/text/text-abstraction/text-renderer-impl.cpp +++ b/dali/internal/text/text-abstraction/text-renderer-impl.cpp @@ -18,8 +18,10 @@ // CLASS HEADER #include +// EXTERNAL INCLUDES +#include + // INTERNAL INCLUDES -#include #include namespace Dali