Make assertion when SetParent is not called on the main thread
[platform/core/uifw/dali-core.git] / dali / internal / event / common / thread-local-storage.h
index 725f6e0..8baef7d 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_INTERNAL_THREAD_LOCAL_STORAGE_H
 
 /*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
 
 // INTERNAL INCLUDES
 #include <dali/devel-api/common/singleton-service.h>
-#include <dali/internal/event/common/stage-def.h>
 #include <dali/internal/event/common/scene-impl.h>
+#include <dali/internal/event/common/stage-def.h>
 
 namespace Dali
 {
-
 struct Vector2;
 
 namespace Integration
@@ -38,7 +37,6 @@ class PlatformAbstraction;
 
 namespace Internal
 {
-
 class Core;
 class NotificationManager;
 class ShaderFactory;
@@ -46,6 +44,8 @@ class GestureEventProcessor;
 class RelayoutController;
 class ObjectRegistry;
 class EventThreadServices;
+class PropertyNotificationManager;
+class AnimationPlaylist;
 
 namespace SceneGraph
 {
@@ -59,7 +59,6 @@ class UpdateManager;
 class ThreadLocalStorage : public Dali::BaseObject
 {
 public:
-
   /**
    * Constructor
    * Creates the TLS and adds a pointer to core
@@ -91,6 +90,13 @@ public:
   static bool Created();
 
   /**
+   * Checks if the system is shutting down
+   * @return true if the system is shutting down
+   * @note It returns false if the core hasn't been initialised yet.
+   */
+  static bool IsShuttingDown();
+
+  /**
    * Get a pointer to the TLS or NULL if not initialized
    * @return pointer to the TLS
    */
@@ -163,23 +169,45 @@ public:
   AnimationPlaylist& GetAnimationPlaylist();
 
   /**
+   * @brief Returns whether the blend equation is supported in the system or not.
+   * @param[in] blendEquation blend equation to be checked.
+   * @return True if the blend equation supported.
+   */
+  bool IsBlendEquationSupported(DevelBlendEquation::Type blendEquation);
+
+  /**
+   * @brief Returns shader prefix of shading language version.
+   */
+  std::string GetShaderVersionPrefix();
+
+  /**
+   * @brief Returns vertex shader prefix including shading language version.
+   */
+  std::string GetVertexShaderPrefix();
+
+  /**
+   * @brief Returns fragment shader prefix including shading language version and extension information.
+   */
+  std::string GetFragmentShaderPrefix();
+
+  /**
    * Add a Scene to the Core.
    * This is only used by the Scene to add itself to the core when the Scene is created.
    * @param[in] scene The Scene.
    */
-  void AddScene( Scene* scene );
+  void AddScene(Scene* scene);
 
   /**
    * Remove a Scene from the Core.
    * This is only used by the Scene to remove itself from the core when the Scene is destroyed.
    * @param[in] scene The Scene.
    */
-  void RemoveScene( Scene* scene );
+  void RemoveScene(Scene* scene);
 
   /**
    * @copydoc Dali::SingletonService::Register()
    */
-  void Register( const std::type_info& info, BaseHandle singleton );
+  void Register(const std::type_info& info, BaseHandle singleton);
 
   /**
    * @copydoc Dali::SingletonService::UnregisterAll()
@@ -189,22 +217,20 @@ public:
   /**
    * @copydoc Dali::SingletonService::GetSingleton()
    */
-  BaseHandle GetSingleton( const std::type_info& info ) const;
+  BaseHandle GetSingleton(const std::type_info& info) const;
 
 private:
-
   /**
    * Virtual Destructor
    */
-  virtual ~ThreadLocalStorage();
+  ~ThreadLocalStorage() override;
 
   // Undefined
-  ThreadLocalStorage( const ThreadLocalStorage& );
-  ThreadLocalStorage& operator=( ThreadLocalStorage& );
+  ThreadLocalStorage(const ThreadLocalStorage&);
+  ThreadLocalStorage& operator=(ThreadLocalStorage&);
 
 private:
-
-  Core* mCore;                                              ///< reference to core
+  Core* mCore; ///< reference to core
 
   // 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
@@ -213,7 +239,6 @@ private:
   using SingletonConstIter = SingletonContainer::const_iterator;
 
   SingletonContainer mSingletonContainer; ///< The container to look up singleton by its type name
-
 };
 
 } // namespace Internal
@@ -222,7 +247,7 @@ private:
 
 inline Internal::ThreadLocalStorage& GetImplementation(Dali::SingletonService& service)
 {
-  DALI_ASSERT_ALWAYS( service && "SingletonService handle is empty" );
+  DALI_ASSERT_ALWAYS(service && "SingletonService handle is empty");
 
   BaseObject& handle = service.GetBaseObject();
 
@@ -231,7 +256,7 @@ inline Internal::ThreadLocalStorage& GetImplementation(Dali::SingletonService& s
 
 inline const Internal::ThreadLocalStorage& GetImplementation(const Dali::SingletonService& service)
 {
-  DALI_ASSERT_ALWAYS( service && "SingletonService handle is empty" );
+  DALI_ASSERT_ALWAYS(service && "SingletonService handle is empty");
 
   const BaseObject& handle = service.GetBaseObject();