Refactor system classes 70/294770/6
authorHeeyong Song <heeyong.song@samsung.com>
Mon, 26 Jun 2023 09:31:34 +0000 (18:31 +0900)
committerHeeyong Song <heeyong.song@samsung.com>
Thu, 29 Jun 2023 10:03:16 +0000 (19:03 +0900)
Refactor CallbackManager, FileDescriptorMonitor, Timer

Change-Id: I16ac23375bae537206c78b2fd630d79eea44de36

71 files changed:
dali/internal/adaptor/android/framework-android.h
dali/internal/adaptor/androidjni/framework-androidjni.h
dali/internal/adaptor/common/adaptor-impl.cpp
dali/internal/adaptor/common/adaptor-impl.h
dali/internal/adaptor/common/framework.h
dali/internal/adaptor/glib/framework-glib.h
dali/internal/adaptor/libuv/framework-libuv.h
dali/internal/adaptor/macos/framework-mac.h
dali/internal/adaptor/tizen-wayland/framework-tizen.h
dali/internal/adaptor/ubuntu/framework-ubuntu.h
dali/internal/adaptor/windows/framework-win.h
dali/internal/system/android/callback-manager-android.cpp
dali/internal/system/android/callback-manager-android.h
dali/internal/system/android/file-descriptor-monitor-android.cpp
dali/internal/system/android/file-descriptor-monitor-android.h [new file with mode: 0644]
dali/internal/system/android/system-factory-android.cpp [new file with mode: 0644]
dali/internal/system/android/system-factory-android.h [new file with mode: 0644]
dali/internal/system/android/timer-impl-android.cpp
dali/internal/system/android/timer-impl-android.h [new file with mode: 0644]
dali/internal/system/common/callback-manager.h
dali/internal/system/common/file-descriptor-monitor.h
dali/internal/system/common/system-factory.h [new file with mode: 0644]
dali/internal/system/common/timer-impl.h
dali/internal/system/common/timer-interface.h
dali/internal/system/common/trigger-event.cpp
dali/internal/system/common/trigger-event.h
dali/internal/system/file.list
dali/internal/system/glib/callback-manager-glib.cpp
dali/internal/system/glib/callback-manager-glib.h
dali/internal/system/glib/file-descriptor-monitor-glib.cpp
dali/internal/system/glib/file-descriptor-monitor-glib.h [new file with mode: 0644]
dali/internal/system/glib/system-factory-glib.cpp [new file with mode: 0644]
dali/internal/system/glib/system-factory-glib.h [new file with mode: 0644]
dali/internal/system/glib/timer-impl-glib.cpp
dali/internal/system/glib/timer-impl-glib.h [new file with mode: 0644]
dali/internal/system/libuv/callback-manager-libuv.cpp
dali/internal/system/libuv/callback-manager-libuv.h
dali/internal/system/libuv/file-descriptor-monitor-libuv.cpp
dali/internal/system/libuv/file-descriptor-monitor-libuv.h [new file with mode: 0644]
dali/internal/system/libuv/system-factory-libuv.cpp [new file with mode: 0644]
dali/internal/system/libuv/system-factory-libuv.h [new file with mode: 0644]
dali/internal/system/libuv/timer-impl-libuv.cpp
dali/internal/system/libuv/timer-impl-libuv.h [new file with mode: 0644]
dali/internal/system/linux/callback-manager-ecore.cpp
dali/internal/system/linux/callback-manager-ecore.h
dali/internal/system/linux/file-descriptor-monitor-ecore.cpp
dali/internal/system/linux/file-descriptor-monitor-ecore.h [new file with mode: 0644]
dali/internal/system/linux/system-factory-ecore.cpp [new file with mode: 0644]
dali/internal/system/linux/system-factory-ecore.h [new file with mode: 0644]
dali/internal/system/linux/timer-impl-ecore.cpp
dali/internal/system/linux/timer-impl-ecore.h [new file with mode: 0644]
dali/internal/system/macos/callback-manager-mac.h
dali/internal/system/macos/callback-manager-mac.mm
dali/internal/system/macos/file-descriptor-monitor-macos.cpp
dali/internal/system/macos/file-descriptor-monitor-macos.h [new file with mode: 0644]
dali/internal/system/macos/system-factory-mac.cpp [new file with mode: 0644]
dali/internal/system/macos/system-factory-mac.h [new file with mode: 0644]
dali/internal/system/macos/timer-impl-mac.cpp
dali/internal/system/macos/timer-impl-mac.h [new file with mode: 0644]
dali/internal/system/windows/callback-manager-win.cpp
dali/internal/system/windows/callback-manager-win.h
dali/internal/system/windows/file-descriptor-monitor-windows.cpp
dali/internal/system/windows/file-descriptor-monitor-windows.h [new file with mode: 0644]
dali/internal/system/windows/system-factory-win.cpp [new file with mode: 0644]
dali/internal/system/windows/system-factory-win.h [new file with mode: 0644]
dali/internal/system/windows/timer-impl-win.cpp
dali/internal/system/windows/timer-impl-win.h [new file with mode: 0644]
dali/internal/window-system/common/window-render-surface.cpp
dali/internal/window-system/x11/window-system-x.cpp
dali/public-api/adaptor-framework/timer.cpp
dali/public-api/adaptor-framework/timer.h

index d6596fb..3290fcd 100644 (file)
@@ -71,8 +71,8 @@ public:
 
 private:
   // Undefined
-  FrameworkAndroid(const FrameworkAndroid&);
-  FrameworkAndroid& operator=(FrameworkAndroid&);
+  FrameworkAndroid(const FrameworkAndroid&) = delete;
+  FrameworkAndroid& operator=(FrameworkAndroid&) = delete;
 
 private:
   bool mInitialised;
index 461c568..7ee94dd 100644 (file)
@@ -71,8 +71,8 @@ public:
 
 private:
   // Undefined
-  FrameworkAndroidJni(const FrameworkAndroidJni&);
-  FrameworkAndroidJni& operator=(FrameworkAndroidJni&);
+  FrameworkAndroidJni(const FrameworkAndroidJni&) = delete;
+  FrameworkAndroidJni& operator=(FrameworkAndroidJni&) = delete;
 
 private:
   bool mInitialised;
index 8d4d271..3fc83d0 100644 (file)
@@ -62,6 +62,7 @@
 #include <dali/internal/graphics/gles/gl-proxy-implementation.h>
 #include <dali/internal/system/common/callback-manager.h>
 #include <dali/internal/system/common/object-profiler.h>
+#include <dali/internal/system/common/system-factory.h>
 #include <dali/internal/window-system/common/display-connection.h>
 #include <dali/internal/window-system/common/display-utils.h> // For Utils::MakeUnique
 #include <dali/internal/window-system/common/event-handler.h>
@@ -162,7 +163,7 @@ void Adaptor::Initialize(GraphicsFactory& graphicsFactory)
   mEnvironmentOptions->CreateTraceManager(mPerformanceInterface);
   mEnvironmentOptions->InstallTraceFunction(); // install tracing for main thread
 
-  mCallbackManager = CallbackManager::New();
+  mCallbackManager = Dali::Internal::Adaptor::GetSystemFactory()->CreateCallbackManager();
 
   Dali::Internal::Adaptor::SceneHolder* defaultWindow = mWindows.front();
 
@@ -365,7 +366,9 @@ Adaptor::~Adaptor()
 
   delete mDisplayConnection;
   delete mPlatformAbstraction;
-  delete mCallbackManager;
+
+  mCallbackManager.reset();
+
   delete mPerformanceInterface;
 
   mGraphics->Destroy();
index 1f68c22..e058047 100644 (file)
@@ -689,26 +689,26 @@ private:                                          // Data
 
   TizenPlatform::TizenPlatformAbstraction* mPlatformAbstraction; ///< Platform abstraction
 
-  CallbackManager*            mCallbackManager;                       ///< Used to install callbacks
-  bool                        mNotificationOnIdleInstalled;           ///< whether the idle handler is installed to send an notification event
-  TriggerEventInterface*      mNotificationTrigger;                   ///< Notification event trigger
-  FeedbackPluginProxy*        mDaliFeedbackPlugin;                    ///< Used to access feedback support
-  FeedbackController*         mFeedbackController;                    ///< Plays feedback effects for Dali-Toolkit UI Controls.
-  Dali::TtsPlayer             mTtsPlayers[Dali::TtsPlayer::MODE_NUM]; ///< Provides TTS support
-  ObserverContainer           mObservers;                             ///< A list of adaptor observer pointers
-  EnvironmentOptions*         mEnvironmentOptions;                    ///< environment options
-  PerformanceInterface*       mPerformanceInterface;                  ///< Performance interface
-  KernelTrace                 mKernelTracer;                          ///< Kernel tracer
-  SystemTrace                 mSystemTracer;                          ///< System tracer
-  ObjectProfiler*             mObjectProfiler;                        ///< Tracks object lifetime for profiling
-  Dali::Timer                 mMemoryPoolTimer;                       ///< Logs memory pool capacity
-  SlotDelegate<Adaptor>       mMemoryPoolTimerSlotDelegate;
-  SocketFactory               mSocketFactory;               ///< Socket factory
-  Mutex                       mMutex;                       ///< Mutex
-  ThreadMode                  mThreadMode;                  ///< The thread mode
-  const bool                  mEnvironmentOptionsOwned : 1; ///< Whether we own the EnvironmentOptions (and thus, need to delete it)
-  bool                        mUseRemoteSurface : 1;        ///< whether the remoteSurface is used or not
-  Dali::LayoutDirection::Type mRootLayoutDirection;         ///< LayoutDirection of window
+  std::unique_ptr<CallbackManager> mCallbackManager;                       ///< Used to install callbacks
+  bool                             mNotificationOnIdleInstalled;           ///< whether the idle handler is installed to send an notification event
+  TriggerEventInterface*           mNotificationTrigger;                   ///< Notification event trigger
+  FeedbackPluginProxy*             mDaliFeedbackPlugin;                    ///< Used to access feedback support
+  FeedbackController*              mFeedbackController;                    ///< Plays feedback effects for Dali-Toolkit UI Controls.
+  Dali::TtsPlayer                  mTtsPlayers[Dali::TtsPlayer::MODE_NUM]; ///< Provides TTS support
+  ObserverContainer                mObservers;                             ///< A list of adaptor observer pointers
+  EnvironmentOptions*              mEnvironmentOptions;                    ///< environment options
+  PerformanceInterface*            mPerformanceInterface;                  ///< Performance interface
+  KernelTrace                      mKernelTracer;                          ///< Kernel tracer
+  SystemTrace                      mSystemTracer;                          ///< System tracer
+  ObjectProfiler*                  mObjectProfiler;                        ///< Tracks object lifetime for profiling
+  Dali::Timer                      mMemoryPoolTimer;                       ///< Logs memory pool capacity
+  SlotDelegate<Adaptor>            mMemoryPoolTimerSlotDelegate;
+  SocketFactory                    mSocketFactory;               ///< Socket factory
+  Mutex                            mMutex;                       ///< Mutex
+  ThreadMode                       mThreadMode;                  ///< The thread mode
+  const bool                       mEnvironmentOptionsOwned : 1; ///< Whether we own the EnvironmentOptions (and thus, need to delete it)
+  bool                             mUseRemoteSurface : 1;        ///< whether the remoteSurface is used or not
+  Dali::LayoutDirection::Type      mRootLayoutDirection;         ///< LayoutDirection of window
 
   std::unique_ptr<Integration::AddOnManager> mAddOnManager; ///< Pointer to the addon manager
 
index 0a367c0..23244eb 100644 (file)
@@ -332,8 +332,8 @@ private:
 
 private:
   // Undefined
-  Framework(const Framework&);
-  Framework& operator=(Framework&);
+  Framework(const Framework&) = delete;
+  Framework& operator=(Framework&) = delete;
 
 protected:
   Observer&                     mObserver;
index 301d238..da44e6c 100644 (file)
@@ -55,8 +55,8 @@ public:
 
 private:
   // Undefined
-  FrameworkGlib(const FrameworkGlib&);
-  FrameworkGlib& operator=(FrameworkGlib&);
+  FrameworkGlib(const FrameworkGlib&) = delete;
+  FrameworkGlib& operator=(FrameworkGlib&) = delete;
 
 private: // impl members
   struct Impl;
index 15ce4ea..837bb10 100644 (file)
@@ -55,8 +55,8 @@ public:
 
 private:
   // Undefined
-  FrameworkLibuv(const FrameworkLibuv&);
-  FrameworkLibuv& operator=(FrameworkLibuv&);
+  FrameworkLibuv(const FrameworkLibuv&) = delete;
+  FrameworkLibuv& operator=(FrameworkLibuv&) = delete;
 
 private: // impl members
   struct Impl;
index 38770b9..5cde983 100644 (file)
@@ -62,8 +62,8 @@ public:
 
 private:
   // Undefined
-  FrameworkMac(const FrameworkMac&);
-  FrameworkMac& operator=(FrameworkMac&);
+  FrameworkMac(const FrameworkMac&) = delete;
+  FrameworkMac& operator=(FrameworkMac&) = delete;
 };
 
 } // namespace Adaptor
index 724cfbf..c6c182a 100644 (file)
@@ -85,8 +85,8 @@ public:
 
 private:
   // Undefined
-  FrameworkTizen(const FrameworkTizen&);
-  FrameworkTizen& operator=(FrameworkTizen&);
+  FrameworkTizen(const FrameworkTizen&) = delete;
+  FrameworkTizen& operator=(FrameworkTizen&) = delete;
 
 private:
   /**
index 4da3904..cb34089 100644 (file)
@@ -55,8 +55,8 @@ public:
 
 private:
   // Undefined
-  FrameworkUbuntu(const FrameworkUbuntu&);
-  FrameworkUbuntu& operator=(FrameworkUbuntu&);
+  FrameworkUbuntu(const FrameworkUbuntu&) = delete;
+  FrameworkUbuntu& operator=(FrameworkUbuntu&) = delete;
 
 private:
   /**
index d155a09..5ddd6d7 100644 (file)
@@ -55,8 +55,8 @@ public:
 
 private:
   // Undefined
-  FrameworkWin(const FrameworkWin&);
-  FrameworkWin& operator=(FrameworkWin&);
+  FrameworkWin(const FrameworkWin&) = delete;
+  FrameworkWin& operator=(FrameworkWin&) = delete;
 
 private: // impl members
   struct Impl;
index 2d45b43..116db5e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021 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.
@@ -228,12 +228,6 @@ void AndroidCallbackManager::RemoveAllCallbacks()
   mCallbackContainer.clear();
 }
 
-// Creates a concrete interface for CallbackManager
-CallbackManager* CallbackManager::New()
-{
-  return new AndroidCallbackManager;
-}
-
 } // namespace Adaptor
 
 } // namespace Internal
index fceaabc..310c3cc 100644 (file)
@@ -1,8 +1,8 @@
-#ifndef __DALI_ANDROID_CALLBACK_MANAGER_H__
-#define __DALI_ANDROID_CALLBACK_MANAGER_H__
+#ifndef DALI_INTERNAL_ADAPTOR_SYSTEM_ANDROID_CALLBACK_MANAGER_H
+#define DALI_INTERNAL_ADAPTOR_SYSTEM_ANDROID_CALLBACK_MANAGER_H
 
 /*
- * Copyright (c) 2021 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.
@@ -39,77 +39,82 @@ class AndroidCallbackManager : public CallbackManager
 {
 public:
   /**
-     * @brief constructor
-     */
+   * @brief constructor
+   */
   AndroidCallbackManager();
 
   /**
-     * @brief destructor
-     */
+   * @brief destructor
+   */
   ~AndroidCallbackManager() = default;
 
   /**
-     * @copydoc CallbackManager::AddIdleCallback()
-     */
+   * @copydoc CallbackManager::AddIdleCallback()
+   */
   bool AddIdleCallback(CallbackBase* callback, bool hasReturnValue) override;
 
   /**
-     * @copydoc CallbackManager::RemoveIdleCallback()
-     */
+   * @copydoc CallbackManager::RemoveIdleCallback()
+   */
   void RemoveIdleCallback(CallbackBase* callback) override;
 
   /**
-     * @copydoc CallbackManager::ProcessIdle()
-     */
+   * @copydoc CallbackManager::ProcessIdle()
+   */
   bool ProcessIdle() override;
 
   /**
-     * @copydoc CallbackManager::ProcessIdle()
-     */
+   * @copydoc CallbackManager::ProcessIdle()
+   */
   void ClearIdleCallbacks() override;
 
   /**
-     * @copydoc CallbackManager::AddIdleEntererCallback()
-     */
+   * @copydoc CallbackManager::AddIdleEntererCallback()
+   */
   bool AddIdleEntererCallback(CallbackBase* callback) override;
 
   /**
-     * @copydoc CallbackManager::RemoveIdleEntererCallback()
-     */
+   * @copydoc CallbackManager::RemoveIdleEntererCallback()
+   */
   void RemoveIdleEntererCallback(CallbackBase* callback) override;
 
   /**
-     * @copydoc CallbackManager::Start()
-     */
+   * @copydoc CallbackManager::Start()
+   */
   void Start() override;
 
   /**
-     * @copydoc CallbackManager::Stop()
-     */
+   * @copydoc CallbackManager::Stop()
+   */
   void Stop() override;
 
 private:
   /**
-     * @brief Remove all idle call backs that are pending
-     * Called by Stop()
-     * Always called from the main thread
-     */
+   * @brief Remove all idle call backs that are pending
+   * Called by Stop()
+   * Always called from the main thread
+   */
   void RemoveAllCallbacks();
 
   /**
-     * @brief Removes a single call back from the container
-     * Always called from main thread
-     * @param callbackData callback data
-     */
+   * @brief Removes a single call back from the container
+   * Always called from main thread
+   * @param callbackData callback data
+   */
   void RemoveCallbackFromContainer(CallbackData* callbackData);
 
   /**
-     * @brief Remove a standard call back from ecore
-     * Always called from main thread
-     * @param callbackData callback data
-     */
+   * @brief Remove a standard call back from ecore
+   * Always called from main thread
+   * @param callbackData callback data
+   */
   void RemoveStandardCallback(CallbackData* callbackData);
 
+  // Undefined
+  AndroidCallbackManager(const AndroidCallbackManager&) = delete;
+  AndroidCallbackManager& operator=(AndroidCallbackManager&) = delete;
+
+private:
   typedef std::list<CallbackData*> CallbackList;
 
   bool         mRunning;           ///< flag is set to true if when running
@@ -122,4 +127,4 @@ private:
 
 } // namespace Dali
 
-#endif // __DALI_ANDROID_CALLBACK_MANAGER_H__
+#endif // DALI_INTERNAL_ADAPTOR_SYSTEM_ANDROID_CALLBACK_MANAGER_H
index 6f4c464..f857afc 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021 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.
@@ -16,7 +16,7 @@
  */
 
 // CLASS HEADER
-#include <dali/internal/system/common/file-descriptor-monitor.h>
+#include <dali/internal/system/android/file-descriptor-monitor-android.h>
 
 // EXTERNAL INCLUDES
 #include <looper.h>
@@ -33,7 +33,7 @@ namespace Adaptor
 /**
  * Using Impl to hide away Android specific members
  */
-struct FileDescriptorMonitor::Impl
+struct FileDescriptorMonitorAndroid::Impl
 {
   // Construction
   Impl(int fileDescriptor, CallbackBase* callback, int eventBitmask)
@@ -85,7 +85,8 @@ struct FileDescriptorMonitor::Impl
   }
 };
 
-FileDescriptorMonitor::FileDescriptorMonitor(int fileDescriptor, CallbackBase* callback, int eventBitmask)
+FileDescriptorMonitorAndroid::FileDescriptorMonitorAndroid(int fileDescriptor, CallbackBase* callback, int eventBitmask)
+: FileDescriptorMonitor(fileDescriptor, callback, eventBitmask)
 {
   mImpl = new Impl(fileDescriptor, callback, eventBitmask);
 
@@ -111,7 +112,7 @@ FileDescriptorMonitor::FileDescriptorMonitor(int fileDescriptor, CallbackBase* c
   }
 }
 
-FileDescriptorMonitor::~FileDescriptorMonitor()
+FileDescriptorMonitorAndroid::~FileDescriptorMonitorAndroid()
 {
   if(mImpl->mFileDescriptor)
   {
diff --git a/dali/internal/system/android/file-descriptor-monitor-android.h b/dali/internal/system/android/file-descriptor-monitor-android.h
new file mode 100644 (file)
index 0000000..0e13eee
--- /dev/null
@@ -0,0 +1,64 @@
+#ifndef DALI_INTERNAL_ADAPTOR_SYSTEM_ANDROID_FILE_DESCRIPTOR_MONITOR_H
+#define DALI_INTERNAL_ADAPTOR_SYSTEM_ANDROID_FILE_DESCRIPTOR_MONITOR_H
+
+/*
+ * 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.
+ * 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.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali/internal/system/common/file-descriptor-monitor.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+/**
+ * @brief FileDescriptorMonitorAndroid class provides an FileDescriptorMonitor Android implementation.
+ */
+class FileDescriptorMonitorAndroid : public FileDescriptorMonitor
+{
+public:
+  /**
+   * @copydoc Dali::Internal::Adaptor::FileDescriptorMonitor()
+   */
+  FileDescriptorMonitorAndroid(int fileDescriptor, CallbackBase* callback, int eventBitmask);
+
+  /**
+   * Destructor
+   */
+  ~FileDescriptorMonitorAndroid();
+
+private:
+  // Undefined
+  FileDescriptorMonitorAndroid(const FileDescriptorMonitorAndroid& fileDescriptorMonitor) = delete;
+
+  // Undefined
+  FileDescriptorMonitorAndroid& operator=(const FileDescriptorMonitorAndroid& fileDescriptorMonitor) = delete;
+
+private:
+  struct Impl;
+  Impl* mImpl;
+};
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
+
+#endif // DALI_INTERNAL_ADAPTOR_SYSTEM_ANDROID_FILE_DESCRIPTOR_MONITOR_H
diff --git a/dali/internal/system/android/system-factory-android.cpp b/dali/internal/system/android/system-factory-android.cpp
new file mode 100644 (file)
index 0000000..a5787a6
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * 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.
+ * 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 <dali/internal/system/android/system-factory-android.h>
+
+// INTERNAL HEADERS
+#include <dali/internal/system/android/callback-manager-android.h>
+#include <dali/internal/system/android/file-descriptor-monitor-android.h>
+#include <dali/internal/system/android/timer-impl-android.h>
+#include <dali/internal/window-system/common/display-utils.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+std::unique_ptr<CallbackManager> SystemFactoryAndroid::CreateCallbackManager()
+{
+  return Utils::MakeUnique<AndroidCallbackManager>();
+}
+
+std::unique_ptr<FileDescriptorMonitor> SystemFactoryAndroid::CreateFileDescriptorMonitor(int fileDescriptor, CallbackBase* callback, int eventBitmask)
+{
+  return Utils::MakeUnique<FileDescriptorMonitorAndroid>(fileDescriptor, callback, eventBitmask);
+}
+
+TimerPtr SystemFactoryAndroid::CreateTimer(uint32_t milliSec)
+{
+  return TimerAndroid::New(milliSec);
+}
+
+std::unique_ptr<SystemFactory> GetSystemFactory()
+{
+  return Utils::MakeUnique<SystemFactoryAndroid>();
+}
+
+} // namespace Adaptor
+} // namespace Internal
+} // namespace Dali
diff --git a/dali/internal/system/android/system-factory-android.h b/dali/internal/system/android/system-factory-android.h
new file mode 100644 (file)
index 0000000..255b7f3
--- /dev/null
@@ -0,0 +1,42 @@
+#ifndef DALI_INTERNAL_ADAPTOR_SYSTEM_ANDROID_SYSTEM_FACTORY_H
+#define DALI_INTERNAL_ADAPTOR_SYSTEM_ANDROID_SYSTEM_FACTORY_H
+
+/*
+ * 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.
+ * 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.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali/internal/system/common/system-factory.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+class SystemFactoryAndroid : public SystemFactory
+{
+public:
+  std::unique_ptr<CallbackManager>       CreateCallbackManager() override;
+  std::unique_ptr<FileDescriptorMonitor> CreateFileDescriptorMonitor(int fileDescriptor, CallbackBase* callback, int eventBitmask) override;
+  TimerPtr                               CreateTimer(uint32_t milliSec) override;
+};
+
+} // namespace Adaptor
+} // namespace Internal
+} // namespace Dali
+
+#endif // DALI_INTERNAL_ADAPTOR_SYSTEM_GLIB_SYSTEM_FACTORY_H
index 333228d..6e9aee4 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021 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.
@@ -16,7 +16,7 @@
  */
 
 // CLASS HEADER
-#include <dali/internal/system/common/timer-impl.h>
+#include <dali/internal/system/android/timer-impl-android.h>
 
 // EXTERNAL INCLUDES
 #include <dali/integration-api/adaptor-framework/android/android-framework.h>
@@ -36,7 +36,7 @@ namespace Adaptor
 namespace
 {
 // Copied from x server
-static unsigned int GetCurrentMilliSeconds()
+static uint32_t GetCurrentMilliSeconds()
 {
   struct timeval tv;
 
@@ -73,9 +73,9 @@ static unsigned int GetCurrentMilliSeconds()
 
 } // namespace
 
-struct Timer::Impl
+struct TimerAndroid::Impl
 {
-  Impl(unsigned int milliSec)
+  Impl(uint32_t milliSec)
   : mInterval(milliSec),
     mStartTimestamp(0),
     mPauseTimestamp(0),
@@ -84,25 +84,25 @@ struct Timer::Impl
   {
   }
 
-  unsigned int mInterval;
-  unsigned int mStartTimestamp;
-  unsigned int mPauseTimestamp;
-  bool         mRunning;
-  unsigned int mId;
+  uint32_t mInterval;
+  uint32_t mStartTimestamp;
+  uint32_t mPauseTimestamp;
+  bool     mRunning;
+  uint32_t mId;
 };
 
-TimerPtr Timer::New(unsigned int milliSec)
+TimerAndroidPtr TimerAndroid::New(uint32_t milliSec)
 {
-  TimerPtr timer(new Timer(milliSec));
+  TimerAndroidPtr timer(new TimerAndroid(milliSec));
   return timer;
 }
 
-Timer::Timer(unsigned int milliSec)
+TimerAndroid::TimerAndroid(uint32_t milliSec)
 : mImpl(new Impl(milliSec))
 {
 }
 
-Timer::~Timer()
+TimerAndroid::~TimerAndroid()
 {
   Stop();
   delete mImpl;
@@ -110,7 +110,7 @@ Timer::~Timer()
 
 bool TimerCallback(void* data)
 {
-  Timer* timer = static_cast<Timer*>(data);
+  TimerAndroid* timer = static_cast<TimerAndroid*>(data);
   if(timer->IsRunning())
   {
     return timer->Tick();
@@ -119,7 +119,7 @@ bool TimerCallback(void* data)
   return false;
 }
 
-void Timer::Start()
+void TimerAndroid::Start()
 {
   // Timer should be used in the event thread
   DALI_ASSERT_DEBUG(Adaptor::IsAvailable());
@@ -134,7 +134,7 @@ void Timer::Start()
   mImpl->mStartTimestamp = GetCurrentMilliSeconds();
 }
 
-void Timer::Stop()
+void TimerAndroid::Stop()
 {
   // Timer should be used in the event thread
   DALI_ASSERT_DEBUG(Adaptor::IsAvailable());
@@ -149,7 +149,7 @@ void Timer::Stop()
   ResetTimerData();
 }
 
-void Timer::Pause()
+void TimerAndroid::Pause()
 {
   // Timer should be used in the event thread
   DALI_ASSERT_DEBUG(Adaptor::IsAvailable());
@@ -162,15 +162,15 @@ void Timer::Pause()
   }
 }
 
-void Timer::Resume()
+void TimerAndroid::Resume()
 {
   // Timer should be used in the event thread
   DALI_ASSERT_DEBUG(Adaptor::IsAvailable());
 
   if(mImpl->mRunning && mImpl->mId == 0)
   {
-    unsigned int newInterval = 0;
-    unsigned int runningTime = mImpl->mPauseTimestamp - mImpl->mStartTimestamp;
+    uint32_t newInterval = 0;
+    uint32_t runningTime = mImpl->mPauseTimestamp - mImpl->mStartTimestamp;
     if(mImpl->mInterval > runningTime)
     {
       newInterval = mImpl->mInterval - runningTime;
@@ -182,7 +182,7 @@ void Timer::Resume()
   }
 }
 
-void Timer::SetInterval(unsigned int interval, bool restart)
+void TimerAndroid::SetInterval(uint32_t interval, bool restart)
 {
   // stop existing timer
   Stop();
@@ -195,12 +195,12 @@ void Timer::SetInterval(unsigned int interval, bool restart)
   }
 }
 
-unsigned int Timer::GetInterval() const
+uint32_t TimerAndroid::GetInterval() const
 {
   return mImpl->mInterval;
 }
 
-bool Timer::Tick()
+bool TimerAndroid::Tick()
 {
   // Guard against destruction during signal emission
   Dali::Timer handle(this);
@@ -231,18 +231,13 @@ bool Timer::Tick()
   return retVal;
 }
 
-Dali::Timer::TimerSignalType& Timer::TickSignal()
-{
-  return mTickSignal;
-}
-
-void Timer::ResetTimerData()
+void TimerAndroid::ResetTimerData()
 {
   mImpl->mRunning = false;
   mImpl->mId      = 0;
 }
 
-bool Timer::IsRunning() const
+bool TimerAndroid::IsRunning() const
 {
   return mImpl->mRunning;
 }
diff --git a/dali/internal/system/android/timer-impl-android.h b/dali/internal/system/android/timer-impl-android.h
new file mode 100644 (file)
index 0000000..e72c8b6
--- /dev/null
@@ -0,0 +1,116 @@
+#ifndef DALI_INTERNAL_ADAPTOR_SYSTEM_ANDROID_TIMER_H
+#define DALI_INTERNAL_ADAPTOR_SYSTEM_ANDROID_TIMER_H
+
+/*
+ * 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.
+ * 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.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali/internal/system/common/timer-impl.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+class TimerAndroid;
+
+typedef IntrusivePtr<TimerAndroid> TimerAndroidPtr;
+
+/**
+ * @brief TimerAndroid class provides an Timer Android implementation.
+ */
+class TimerAndroid : public Timer
+{
+public:
+  static TimerAndroidPtr New(uint32_t milliSec);
+
+  /**
+   * Constructor
+   * @param[in]  milliSec  Interval in milliseconds.
+   */
+  TimerAndroid(uint32_t milliSec);
+
+  /**
+   * Destructor.
+   */
+  virtual ~TimerAndroid();
+
+public:
+  /**
+   * @copydoc Dali::Timer::Start()
+   */
+  void Start() override;
+
+  /**
+   * @copydoc Dali::Timer::Stop()
+   */
+  void Stop() override;
+
+  /**
+   * @copydoc Dali::Timer::Pause()
+   */
+  void Pause() override;
+
+  /**
+   * @copydoc Dali::Timer::Resume()
+   */
+  void Resume() override;
+
+  /**
+   * @copydoc Dali::Timer::SetInterval()
+   */
+  void SetInterval(uint32_t interval, bool restart) override;
+
+  /**
+   * @copydoc Dali::Timer::GetInterval()
+   */
+  uint32_t GetInterval() const override;
+
+  /**
+   * @copydoc Dali::Timer::IsRunning()
+   */
+  bool IsRunning() const override;
+
+  /**
+   * Tick
+   */
+  bool Tick();
+
+private: // Implementation
+  // not implemented
+  TimerAndroid(const TimerAndroid&) = delete;
+  TimerAndroid& operator=(const TimerAndroid&) = delete;
+
+  /**
+   * Resets any stored timer data.
+   */
+  void ResetTimerData();
+
+private: // Data
+  // To hide away implementation details
+  struct Impl;
+  Impl* mImpl;
+};
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
+
+#endif // DALI_INTERNAL_ADAPTOR_SYSTEM_ANDROID_TIMER_H
index 2a26eb4..4749be1 100644 (file)
@@ -1,8 +1,8 @@
-#ifndef DALI_INTERNAL_CALLBACK_MANAGER_H
-#define DALI_INTERNAL_CALLBACK_MANAGER_H
+#ifndef DALI_INTERNAL_ADAPTOR_SYSTEM_COMMON_CALLBACK_MANAGER_H
+#define DALI_INTERNAL_ADAPTOR_SYSTEM_COMMON_CALLBACK_MANAGER_H
 
 /*
- * Copyright (c) 2021 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.
@@ -37,11 +37,6 @@ class CallbackManager
 {
 public:
   /**
-     * Create a new call back interface
-     */
-  static CallbackManager* New();
-
-  /**
      * Virtual destructor
      */
   virtual ~CallbackManager()
@@ -152,4 +147,4 @@ private:
 
 } // namespace Dali
 
-#endif // DALI_INTERNAL_CALLBACK_MANAGER_H
+#endif // DALI_INTERNAL_ADAPTOR_SYSTEM_COMMON_CALLBACK_MANAGER_H
index a22f07a..6e9df8f 100644 (file)
@@ -1,8 +1,8 @@
-#ifndef DALI_INTERNAL_FILE_DESCRIPTOR_MONITOR_H
-#define DALI_INTERNAL_FILE_DESCRIPTOR_MONITOR_H
+#ifndef DALI_INTERNAL_ADAPTOR_SYSTEM_COMMON_FILE_DESCRIPTOR_MONITOR_H
+#define DALI_INTERNAL_ADAPTOR_SYSTEM_COMMON_FILE_DESCRIPTOR_MONITOR_H
 
 /*
- * Copyright (c) 2021 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.
 
 namespace Dali
 {
-namespace Integration
-{
-class Core;
-}
-
 namespace Internal
 {
 namespace Adaptor
@@ -83,12 +78,14 @@ public:
    * readable or writable even when it isn’t. The developer should check for handle EAGAIN or equivalent
    * when reading from or write to the fd.
    */
-  FileDescriptorMonitor(int fileDescriptor, CallbackBase* callback, int eventBitmask);
+  FileDescriptorMonitor(int fileDescriptor, CallbackBase* callback, int eventBitmask)
+  {
+  }
 
   /**
    * Destructor
    */
-  ~FileDescriptorMonitor();
+  virtual ~FileDescriptorMonitor() = default;
 
 private:
   // Undefined
@@ -96,10 +93,6 @@ private:
 
   // Undefined
   FileDescriptorMonitor& operator=(const FileDescriptorMonitor& fileDescriptorMonitor);
-
-private:
-  struct Impl;
-  Impl* mImpl;
 };
 
 } // namespace Adaptor
@@ -108,4 +101,4 @@ private:
 
 } // namespace Dali
 
-#endif // DALI_INTERNAL_FILE_DESCRIPTOR_MONITOR_H
+#endif // DALI_INTERNAL_ADAPTOR_SYSTEM_COMMON_FILE_DESCRIPTOR_MONITOR_H
diff --git a/dali/internal/system/common/system-factory.h b/dali/internal/system/common/system-factory.h
new file mode 100644 (file)
index 0000000..62c4c45
--- /dev/null
@@ -0,0 +1,52 @@
+#ifndef DALI_INTERNAL_ADAPTOR_SYSTEM_COMMON_SYSTEM_FACTORY_H
+#define DALI_INTERNAL_ADAPTOR_SYSTEM_COMMON_SYSTEM_FACTORY_H
+
+/*
+ * 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.
+ * 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 <memory>
+
+// INTERNAL INCLUDES
+#include <dali/internal/system/common/timer-impl.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+class CallbackManager;
+class FileDescriptorMonitor;
+
+class SystemFactory
+{
+public:
+  SystemFactory()          = default;
+  virtual ~SystemFactory() = default;
+
+  virtual std::unique_ptr<CallbackManager>       CreateCallbackManager()                                                                   = 0;
+  virtual std::unique_ptr<FileDescriptorMonitor> CreateFileDescriptorMonitor(int fileDescriptor, CallbackBase* callback, int eventBitmask) = 0;
+  virtual TimerPtr                               CreateTimer(uint32_t milliSec)                                                            = 0;
+};
+
+extern std::unique_ptr<SystemFactory> GetSystemFactory();
+
+} // namespace Adaptor
+} // namespace Internal
+} // namespace Dali
+
+#endif // DALI_INTERNAL_ADAPTOR_SYSTEM_COMMON_SYSTEM_FACTORY_H
index ab86d83..395d4ff 100644 (file)
@@ -1,8 +1,8 @@
-#ifndef DALI_INTERNAL_TIMER_H
-#define DALI_INTERNAL_TIMER_H
+#ifndef DALI_INTERNAL_ADAPTOR_SYSTEM_COMMON_TIMER_H
+#define DALI_INTERNAL_ADAPTOR_SYSTEM_COMMON_TIMER_H
 
 /*
- * Copyright (c) 2021 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.
@@ -24,7 +24,6 @@
 // INTERNAL INCLUDES
 #include <dali/internal/system/common/timer-interface.h>
 #include <dali/public-api/adaptor-framework/timer.h>
-#include <dali/public-api/dali-adaptor-common.h>
 
 namespace Dali
 {
@@ -42,79 +41,29 @@ typedef IntrusivePtr<Timer> TimerPtr;
 class Timer : public BaseObject, public TimerInterface
 {
 public:
-  static TimerPtr New(unsigned int milliSec);
-
   /**
    * Constructor
-   * @param[in]  milliSec  Interval in milliseconds.
    */
-  Timer(unsigned int milliSec);
+  Timer() = default;
 
   /**
    * Destructor.
    */
-  virtual ~Timer();
-
-public:
-  /**
-   * @copydoc Dali::Timer::Start()
-   */
-  void Start() override;
-
-  /**
-   * @copydoc Dali::Timer::Stop()
-   */
-  void Stop() override;
-
-  /**
-   * @copydoc Dali::Timer::Pause()
-   */
-  void Pause() override;
-
-  /**
-   * @copydoc Dali::Timer::Resume()
-   */
-  void Resume() override;
-
-  /**
-   * @copydoc Dali::Timer::SetInterval()
-   */
-  void SetInterval(unsigned int interval, bool restart) override;
-
-  /**
-   * @copydoc Dali::Timer::GetInterval()
-   */
-  unsigned int GetInterval() const override;
-
-  /**
-   * @copydoc Dali::Timer::IsRunning()
-   */
-  bool IsRunning() const override;
-
-  /**
-   * Tick
-   */
-  bool Tick();
+  virtual ~Timer() = default;
 
 public: // Signals
-  Dali::Timer::TimerSignalType& TickSignal();
+  Dali::Timer::TimerSignalType& TickSignal()
+  {
+    return mTickSignal;
+  }
 
 private: // Implementation
   // not implemented
-  Timer(const Timer&);
-  Timer& operator=(const Timer&);
+  Timer(const Timer&) = delete;
+  Timer& operator=(const Timer&) = delete;
 
-  /**
-   * Resets any stored timer data.
-   */
-  void ResetTimerData();
-
-private: // Data
+protected: // Data
   Dali::Timer::TimerSignalType mTickSignal;
-
-  // To hide away implementation details
-  struct Impl;
-  Impl* mImpl;
 };
 
 inline Timer& GetImplementation(Dali::Timer& timer)
@@ -141,4 +90,4 @@ inline const Timer& GetImplementation(const Dali::Timer& timer)
 
 } // namespace Dali
 
-#endif // DALI_INTERNAL_TIMER_H
+#endif // DALI_INTERNAL_ADAPTOR_SYSTEM_COMMON_TIMER_H
index c6106cb..2a87658 100644 (file)
@@ -1,8 +1,8 @@
-#ifndef DALI_INTERNAL_ADAPTOR_BASE_TIMER_INTERFACE_H
-#define DALI_INTERNAL_ADAPTOR_BASE_TIMER_INTERFACE_H
+#ifndef DALI_INTERNAL_ADAPTOR_SYSTEM_COMMON_TIMER_INTERFACE_H
+#define DALI_INTERNAL_ADAPTOR_SYSTEM_COMMON_TIMER_INTERFACE_H
 
 /*
- * Copyright (c) 2021 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.
@@ -18,6 +18,9 @@
  *
  */
 
+// EXTERNAL INCLUDES
+#include <cstdint>
+
 namespace Dali
 {
 namespace Internal
@@ -53,12 +56,12 @@ public:
   /**
    * @copydoc Dali::Timer::SetInterval()
    */
-  virtual void SetInterval(unsigned int intervalInMilliseconds, bool restart) = 0;
+  virtual void SetInterval(uint32_t intervalInMilliseconds, bool restart) = 0;
 
   /**
    * @copydoc Dali::Timer::GetInterval()
    */
-  virtual unsigned int GetInterval() const = 0;
+  virtual uint32_t GetInterval() const = 0;
 
   /**
    * @copydoc Dali::Timer::IsRunning()
@@ -78,4 +81,4 @@ protected:
 } // namespace Internal
 } // namespace Dali
 
-#endif // DALI_INTERNAL_ADAPTOR_BASE_TIMER_INTERFACE_H
+#endif // DALI_INTERNAL_ADAPTOR_SYSTEM_COMMON_TIMER_INTERFACE_H
index 8f769af..2811689 100644 (file)
@@ -25,8 +25,8 @@
 #include <dali/integration-api/debug.h>
 
 // INTERNAL INCLUDES
-
 #include <dali/internal/system/common/file-descriptor-monitor.h>
+#include <dali/internal/system/common/system-factory.h>
 
 namespace Dali
 {
@@ -35,7 +35,7 @@ namespace Internal
 namespace Adaptor
 {
 TriggerEvent::TriggerEvent(CallbackBase* callback, TriggerEventInterface::Options options)
-: mFileDescriptorMonitor(NULL),
+: mFileDescriptorMonitor(),
   mCallback(callback),
   mFileDescriptor(-1),
   mOptions(options)
@@ -45,7 +45,7 @@ TriggerEvent::TriggerEvent(CallbackBase* callback, TriggerEventInterface::Option
   if(mFileDescriptor >= 0)
   {
     // Now Monitor the created event file descriptor
-    mFileDescriptorMonitor = new FileDescriptorMonitor(mFileDescriptor, MakeCallback(this, &TriggerEvent::Triggered), FileDescriptorMonitor::FD_READABLE);
+    mFileDescriptorMonitor = Dali::Internal::Adaptor::GetSystemFactory()->CreateFileDescriptorMonitor(mFileDescriptor, MakeCallback(this, &TriggerEvent::Triggered), FileDescriptorMonitor::FD_READABLE);
   }
   else
   {
@@ -55,7 +55,6 @@ TriggerEvent::TriggerEvent(CallbackBase* callback, TriggerEventInterface::Option
 
 TriggerEvent::~TriggerEvent()
 {
-  delete mFileDescriptorMonitor;
   delete mCallback;
 
   if(mFileDescriptor >= 0)
index 51221a5..8dd3242 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_INTERNAL_TRIGGER_EVENT_H
 
 /*
- * Copyright (c) 2021 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.
@@ -20,6 +20,7 @@
 
 // EXTERNAL INCLUDES
 #include <dali/public-api/signals/callback.h>
+#include <memory>
 
 // INTERNAL INCLUDES
 #include <dali/integration-api/adaptor-framework/trigger-event-interface.h>
@@ -81,10 +82,10 @@ private:
   struct Source;
 
 private:
-  FileDescriptorMonitor*         mFileDescriptorMonitor;
-  CallbackBase*                  mCallback;
-  int                            mFileDescriptor;
-  TriggerEventInterface::Options mOptions;
+  std::unique_ptr<FileDescriptorMonitor> mFileDescriptorMonitor;
+  CallbackBase*                          mCallback;
+  int                                    mFileDescriptor;
+  TriggerEventInterface::Options         mOptions;
 };
 
 } // namespace Adaptor
index c22e0b2..a8f439a 100644 (file)
@@ -35,6 +35,7 @@ SET( adaptor_system_linux_src_files
     ${adaptor_system_dir}/linux/file-descriptor-monitor-ecore.cpp
     ${adaptor_system_dir}/generic/shared-file-operations-generic.cpp
     ${adaptor_system_dir}/common/time-service.cpp
+    ${adaptor_system_dir}/linux/system-factory-ecore.cpp
     ${adaptor_system_dir}/linux/timer-impl-ecore.cpp
 )
 
@@ -77,6 +78,7 @@ SET( adaptor_system_libuv_src_files
     ${adaptor_system_dir}/generic/shared-file-operations-generic.cpp
     ${adaptor_system_dir}/libuv/callback-manager-libuv.cpp
     ${adaptor_system_dir}/libuv/file-descriptor-monitor-libuv.cpp
+    ${adaptor_system_dir}/linuv/system-factory-libuv.cpp
     ${adaptor_system_dir}/libuv/timer-impl-libuv.cpp
     ${adaptor_system_dir}/ubuntu-x11/logging-x.cpp
     ${adaptor_system_dir}/ubuntu-x11/system-settings-x.cpp
@@ -93,6 +95,7 @@ SET( adaptor_system_glib_src_files
     ${adaptor_system_dir}/generic/shared-file-operations-generic.cpp
     ${adaptor_system_dir}/glib/callback-manager-glib.cpp
     ${adaptor_system_dir}/glib/file-descriptor-monitor-glib.cpp
+    ${adaptor_system_dir}/glib/system-factory-glib.cpp
     ${adaptor_system_dir}/glib/timer-impl-glib.cpp
     ${adaptor_system_dir}/ubuntu-x11/logging-x.cpp
     ${adaptor_system_dir}/ubuntu-x11/system-settings-x.cpp
@@ -109,6 +112,7 @@ SET( adaptor_system_android_src_files
     ${adaptor_system_dir}/android/file-descriptor-monitor-android.cpp
     ${adaptor_system_dir}/android/logging-android.cpp
     ${adaptor_system_dir}/android/shared-file-operations-android.cpp
+    ${adaptor_system_dir}/android/system-factory-android.cpp
     ${adaptor_system_dir}/android/system-settings-android.cpp
     ${adaptor_system_dir}/android/timer-impl-android.cpp
     ${adaptor_system_dir}/common/time-service.cpp
@@ -119,6 +123,7 @@ SET( adaptor_system_android_src_files
 SET( adaptor_system_windows_src_files
     ${adaptor_system_dir}/windows/callback-manager-win.cpp
     ${adaptor_system_dir}/windows/file-descriptor-monitor-windows.cpp
+    ${adaptor_system_dir}/windows/system-factory-win.cpp
     ${adaptor_system_dir}/windows/system-settings-win.cpp
     ${adaptor_system_dir}/windows/timer-impl-win.cpp
     ${adaptor_system_dir}/windows/trigger-event.cpp
@@ -133,6 +138,7 @@ SET( adaptor_system_windows_src_files
 SET( adaptor_system_macos_src_files
     ${adaptor_system_dir}/ubuntu-x11/logging-x.cpp
     ${adaptor_system_dir}/macos/file-descriptor-monitor-macos.cpp
+    ${adaptor_system_dir}/macos/system-factory-mac.cpp
     ${adaptor_system_dir}/macos/system-settings-mac.cpp
     ${adaptor_system_dir}/macos/timer-impl-mac.cpp
     ${adaptor_system_dir}/common/shared-file.cpp
index 948a659..4b25bd3 100644 (file)
@@ -228,12 +228,6 @@ void GlibCallbackManager::RemoveCallbackFromContainer(CallbackData* callbackData
   mCallbackContainer.remove(callbackData);
 }
 
-// Creates a concrete interface for CallbackManager
-CallbackManager* CallbackManager::New()
-{
-  return new GlibCallbackManager;
-}
-
 } // namespace Adaptor
 
 } // namespace Internal
index de2becf..fb3a2c0 100644 (file)
@@ -1,8 +1,8 @@
-#ifndef DALI_ADAPTOR_GLIB_CALLBACK_MANAGER_H
-#define DALI_ADAPTOR_GLIB_CALLBACK_MANAGER_H
+#ifndef DALI_INTERNAL_ADAPTOR_SYSTEM_GLIB_CALLBACK_MANAGER_H
+#define DALI_INTERNAL_ADAPTOR_SYSTEM_GLIB_CALLBACK_MANAGER_H
 
 /*
- * Copyright (c) 2022 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.
@@ -97,6 +97,11 @@ private:
    */
   void RemoveCallbackFromContainer(CallbackData* callbackData);
 
+  // Undefined
+  GlibCallbackManager(const GlibCallbackManager&) = delete;
+  GlibCallbackManager& operator=(GlibCallbackManager&) = delete;
+
+private:
   typedef std::list<CallbackData*> CallbackList; ///< list of callbacks installed
 
   bool         mRunning;           ///< flag is set to true if when running
@@ -109,4 +114,4 @@ private:
 
 } // namespace Dali
 
-#endif // DALI_ADAPTOR_GLIB_CALLBACK_MANAGER_H
+#endif // DALI_INTERNAL_ADAPTOR_SYSTEM_GLIB_CALLBACK_MANAGER_H
index c8b7589..572641f 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2022 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.
@@ -16,7 +16,7 @@
  */
 
 // CLASS HEADER
-#include <dali/internal/system/common/file-descriptor-monitor.h>
+#include <dali/internal/system/glib/file-descriptor-monitor-glib.h>
 
 // EXTERNAL INCLUDES
 #include <dali/integration-api/debug.h>
@@ -34,7 +34,7 @@ extern GMainContext* GetMainLoopContext();
 /**
  * Using Impl to hide away framework specific members
  */
-struct FileDescriptorMonitor::Impl
+struct FileDescriptorMonitorGlib::Impl
 {
 public:
   // Constructor
@@ -62,7 +62,7 @@ public:
   {
     if(userData)
     {
-      FileDescriptorMonitor::Impl* impl = static_cast<FileDescriptorMonitor::Impl*>(userData);
+      FileDescriptorMonitorGlib::Impl* impl = static_cast<FileDescriptorMonitorGlib::Impl*>(userData);
 
       // filter the events that have occured based on what we are monitoring
       int eventType = FileDescriptorMonitor::FD_NO_EVENT;
@@ -91,7 +91,8 @@ public:
   GSource*      mPollSource;
 };
 
-FileDescriptorMonitor::FileDescriptorMonitor(int fileDescriptor, CallbackBase* callback, int eventBitmask)
+FileDescriptorMonitorGlib::FileDescriptorMonitorGlib(int fileDescriptor, CallbackBase* callback, int eventBitmask)
+: FileDescriptorMonitor(fileDescriptor, callback, eventBitmask)
 {
   if(fileDescriptor < 1)
   {
@@ -114,7 +115,7 @@ FileDescriptorMonitor::FileDescriptorMonitor(int fileDescriptor, CallbackBase* c
   mImpl = new Impl(fileDescriptor, callback, static_cast<GIOCondition>(events));
 }
 
-FileDescriptorMonitor::~FileDescriptorMonitor()
+FileDescriptorMonitorGlib::~FileDescriptorMonitorGlib()
 {
   delete mImpl;
 }
diff --git a/dali/internal/system/glib/file-descriptor-monitor-glib.h b/dali/internal/system/glib/file-descriptor-monitor-glib.h
new file mode 100644 (file)
index 0000000..c30ab83
--- /dev/null
@@ -0,0 +1,64 @@
+#ifndef DALI_INTERNAL_ADAPTOR_SYSTEM_GLIB_FILE_DESCRIPTOR_MONITOR_H
+#define DALI_INTERNAL_ADAPTOR_SYSTEM_GLIB_FILE_DESCRIPTOR_MONITOR_H
+
+/*
+ * 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.
+ * 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.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali/internal/system/common/file-descriptor-monitor.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+/**
+ * @brief FileDescriptorMonitorGlib class provides an FileDescriptorMonitor Glib implementation.
+ */
+class FileDescriptorMonitorGlib : public FileDescriptorMonitor
+{
+public:
+  /**
+   * @copydoc Dali::Internal::Adaptor::FileDescriptorMonitor()
+   */
+  FileDescriptorMonitorGlib(int fileDescriptor, CallbackBase* callback, int eventBitmask);
+
+  /**
+   * Destructor
+   */
+  ~FileDescriptorMonitorGlib();
+
+private:
+  // Undefined
+  FileDescriptorMonitorGlib(const FileDescriptorMonitorGlib& fileDescriptorMonitor) = delete;
+
+  // Undefined
+  FileDescriptorMonitorGlib& operator=(const FileDescriptorMonitorGlib& fileDescriptorMonitor) = delete;
+
+private:
+  struct Impl;
+  Impl* mImpl;
+};
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
+
+#endif // DALI_INTERNAL_ADAPTOR_SYSTEM_GLIB_FILE_DESCRIPTOR_MONITOR_H
diff --git a/dali/internal/system/glib/system-factory-glib.cpp b/dali/internal/system/glib/system-factory-glib.cpp
new file mode 100644 (file)
index 0000000..540cc6c
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * 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.
+ * 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 <dali/internal/system/glib/system-factory-glib.h>
+
+// INTERNAL HEADERS
+#include <dali/internal/system/glib/callback-manager-glib.h>
+#include <dali/internal/system/glib/file-descriptor-monitor-glib.h>
+#include <dali/internal/system/glib/timer-impl-glib.h>
+#include <dali/internal/window-system/common/display-utils.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+std::unique_ptr<CallbackManager> SystemFactoryGlib::CreateCallbackManager()
+{
+  return Utils::MakeUnique<GlibCallbackManager>();
+}
+
+std::unique_ptr<FileDescriptorMonitor> SystemFactoryGlib::CreateFileDescriptorMonitor(int fileDescriptor, CallbackBase* callback, int eventBitmask)
+{
+  return Utils::MakeUnique<FileDescriptorMonitorGlib>(fileDescriptor, callback, eventBitmask);
+}
+
+TimerPtr SystemFactoryGlib::CreateTimer(uint32_t milliSec)
+{
+  return TimerGlib::New(milliSec);
+}
+
+std::unique_ptr<SystemFactory> GetSystemFactory()
+{
+  return Utils::MakeUnique<SystemFactoryGlib>();
+}
+
+} // namespace Adaptor
+} // namespace Internal
+} // namespace Dali
diff --git a/dali/internal/system/glib/system-factory-glib.h b/dali/internal/system/glib/system-factory-glib.h
new file mode 100644 (file)
index 0000000..0d163e7
--- /dev/null
@@ -0,0 +1,42 @@
+#ifndef DALI_INTERNAL_ADAPTOR_SYSTEM_GLIB_SYSTEM_FACTORY_H
+#define DALI_INTERNAL_ADAPTOR_SYSTEM_GLIB_SYSTEM_FACTORY_H
+
+/*
+ * 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.
+ * 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.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali/internal/system/common/system-factory.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+class SystemFactoryGlib : public SystemFactory
+{
+public:
+  std::unique_ptr<CallbackManager>       CreateCallbackManager() override;
+  std::unique_ptr<FileDescriptorMonitor> CreateFileDescriptorMonitor(int fileDescriptor, CallbackBase* callback, int eventBitmask) override;
+  TimerPtr                               CreateTimer(uint32_t milliSec) override;
+};
+
+} // namespace Adaptor
+} // namespace Internal
+} // namespace Dali
+
+#endif // DALI_INTERNAL_ADAPTOR_SYSTEM_GLIB_SYSTEM_FACTORY_H
index 3277179..2fc64ef 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2022 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.
@@ -16,7 +16,7 @@
  */
 
 // CLASS HEADER
-#include <dali/internal/system/common/timer-impl.h>
+#include <dali/internal/system/glib/timer-impl-glib.h>
 
 // INTERNAL INCLUDES
 #include <dali/integration-api/debug.h>
@@ -34,7 +34,7 @@ namespace
 {
 gboolean TimerSourceFunc(gpointer userData)
 {
-  Timer* timer = static_cast<Timer*>(userData);
+  TimerGlib* timer = static_cast<TimerGlib*>(userData);
 
   bool keepRunning = timer->Tick();
   return keepRunning ? G_SOURCE_CONTINUE : G_SOURCE_REMOVE;
@@ -42,39 +42,39 @@ gboolean TimerSourceFunc(gpointer userData)
 
 } // unnamed namespace
 
-struct Timer::Impl
+struct TimerGlib::Impl
 {
-  Impl(unsigned int milliSec)
+  Impl(uint32_t milliSec)
   : mInterval(milliSec)
   {
   }
 
-  GSource*     mTimerHandle{nullptr};
-  unsigned int mInterval{0};
-  uint32_t     mStartTimestamp{0};
-  uint32_t     mPauseTimestamp{0};
-  bool         mRunning{false};
-  bool         mRestartAfterExpiry{false}; // Restart at full interval after pause/resume/expiry
+  GSource* mTimerHandle{nullptr};
+  uint32_t mInterval{0};
+  uint32_t mStartTimestamp{0};
+  uint32_t mPauseTimestamp{0};
+  bool     mRunning{false};
+  bool     mRestartAfterExpiry{false}; // Restart at full interval after pause/resume/expiry
 };
 
-TimerPtr Timer::New(unsigned int milliSec)
+TimerGlibPtr TimerGlib::New(uint32_t milliSec)
 {
-  TimerPtr timer(new Timer(milliSec));
+  TimerGlibPtr timer(new TimerGlib(milliSec));
   return timer;
 }
 
-Timer::Timer(unsigned int milliSec)
+TimerGlib::TimerGlib(uint32_t milliSec)
 : mImpl(new Impl(milliSec))
 {
 }
 
-Timer::~Timer()
+TimerGlib::~TimerGlib()
 {
   Stop();
   delete mImpl;
 }
 
-void Timer::Start()
+void TimerGlib::Start()
 {
   if(mImpl->mRunning && mImpl->mTimerHandle)
   {
@@ -89,7 +89,7 @@ void Timer::Start()
   mImpl->mStartTimestamp = TimeService::GetMilliSeconds();
 }
 
-void Timer::Stop()
+void TimerGlib::Stop()
 {
   if(mImpl->mTimerHandle != nullptr)
   {
@@ -104,7 +104,7 @@ void Timer::Stop()
   ResetTimerData();
 }
 
-void Timer::Pause()
+void TimerGlib::Pause()
 {
   if(mImpl->mRunning)
   {
@@ -115,7 +115,7 @@ void Timer::Pause()
   }
 }
 
-void Timer::Resume()
+void TimerGlib::Resume()
 {
   if(mImpl->mRunning && mImpl->mTimerHandle == nullptr)
   {
@@ -137,7 +137,7 @@ void Timer::Resume()
   }
 }
 
-void Timer::SetInterval(unsigned int interval, bool restart)
+void TimerGlib::SetInterval(uint32_t interval, bool restart)
 {
   // stop existing timer
   Stop();
@@ -150,12 +150,12 @@ void Timer::SetInterval(unsigned int interval, bool restart)
   }
 }
 
-unsigned int Timer::GetInterval() const
+uint32_t TimerGlib::GetInterval() const
 {
   return mImpl->mInterval;
 }
 
-bool Timer::Tick()
+bool TimerGlib::Tick()
 {
   // Guard against destruction during signal emission
   Dali::Timer handle(this);
@@ -195,12 +195,7 @@ bool Timer::Tick()
   return retVal;
 }
 
-Dali::Timer::TimerSignalType& Timer::TickSignal()
-{
-  return mTickSignal;
-}
-
-void Timer::ResetTimerData()
+void TimerGlib::ResetTimerData()
 {
   mImpl->mRunning = false;
   if(mImpl->mTimerHandle)
@@ -210,7 +205,7 @@ void Timer::ResetTimerData()
   mImpl->mTimerHandle = nullptr;
 }
 
-bool Timer::IsRunning() const
+bool TimerGlib::IsRunning() const
 {
   return mImpl->mRunning;
 }
diff --git a/dali/internal/system/glib/timer-impl-glib.h b/dali/internal/system/glib/timer-impl-glib.h
new file mode 100644 (file)
index 0000000..1689d15
--- /dev/null
@@ -0,0 +1,116 @@
+#ifndef DALI_INTERNAL_ADAPTOR_SYSTEM_GLIB_TIMER_H
+#define DALI_INTERNAL_ADAPTOR_SYSTEM_GLIB_TIMER_H
+
+/*
+ * 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.
+ * 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.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali/internal/system/common/timer-impl.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+class TimerGlib;
+
+typedef IntrusivePtr<TimerGlib> TimerGlibPtr;
+
+/**
+ * @brief TimerGlib class provides an Timer Glib implementation.
+ */
+class TimerGlib : public Timer
+{
+public:
+  static TimerGlibPtr New(uint32_t milliSec);
+
+  /**
+   * Constructor
+   * @param[in]  milliSec  Interval in milliseconds.
+   */
+  TimerGlib(uint32_t milliSec);
+
+  /**
+   * Destructor.
+   */
+  virtual ~TimerGlib();
+
+public:
+  /**
+   * @copydoc Dali::Timer::Start()
+   */
+  void Start() override;
+
+  /**
+   * @copydoc Dali::Timer::Stop()
+   */
+  void Stop() override;
+
+  /**
+   * @copydoc Dali::Timer::Pause()
+   */
+  void Pause() override;
+
+  /**
+   * @copydoc Dali::Timer::Resume()
+   */
+  void Resume() override;
+
+  /**
+   * @copydoc Dali::Timer::SetInterval()
+   */
+  void SetInterval(uint32_t interval, bool restart) override;
+
+  /**
+   * @copydoc Dali::Timer::GetInterval()
+   */
+  uint32_t GetInterval() const override;
+
+  /**
+   * @copydoc Dali::Timer::IsRunning()
+   */
+  bool IsRunning() const override;
+
+  /**
+   * Tick
+   */
+  bool Tick();
+
+private: // Implementation
+  // not implemented
+  TimerGlib(const TimerGlib&) = delete;
+  TimerGlib& operator=(const TimerGlib&) = delete;
+
+  /**
+   * Resets any stored timer data.
+   */
+  void ResetTimerData();
+
+private: // Data
+  // To hide away implementation details
+  struct Impl;
+  Impl* mImpl;
+};
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
+
+#endif // DALI_INTERNAL_ADAPTOR_SYSTEM_GLIB_TIMER_H
index 072c1aa..72326f9 100644 (file)
@@ -236,12 +236,6 @@ void UvCallbackManager::RemoveCallbackFromContainer(CallbackData* callbackData)
   mCallbackContainer.remove(callbackData);
 }
 
-// Creates a concrete interface for CallbackManager
-CallbackManager* CallbackManager::New()
-{
-  return new UvCallbackManager;
-}
-
 } // namespace Adaptor
 
 } // namespace Internal
index e07c6e2..b7ff410 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef __DALI_UV_CALLBACK_MANAGER_H__
-#define __DALI_UV_CALLBACK_MANAGER_H__
+#ifndef DALI_INTERNAL_ADAPTOR_SYSTEM_LIBUV_CALLBACK_MANAGER_H
+#define DALI_INTERNAL_ADAPTOR_SYSTEM_LIBUV_CALLBACK_MANAGER_H
 
 /*
  * Copyright (c) 2016 Samsung Electronics Co., Ltd.
@@ -97,6 +97,11 @@ private:
      */
   void RemoveCallbackFromContainer(CallbackData* callbackData);
 
+  // Undefined
+  UvCallbackManager(const UvCallbackManager&) = delete;
+  UvCallbackManager& operator=(UvCallbackManager&) = delete;
+
+private:
   typedef std::list<CallbackData*> CallbackList; ///< list of callbacks installed
 
   bool         mRunning;           ///< flag is set to true if when running
@@ -109,4 +114,4 @@ private:
 
 } // namespace Dali
 
-#endif // __DALI_UV_CALLBACK_MANAGER_H__
+#endif // DALI_INTERNAL_ADAPTOR_SYSTEM_LIBUV_CALLBACK_MANAGER_H
index a946dc4..54da49b 100644 (file)
@@ -16,7 +16,7 @@
  */
 
 // CLASS HEADER
-#include <dali/internal/system/common/file-descriptor-monitor.h>
+#include <dali/internal/system/libuv/file-descriptor-monitor-libuv.h>
 
 // EXTERNAL INCLUDES
 #include <dali/integration-api/debug.h>
@@ -42,7 +42,7 @@ void FreeHandleCallback(uv_handle_t* handle)
 /**
  * Using Impl to hide away UV specific members
  */
-struct FileDescriptorMonitor::Impl
+struct FileDescriptorMonitorLibuv::Impl
 {
 public:
   // Constructor
@@ -79,7 +79,7 @@ public:
   {
     if(handle->data)
     {
-      FileDescriptorMonitor::Impl* impl = static_cast<FileDescriptorMonitor::Impl*>(handle->data);
+      FileDescriptorMonitorLibuv::Impl* impl = static_cast<FileDescriptorMonitorLibuv::Impl*>(handle->data);
 
       if(status < 0)
       {
@@ -114,7 +114,8 @@ public:
   uv_poll_t*    pollHandle;
 };
 
-FileDescriptorMonitor::FileDescriptorMonitor(int fileDescriptor, CallbackBase* callback, int eventBitmask)
+FileDescriptorMonitorLibuv::FileDescriptorMonitorLibuv(int fileDescriptor, CallbackBase* callback, int eventBitmask)
+: FileDescriptorMonitor(fileDescriptor, callback, eventBitmask)
 {
   if(fileDescriptor < 1)
   {
@@ -137,7 +138,7 @@ FileDescriptorMonitor::FileDescriptorMonitor(int fileDescriptor, CallbackBase* c
   mImpl = new Impl(fileDescriptor, callback, static_cast<uv_poll_event>(events));
 }
 
-FileDescriptorMonitor::~FileDescriptorMonitor()
+FileDescriptorMonitorLibuv::~FileDescriptorMonitorLibuv()
 {
   delete mImpl;
 }
diff --git a/dali/internal/system/libuv/file-descriptor-monitor-libuv.h b/dali/internal/system/libuv/file-descriptor-monitor-libuv.h
new file mode 100644 (file)
index 0000000..1cc6750
--- /dev/null
@@ -0,0 +1,64 @@
+#ifndef DALI_INTERNAL_ADAPTOR_SYSTEM_LIBUV_FILE_DESCRIPTOR_MONITOR_H
+#define DALI_INTERNAL_ADAPTOR_SYSTEM_LIBUV_FILE_DESCRIPTOR_MONITOR_H
+
+/*
+ * 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.
+ * 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.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali/internal/system/common/file-descriptor-monitor.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+/**
+ * @brief FileDescriptorMonitorLibuv class provides an FileDescriptorMonitor Libuv implementation.
+ */
+class FileDescriptorMonitorLibuv : public FileDescriptorMonitor
+{
+public:
+  /**
+   * @copydoc Dali::Internal::Adaptor::FileDescriptorMonitor()
+   */
+  FileDescriptorMonitorLibuv(int fileDescriptor, CallbackBase* callback, int eventBitmask);
+
+  /**
+   * Destructor
+   */
+  ~FileDescriptorMonitorLibuv();
+
+private:
+  // Undefined
+  FileDescriptorMonitorLibuv(const FileDescriptorMonitorLibuv& fileDescriptorMonitor) = delete;
+
+  // Undefined
+  FileDescriptorMonitorLibuv& operator=(const FileDescriptorMonitorLibuv& fileDescriptorMonitor) = delete;
+
+private:
+  struct Impl;
+  Impl* mImpl;
+};
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
+
+#endif // DALI_INTERNAL_ADAPTOR_SYSTEM_LIBUV_FILE_DESCRIPTOR_MONITOR_H
diff --git a/dali/internal/system/libuv/system-factory-libuv.cpp b/dali/internal/system/libuv/system-factory-libuv.cpp
new file mode 100644 (file)
index 0000000..6aa6d9d
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * 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.
+ * 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 <dali/internal/system/libuv/system-factory-libuv.h>
+
+// INTERNAL HEADERS
+#include <dali/internal/system/libuv/callback-manager-libuv.h>
+#include <dali/internal/system/libuv/file-descriptor-monitor-libuv.h>
+#include <dali/internal/system/libuv/timer-impl-libuv.h>
+#include <dali/internal/window-system/common/display-utils.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+std::unique_ptr<CallbackManager> SystemFactoryLibuv::CreateCallbackManager()
+{
+  return Utils::MakeUnique<UvCallbackManager>();
+}
+
+std::unique_ptr<FileDescriptorMonitor> SystemFactoryLibuv::CreateFileDescriptorMonitor(int fileDescriptor, CallbackBase* callback, int eventBitmask)
+{
+  return Utils::MakeUnique<FileDescriptorMonitorLibuv>(fileDescriptor, callback, eventBitmask);
+}
+
+TimerPtr SystemFactoryLibuv::CreateTimer(uint32_t milliSec)
+{
+  return TimerLibuv::New(milliSec);
+}
+
+std::unique_ptr<SystemFactory> GetSystemFactory()
+{
+  return Utils::MakeUnique<SystemFactoryLibuv>();
+}
+
+} // namespace Adaptor
+} // namespace Internal
+} // namespace Dali
diff --git a/dali/internal/system/libuv/system-factory-libuv.h b/dali/internal/system/libuv/system-factory-libuv.h
new file mode 100644 (file)
index 0000000..e93ce2f
--- /dev/null
@@ -0,0 +1,42 @@
+#ifndef DALI_INTERNAL_ADAPTOR_SYSTEM_LIBUV_SYSTEM_FACTORY_H
+#define DALI_INTERNAL_ADAPTOR_SYSTEM_LIBUV_SYSTEM_FACTORY_H
+
+/*
+ * 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.
+ * 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.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali/internal/system/common/system-factory.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+class SystemFactoryLibuv : public SystemFactory
+{
+public:
+  std::unique_ptr<CallbackManager>       CreateCallbackManager() override;
+  std::unique_ptr<FileDescriptorMonitor> CreateFileDescriptorMonitor(int fileDescriptor, CallbackBase* callback, int eventBitmask) override;
+  TimerPtr                               CreateTimer(uint32_t milliSec) override;
+};
+
+} // namespace Adaptor
+} // namespace Internal
+} // namespace Dali
+
+#endif // DALI_INTERNAL_ADAPTOR_SYSTEM_LIBUV_SYSTEM_FACTORY_H
index 7a47119..00b3a62 100644 (file)
@@ -16,7 +16,7 @@
  */
 
 // CLASS HEADER
-#include <dali/internal/system/common/timer-impl.h>
+#include <dali/internal/system/libuv/timer-impl-libuv.h>
 
 // INTERNAL INCLUDES
 #include <dali/integration-api/debug.h>
@@ -36,7 +36,7 @@ namespace
 {
 void TimerSourceFunc(uv_timer_t* handle)
 {
-  Timer* timer = static_cast<Timer*>(handle->data);
+  TimerLibuv* timer = static_cast<TimerLibuv*>(handle->data);
 
   bool keepRunning = timer->Tick();
   if(!keepRunning)
@@ -54,9 +54,9 @@ void FreeHandleCallback(uv_handle_t* handle)
 /**
  * Struct to hide away libuv implementation details
  */
-struct Timer::Impl
+struct TimerLibuv::Impl
 {
-  Impl(unsigned int milliSec)
+  Impl(uint32_t milliSec)
   : mTimerHandle(NULL),
     mInterval(milliSec),
     mRunning(false)
@@ -117,24 +117,24 @@ struct Timer::Impl
     uv_timer_start(mTimerHandle, TimerSourceFunc, mInterval, mInterval);
   }
 
-  uv_timer_t*  mTimerHandle;
-  unsigned int mInterval;
-  bool         mRunning;
+  uv_timer_t* mTimerHandle;
+  uint32_t    mInterval;
+  bool        mRunning;
 };
 
-TimerPtr Timer::New(unsigned int milliSec)
+TimerLibuvPtr TimerLibuv::New(uint32_t milliSec)
 {
   DALI_LOG_ERROR(" new timer\n");
-  TimerPtr timer(new Timer(milliSec));
+  TimerLibuvPtr timer(new TimerLibuv(milliSec));
   return timer;
 }
 
-Timer::Timer(unsigned int milliSec)
+TimerLibuv::TimerLibuv(uint32_t milliSec)
 : mImpl(new Impl(milliSec))
 {
 }
 
-Timer::~Timer()
+TimerLibuv::~TimerLibuv()
 {
   // stop timers
   Stop();
@@ -142,27 +142,27 @@ Timer::~Timer()
   delete mImpl;
 }
 
-void Timer::Start()
+void TimerLibuv::Start()
 {
   mImpl->Start(this);
 }
 
-void Timer::Stop()
+void TimerLibuv::Stop()
 {
   mImpl->Stop();
 }
 
-void Timer::Pause()
+void TimerLibuv::Pause()
 {
   mImpl->Pause();
 }
 
-void Timer::Resume()
+void TimerLibuv::Resume()
 {
   mImpl->Resume();
 }
 
-void Timer::SetInterval(unsigned int interval, bool restart)
+void TimerLibuv::SetInterval(uint32_t interval, bool restart)
 {
   // stop existing timer
   Stop();
@@ -176,12 +176,12 @@ void Timer::SetInterval(unsigned int interval, bool restart)
   }
 }
 
-unsigned int Timer::GetInterval() const
+uint32_t TimerLibuv::GetInterval() const
 {
   return mImpl->mInterval;
 }
 
-bool Timer::Tick()
+bool TimerLibuv::Tick()
 {
   // Guard against destruction during signal emission
   Dali::Timer handle(this);
@@ -212,12 +212,7 @@ bool Timer::Tick()
   return retVal;
 }
 
-Dali::Timer::TimerSignalType& Timer::TickSignal()
-{
-  return mTickSignal;
-}
-
-bool Timer::IsRunning() const
+bool TimerLibuv::IsRunning() const
 {
   return mImpl->mRunning;
 }
diff --git a/dali/internal/system/libuv/timer-impl-libuv.h b/dali/internal/system/libuv/timer-impl-libuv.h
new file mode 100644 (file)
index 0000000..8fbb316
--- /dev/null
@@ -0,0 +1,116 @@
+#ifndef DALI_INTERNAL_ADAPTOR_SYSTEM_LIBUV_TIMER_H
+#define DALI_INTERNAL_ADAPTOR_SYSTEM_LIBUV_TIMER_H
+
+/*
+ * 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.
+ * 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.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali/internal/system/common/timer-impl.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+class TimerLibuv;
+
+typedef IntrusivePtr<TimerLibuv> TimerLibuvPtr;
+
+/**
+ * @brief TimerLibuv class provides an Timer Libuv implementation.
+ */
+class TimerLibuv : public Timer
+{
+public:
+  static TimerLibuvPtr New(uint32_t milliSec);
+
+  /**
+   * Constructor
+   * @param[in]  milliSec  Interval in milliseconds.
+   */
+  TimerLibuv(uint32_t milliSec);
+
+  /**
+   * Destructor.
+   */
+  virtual ~TimerLibuv();
+
+public:
+  /**
+   * @copydoc Dali::Timer::Start()
+   */
+  void Start() override;
+
+  /**
+   * @copydoc Dali::Timer::Stop()
+   */
+  void Stop() override;
+
+  /**
+   * @copydoc Dali::Timer::Pause()
+   */
+  void Pause() override;
+
+  /**
+   * @copydoc Dali::Timer::Resume()
+   */
+  void Resume() override;
+
+  /**
+   * @copydoc Dali::Timer::SetInterval()
+   */
+  void SetInterval(uint32_t interval, bool restart) override;
+
+  /**
+   * @copydoc Dali::Timer::GetInterval()
+   */
+  uint32_t GetInterval() const override;
+
+  /**
+   * @copydoc Dali::Timer::IsRunning()
+   */
+  bool IsRunning() const override;
+
+  /**
+   * Tick
+   */
+  bool Tick();
+
+private: // Implementation
+  // not implemented
+  TimerLibuv(const TimerLibuv&) = delete;
+  TimerLibuv& operator=(const TimerLibuv&) = delete;
+
+  /**
+   * Resets any stored timer data.
+   */
+  void ResetTimerData();
+
+private: // Data
+  // To hide away implementation details
+  struct Impl;
+  Impl* mImpl;
+};
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
+
+#endif // DALI_INTERNAL_ADAPTOR_SYSTEM_LIBUV_TIMER_H
index 3c2e478..e7ea2d5 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021 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.
@@ -259,12 +259,6 @@ void EcoreCallbackManager::RemoveAllCallbacks()
   mCallbackContainer.clear();
 }
 
-// Creates a concrete interface for CallbackManager
-CallbackManager* CallbackManager::New()
-{
-  return new EcoreCallbackManager;
-}
-
 } // namespace Adaptor
 
 } // namespace Internal
index a76d5ce..214e153 100644 (file)
@@ -1,8 +1,8 @@
-#ifndef DALI_ECORE_CALLBACK_MANAGER_H
-#define DALI_ECORE_CALLBACK_MANAGER_H
+#ifndef DALI_INTERNAL_ADAPTOR_SYSTEM_LINUX_CALLBACK_MANAGER_H
+#define DALI_INTERNAL_ADAPTOR_SYSTEM_LINUX_CALLBACK_MANAGER_H
 
 /*
- * Copyright (c) 2021 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.
@@ -39,79 +39,84 @@ class EcoreCallbackManager : public CallbackManager
 {
 public:
   /**
-     * @brief constructor
-     */
+   * @brief constructor
+   */
   EcoreCallbackManager();
 
   /**
-     * @brief destructor
-     */
+   * @brief destructor
+   */
   ~EcoreCallbackManager()
   {
   }
 
   /**
-     * @copydoc CallbackManager::AddIdleCallback()
-     */
+   * @copydoc CallbackManager::AddIdleCallback()
+   */
   bool AddIdleCallback(CallbackBase* callback, bool hasReturnValue) override;
 
   /**
-     * @copydoc CallbackManager::RemoveIdleCallback()
-     */
+   * @copydoc CallbackManager::RemoveIdleCallback()
+   */
   void RemoveIdleCallback(CallbackBase* callback) override;
 
   /**
-     * @copydoc CallbackManager::ProcessIdle()
-     */
+   * @copydoc CallbackManager::ProcessIdle()
+   */
   bool ProcessIdle() override;
 
   /**
-     * @copydoc CallbackManager::ProcessIdle()
-     */
+   * @copydoc CallbackManager::ProcessIdle()
+   */
   void ClearIdleCallbacks() override;
 
   /**
-     * @copydoc CallbackManager::AddIdleEntererCallback()
-     */
+   * @copydoc CallbackManager::AddIdleEntererCallback()
+   */
   bool AddIdleEntererCallback(CallbackBase* callback) override;
 
   /**
-     * @copydoc CallbackManager::RemoveIdleEntererCallback()
-     */
+   * @copydoc CallbackManager::RemoveIdleEntererCallback()
+   */
   void RemoveIdleEntererCallback(CallbackBase* callback) override;
 
   /**
-     * @copydoc CallbackManager::Start()
-     */
+   * @copydoc CallbackManager::Start()
+   */
   void Start() override;
 
   /**
-     * @copydoc CallbackManager::Stop()
-     */
+   * @copydoc CallbackManager::Stop()
+   */
   void Stop() override;
 
 private:
   /**
-     * @brief Remove all idle call backs that are pending
-     * Called by Stop()
-     * Always called from the main thread
-     */
+   * @brief Remove all idle call backs that are pending
+   * Called by Stop()
+   * Always called from the main thread
+   */
   void RemoveAllCallbacks();
 
   /**
-     * @brief Removes a single call back from the container
-     * Always called from main thread
-     * @param callbackData callback data
-     */
+   * @brief Removes a single call back from the container
+   * Always called from main thread
+   * @param callbackData callback data
+   */
   void RemoveCallbackFromContainer(CallbackData* callbackData);
 
   /**
-     * @brief Remove a standard call back from ecore
-     * Always called from main thread
-     * @param callbackData callback data
-     */
+   * @brief Remove a standard call back from ecore
+   * Always called from main thread
+   * @param callbackData callback data
+   */
   void RemoveStandardCallback(CallbackData* callbackData);
 
+  // Undefined
+  EcoreCallbackManager(const EcoreCallbackManager&) = delete;
+  EcoreCallbackManager& operator=(EcoreCallbackManager&) = delete;
+
+private:
   typedef std::list<CallbackData*> CallbackList;
 
   bool         mRunning;           ///< flag is set to true if when running
@@ -124,4 +129,4 @@ private:
 
 } // namespace Dali
 
-#endif // DALI_ECORE_CALLBACK_MANAGER_H
+#endif // DALI_INTERNAL_ADAPTOR_SYSTEM_LINUX_CALLBACK_MANAGER_H
index f121abe..5d47dd8 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2022 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.
@@ -16,7 +16,7 @@
  */
 
 // CLASS HEADER
-#include <dali/internal/system/common/file-descriptor-monitor.h>
+#include <dali/internal/system/linux/file-descriptor-monitor-ecore.h>
 
 // EXTERNAL INCLUDES
 #include <dali/internal/system/linux/dali-ecore.h>
@@ -33,7 +33,7 @@ namespace Adaptor
 /**
  * Using Impl to hide away EFL specific members
  */
-struct FileDescriptorMonitor::Impl
+struct FileDescriptorMonitorEcore::Impl
 {
   // Construction
   Impl(int fileDescriptor, CallbackBase* callback, int eventsToMonitor)
@@ -101,7 +101,8 @@ struct FileDescriptorMonitor::Impl
   }
 };
 
-FileDescriptorMonitor::FileDescriptorMonitor(int fileDescriptor, CallbackBase* callback, int eventBitmask)
+FileDescriptorMonitorEcore::FileDescriptorMonitorEcore(int fileDescriptor, CallbackBase* callback, int eventBitmask)
+: FileDescriptorMonitor(fileDescriptor, callback, eventBitmask)
 {
   mImpl = new Impl(fileDescriptor, callback, eventBitmask);
 
@@ -124,7 +125,7 @@ FileDescriptorMonitor::FileDescriptorMonitor(int fileDescriptor, CallbackBase* c
   mImpl->mHandler         = ecore_main_fd_handler_add(fileDescriptor, static_cast<Ecore_Fd_Handler_Flags>(events), &Impl::EventDispatch, mImpl, NULL, NULL);
 }
 
-FileDescriptorMonitor::~FileDescriptorMonitor()
+FileDescriptorMonitorEcore::~FileDescriptorMonitorEcore()
 {
   if(mImpl->mHandler)
   {
diff --git a/dali/internal/system/linux/file-descriptor-monitor-ecore.h b/dali/internal/system/linux/file-descriptor-monitor-ecore.h
new file mode 100644 (file)
index 0000000..88f6eb1
--- /dev/null
@@ -0,0 +1,64 @@
+#ifndef DALI_INTERNAL_ADAPTOR_SYSTEM_LINUX_FILE_DESCRIPTOR_MONITOR_H
+#define DALI_INTERNAL_ADAPTOR_SYSTEM_LINUX_FILE_DESCRIPTOR_MONITOR_H
+
+/*
+ * 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.
+ * 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.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali/internal/system/common/file-descriptor-monitor.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+/**
+ * @brief FileDescriptorMonitorEcore class provides an FileDescriptorMonitor Ecore implementation.
+ */
+class FileDescriptorMonitorEcore : public FileDescriptorMonitor
+{
+public:
+  /**
+   * @copydoc Dali::Internal::Adaptor::FileDescriptorMonitor()
+   */
+  FileDescriptorMonitorEcore(int fileDescriptor, CallbackBase* callback, int eventBitmask);
+
+  /**
+   * Destructor
+   */
+  ~FileDescriptorMonitorEcore();
+
+private:
+  // Undefined
+  FileDescriptorMonitorEcore(const FileDescriptorMonitorEcore& fileDescriptorMonitor) = delete;
+
+  // Undefined
+  FileDescriptorMonitorEcore& operator=(const FileDescriptorMonitorEcore& fileDescriptorMonitor) = delete;
+
+private:
+  struct Impl;
+  Impl* mImpl;
+};
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
+
+#endif // DALI_INTERNAL_ADAPTOR_SYSTEM_LINUX_FILE_DESCRIPTOR_MONITOR_H
diff --git a/dali/internal/system/linux/system-factory-ecore.cpp b/dali/internal/system/linux/system-factory-ecore.cpp
new file mode 100644 (file)
index 0000000..9308f64
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * 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.
+ * 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 <dali/internal/system/linux/system-factory-ecore.h>
+
+// INTERNAL HEADERS
+#include <dali/internal/system/linux/callback-manager-ecore.h>
+#include <dali/internal/system/linux/file-descriptor-monitor-ecore.h>
+#include <dali/internal/system/linux/timer-impl-ecore.h>
+#include <dali/internal/window-system/common/display-utils.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+std::unique_ptr<CallbackManager> SystemFactoryEcore::CreateCallbackManager()
+{
+  return Utils::MakeUnique<EcoreCallbackManager>();
+}
+
+std::unique_ptr<FileDescriptorMonitor> SystemFactoryEcore::CreateFileDescriptorMonitor(int fileDescriptor, CallbackBase* callback, int eventBitmask)
+{
+  return Utils::MakeUnique<FileDescriptorMonitorEcore>(fileDescriptor, callback, eventBitmask);
+}
+
+TimerPtr SystemFactoryEcore::CreateTimer(uint32_t milliSec)
+{
+  return TimerEcore::New(milliSec);
+}
+
+std::unique_ptr<SystemFactory> GetSystemFactory()
+{
+  return Utils::MakeUnique<SystemFactoryEcore>();
+}
+
+} // namespace Adaptor
+} // namespace Internal
+} // namespace Dali
diff --git a/dali/internal/system/linux/system-factory-ecore.h b/dali/internal/system/linux/system-factory-ecore.h
new file mode 100644 (file)
index 0000000..e4a108d
--- /dev/null
@@ -0,0 +1,42 @@
+#ifndef DALI_INTERNAL_ADAPTOR_SYSTEM_LINUX_SYSTEM_FACTORY_H
+#define DALI_INTERNAL_ADAPTOR_SYSTEM_LINUX_SYSTEM_FACTORY_H
+
+/*
+ * 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.
+ * 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.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali/internal/system/common/system-factory.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+class SystemFactoryEcore : public SystemFactory
+{
+public:
+  std::unique_ptr<CallbackManager>       CreateCallbackManager() override;
+  std::unique_ptr<FileDescriptorMonitor> CreateFileDescriptorMonitor(int fileDescriptor, CallbackBase* callback, int eventBitmask) override;
+  TimerPtr                               CreateTimer(uint32_t milliSec) override;
+};
+
+} // namespace Adaptor
+} // namespace Internal
+} // namespace Dali
+
+#endif // DALI_INTERNAL_ADAPTOR_SYSTEM_LINUX_SYSTEM_FACTORY_H
index b06945a..2878778 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021 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.
@@ -16,7 +16,7 @@
  */
 
 // CLASS HEADER
-#include <dali/internal/system/common/timer-impl.h>
+#include <dali/internal/system/linux/timer-impl-ecore.h>
 
 // INTERNAL INCLUDES
 #include <dali/internal/adaptor/common/adaptor-impl.h>
@@ -35,7 +35,7 @@ namespace
 {
 Eina_Bool TimerSourceFunc(void* data)
 {
-  Timer* timer = static_cast<Timer*>(data);
+  TimerEcore* timer = static_cast<TimerEcore*>(data);
 
   bool keepRunning = timer->Tick();
 
@@ -46,36 +46,36 @@ Eina_Bool TimerSourceFunc(void* data)
 /**
  * Struct to hide away Ecore implementation details
  */
-struct Timer::Impl
+struct TimerEcore::Impl
 {
-  Impl(unsigned int milliSec)
+  Impl(uint32_t milliSec)
   : mId(NULL),
     mInterval(milliSec)
   {
   }
 
   Ecore_Timer* mId;
-  unsigned int mInterval;
+  uint32_t     mInterval;
 };
 
-TimerPtr Timer::New(unsigned int milliSec)
+TimerEcorePtr TimerEcore::New(uint32_t milliSec)
 {
-  TimerPtr timer(new Timer(milliSec));
+  TimerEcorePtr timer(new TimerEcore(milliSec));
   return timer;
 }
 
-Timer::Timer(unsigned int milliSec)
+TimerEcore::TimerEcore(uint32_t milliSec)
 : mImpl(new Impl(milliSec))
 {
 }
 
-Timer::~Timer()
+TimerEcore::~TimerEcore()
 {
   ResetTimerData();
   delete mImpl;
 }
 
-void Timer::Start()
+void TimerEcore::Start()
 {
   // Timer should be used in the event thread
   DALI_ASSERT_ALWAYS(Adaptor::IsAvailable());
@@ -88,7 +88,7 @@ void Timer::Start()
   mImpl->mId      = ecore_timer_add(interval, reinterpret_cast<Ecore_Task_Cb>(TimerSourceFunc), this);
 }
 
-void Timer::Stop()
+void TimerEcore::Stop()
 {
   // Timer should be used in the event thread
   DALI_ASSERT_ALWAYS(Adaptor::IsAvailable());
@@ -96,7 +96,7 @@ void Timer::Stop()
   ResetTimerData();
 }
 
-void Timer::Pause()
+void TimerEcore::Pause()
 {
   // Timer should be used in the event thread
   DALI_ASSERT_ALWAYS(Adaptor::IsAvailable());
@@ -107,7 +107,7 @@ void Timer::Pause()
   }
 }
 
-void Timer::Resume()
+void TimerEcore::Resume()
 {
   // Timer should be used in the event thread
   DALI_ASSERT_ALWAYS(Adaptor::IsAvailable());
@@ -118,7 +118,7 @@ void Timer::Resume()
   }
 }
 
-void Timer::SetInterval(unsigned int interval, bool restart)
+void TimerEcore::SetInterval(uint32_t interval, bool restart)
 {
   // stop existing timer
   Stop();
@@ -131,12 +131,12 @@ void Timer::SetInterval(unsigned int interval, bool restart)
   }
 }
 
-unsigned int Timer::GetInterval() const
+uint32_t TimerEcore::GetInterval() const
 {
   return mImpl->mInterval;
 }
 
-bool Timer::Tick()
+bool TimerEcore::Tick()
 {
   // Guard against destruction during signal emission
   Dali::Timer handle(this);
@@ -167,12 +167,7 @@ bool Timer::Tick()
   return retVal;
 }
 
-Dali::Timer::TimerSignalType& Timer::TickSignal()
-{
-  return mTickSignal;
-}
-
-void Timer::ResetTimerData()
+void TimerEcore::ResetTimerData()
 {
   if(mImpl->mId != NULL)
   {
@@ -181,7 +176,7 @@ void Timer::ResetTimerData()
   }
 }
 
-bool Timer::IsRunning() const
+bool TimerEcore::IsRunning() const
 {
   return mImpl->mId != NULL;
 }
diff --git a/dali/internal/system/linux/timer-impl-ecore.h b/dali/internal/system/linux/timer-impl-ecore.h
new file mode 100644 (file)
index 0000000..1da916c
--- /dev/null
@@ -0,0 +1,116 @@
+#ifndef DALI_INTERNAL_ADAPTOR_SYSTEM_LINUX_TIMER_H
+#define DALI_INTERNAL_ADAPTOR_SYSTEM_LINUX_TIMER_H
+
+/*
+ * 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.
+ * 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.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali/internal/system/common/timer-impl.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+class TimerEcore;
+
+typedef IntrusivePtr<TimerEcore> TimerEcorePtr;
+
+/**
+ * @brief TimerEcore class provides an Timer Ecore implementation.
+ */
+class TimerEcore : public Timer
+{
+public:
+  static TimerEcorePtr New(uint32_t milliSec);
+
+  /**
+   * Constructor
+   * @param[in]  milliSec  Interval in milliseconds.
+   */
+  TimerEcore(uint32_t milliSec);
+
+  /**
+   * Destructor.
+   */
+  virtual ~TimerEcore();
+
+public:
+  /**
+   * @copydoc Dali::Timer::Start()
+   */
+  void Start() override;
+
+  /**
+   * @copydoc Dali::Timer::Stop()
+   */
+  void Stop() override;
+
+  /**
+   * @copydoc Dali::Timer::Pause()
+   */
+  void Pause() override;
+
+  /**
+   * @copydoc Dali::Timer::Resume()
+   */
+  void Resume() override;
+
+  /**
+   * @copydoc Dali::Timer::SetInterval()
+   */
+  void SetInterval(uint32_t interval, bool restart) override;
+
+  /**
+   * @copydoc Dali::Timer::GetInterval()
+   */
+  uint32_t GetInterval() const override;
+
+  /**
+   * @copydoc Dali::Timer::IsRunning()
+   */
+  bool IsRunning() const override;
+
+  /**
+   * Tick
+   */
+  bool Tick();
+
+private: // Implementation
+  // not implemented
+  TimerEcore(const TimerEcore&) = delete;
+  TimerEcore& operator=(const TimerEcore&) = delete;
+
+  /**
+   * Resets any stored timer data.
+   */
+  void ResetTimerData();
+
+private: // Data
+  // To hide away implementation details
+  struct Impl;
+  Impl* mImpl;
+};
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
+
+#endif // DALI_INTERNAL_ADAPTOR_SYSTEM_LINUX_TIMER_H
index b454af6..4b14b20 100644 (file)
@@ -1,7 +1,7 @@
 #pragma once
 
 /*
- * Copyright (c) 2021 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.
  *
  */
 
-#include <dali/internal/system/common/callback-manager.h>
+// EXTERNAL INCLUDES
 #include <memory>
 
+// INTERNAL INCLUDES
+#include <dali/internal/system/common/callback-manager.h>
+
 namespace Dali::Internal::Adaptor
 {
 /**
@@ -28,10 +31,18 @@ namespace Dali::Internal::Adaptor
 class CocoaCallbackManager : public CallbackManager
 {
 public:
+  /**
+   * @brief constructor
+   */
   CocoaCallbackManager();
 
   /**
-     * @copydoc CallbackManager::AddIdleCallback()
+   * @brief destructor
+   */
+  ~CocoaCallbackManager();
+
+  /**
+   * @copydoc CallbackManager::AddIdleCallback()
    */
   bool AddIdleCallback(CallbackBase* callback, bool hasReturnValue) override;
 
@@ -70,9 +81,15 @@ public:
    */
   void Stop() override;
 
+  /// Implementation structure
   struct Impl;
 
 private:
+  // Undefined
+  CocoaCallbackManager(const CocoaCallbackManager&) = delete;
+  CocoaCallbackManager& operator=(CocoaCallbackManager&) = delete;
+
+private:
   std::unique_ptr<Impl> mImpl;
   bool                  mRunning;
 };
index 7e892c4..99a4c11 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 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.
@@ -234,18 +234,14 @@ bool CocoaCallbackManager::Impl::AddIdleCallback(
   return false;
 }
 
-// Creates a concrete interface for CallbackManager
-CallbackManager* CallbackManager::New()
-{
-  return new CocoaCallbackManager;
-}
-
 CocoaCallbackManager::CocoaCallbackManager()
   : mImpl(std::make_unique<CocoaCallbackManager::Impl>())
   , mRunning(false)
 {
 }
 
+CocoaCallbackManager::~CocoaCallbackManager() = default;
+
 bool CocoaCallbackManager::AddIdleCallback(CallbackBase *callback, bool hasReturnValue)
 {
   return mRunning && mImpl->AddIdleCallback(callback, hasReturnValue);
index 983a39f..acd90da 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021 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.
  */
 
 // CLASS HEADER
-#include <dali/internal/system/common/file-descriptor-monitor.h>
+#include <dali/internal/system/macos/file-descriptor-monitor-macos.h>
 
 // EXTERNAL INCLUDES
 #include <dali/integration-api/debug.h>
 
 namespace Dali::Internal::Adaptor
 {
-FileDescriptorMonitor::FileDescriptorMonitor(int fileDescriptor, CallbackBase* callback, int eventBitmask)
+FileDescriptorMonitorMac::FileDescriptorMonitorMac(int fileDescriptor, CallbackBase* callback, int eventBitmask)
+: FileDescriptorMonitor(fileDescriptor, callback, eventBitmask)
 {
   DALI_LOG_WARNING("Implementation missing for macOS");
 }
 
-FileDescriptorMonitor::~FileDescriptorMonitor()
+FileDescriptorMonitorMac::~FileDescriptorMonitorMac()
 {
 }
 
diff --git a/dali/internal/system/macos/file-descriptor-monitor-macos.h b/dali/internal/system/macos/file-descriptor-monitor-macos.h
new file mode 100644 (file)
index 0000000..bf98191
--- /dev/null
@@ -0,0 +1,60 @@
+#ifndef DALI_INTERNAL_ADAPTOR_SYSTEM_MACOS_FILE_DESCRIPTOR_MONITOR_H
+#define DALI_INTERNAL_ADAPTOR_SYSTEM_MACOS_FILE_DESCRIPTOR_MONITOR_H
+
+/*
+ * 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.
+ * 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.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali/internal/system/common/file-descriptor-monitor.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+/**
+ * @brief FileDescriptorMonitorMac class provides an FileDescriptorMonitor Mac implementation.
+ */
+class FileDescriptorMonitorMac : public FileDescriptorMonitor
+{
+public:
+  /**
+   * @copydoc Dali::Internal::Adaptor::FileDescriptorMonitor()
+   */
+  FileDescriptorMonitorMac(int fileDescriptor, CallbackBase* callback, int eventBitmask);
+
+  /**
+   * Destructor
+   */
+  ~FileDescriptorMonitorMac();
+
+private:
+  // Undefined
+  FileDescriptorMonitorMac(const FileDescriptorMonitorMac& fileDescriptorMonitor) = delete;
+
+  // Undefined
+  FileDescriptorMonitorMac& operator=(const FileDescriptorMonitorMac& fileDescriptorMonitor) = delete;
+};
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
+
+#endif // DALI_INTERNAL_ADAPTOR_SYSTEM_MACOS_FILE_DESCRIPTOR_MONITOR_H
diff --git a/dali/internal/system/macos/system-factory-mac.cpp b/dali/internal/system/macos/system-factory-mac.cpp
new file mode 100644 (file)
index 0000000..294c29f
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * 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.
+ * 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 <dali/internal/system/macos/system-factory-mac.h>
+
+// INTERNAL HEADERS
+#include <dali/internal/system/macos/callback-manager-mac.h>
+#include <dali/internal/system/macos/file-descriptor-monitor-macos.h>
+#include <dali/internal/system/macos/timer-impl-mac.h>
+#include <dali/internal/window-system/common/display-utils.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+std::unique_ptr<CallbackManager> SystemFactoryMac::CreateCallbackManager()
+{
+  return Utils::MakeUnique<CocoaCallbackManager>();
+}
+
+std::unique_ptr<FileDescriptorMonitor> SystemFactoryMac::CreateFileDescriptorMonitor(int fileDescriptor, CallbackBase* callback, int eventBitmask)
+{
+  return Utils::MakeUnique<FileDescriptorMonitorMac>(fileDescriptor, callback, eventBitmask);
+}
+
+TimerPtr SystemFactoryMac::CreateTimer(uint32_t milliSec)
+{
+  return TimerMac::New(milliSec);
+}
+
+std::unique_ptr<SystemFactory> GetSystemFactory()
+{
+  return Utils::MakeUnique<SystemFactoryMac>();
+}
+
+} // namespace Adaptor
+} // namespace Internal
+} // namespace Dali
diff --git a/dali/internal/system/macos/system-factory-mac.h b/dali/internal/system/macos/system-factory-mac.h
new file mode 100644 (file)
index 0000000..665bfc8
--- /dev/null
@@ -0,0 +1,42 @@
+#ifndef DALI_INTERNAL_ADAPTOR_SYSTEM_MACOS_SYSTEM_FACTORY_H
+#define DALI_INTERNAL_ADAPTOR_SYSTEM_MACOS_SYSTEM_FACTORY_H
+
+/*
+ * 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.
+ * 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.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali/internal/system/common/system-factory.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+class SystemFactoryMac : public SystemFactory
+{
+public:
+  std::unique_ptr<CallbackManager>       CreateCallbackManager() override;
+  std::unique_ptr<FileDescriptorMonitor> CreateFileDescriptorMonitor(int fileDescriptor, CallbackBase* callback, int eventBitmask) override;
+  TimerPtr                               CreateTimer(uint32_t milliSec) override;
+};
+
+} // namespace Adaptor
+} // namespace Internal
+} // namespace Dali
+
+#endif // DALI_INTERNAL_ADAPTOR_SYSTEM_MACOS_SYSTEM_FACTORY_H
index f6544ee..b93c4ec 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021 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.
@@ -16,7 +16,9 @@
  */
 
 // CLASS HEADER
-#include <dali/internal/system/common/timer-impl.h>
+#include <dali/internal/system/macos/timer-impl-mac.h>
+
+// EXTERNAL INCLUDES
 #include "extern-definitions.h"
 
 namespace Dali::Internal::Adaptor
@@ -24,9 +26,9 @@ namespace Dali::Internal::Adaptor
 /**
  * Struct to hide away macOS implementation details
  */
-struct Timer::Impl
+struct TimerMac::Impl
 {
-  Impl(Timer* parent, unsigned int milliSec)
+  Impl(TimerMac* parent, uint32_t milliSec)
   : mTimer(CreateTimer(parent, milliSec))
   {
   }
@@ -40,9 +42,9 @@ struct Timer::Impl
 
   void Start();
   void Stop();
-  void Reset(Timer* parent, unsigned int milliSec);
+  void Reset(TimerMac* parent, uint32_t milliSec);
 
-  unsigned int GetInterval() const noexcept
+  uint32_t GetInterval() const noexcept
   {
     return CFRunLoopTimerGetInterval(mTimer.get()) * 1000.0;
   }
@@ -53,18 +55,18 @@ struct Timer::Impl
   }
 
 private:
-  CFRef<CFRunLoopTimerRef> CreateTimer(Timer* parent, unsigned int milliSec);
+  CFRef<CFRunLoopTimerRef> CreateTimer(TimerMac* parent, uint32_t milliSec);
 
   CFRef<CFRunLoopTimerRef> mTimer;
 };
 
-void Timer::Impl::TimerProc(CFRunLoopTimerRef timer, void* info)
+void TimerMac::Impl::TimerProc(CFRunLoopTimerRef timer, void* info)
 {
-  auto* pTimer = static_cast<Timer*>(info);
+  auto* pTimer = static_cast<TimerMac*>(info);
   pTimer->Tick();
 }
 
-void Timer::Impl::Start()
+void TimerMac::Impl::Start()
 {
   if(!IsRunning())
   {
@@ -73,7 +75,7 @@ void Timer::Impl::Start()
   }
 }
 
-void Timer::Impl::Stop()
+void TimerMac::Impl::Stop()
 {
   if(IsRunning())
   {
@@ -96,7 +98,7 @@ void Timer::Impl::Stop()
   }
 }
 
-void Timer::Impl::Reset(Timer* parent, unsigned int milliSec)
+void TimerMac::Impl::Reset(TimerMac* parent, uint32_t milliSec)
 {
   Stop();
   mTimer = CreateTimer(parent, milliSec);
@@ -104,7 +106,7 @@ void Timer::Impl::Reset(Timer* parent, unsigned int milliSec)
 }
 
 CFRef<CFRunLoopTimerRef>
-Timer::Impl::CreateTimer(Timer* parent, unsigned int milliSec)
+TimerMac::Impl::CreateTimer(TimerMac* parent, uint32_t milliSec)
 {
   const auto            interval = static_cast<CFAbsoluteTime>(milliSec) / 1000;
   const auto            fireDate = CFAbsoluteTimeGetCurrent() + interval;
@@ -126,17 +128,17 @@ Timer::Impl::CreateTimer(Timer* parent, unsigned int milliSec)
     &context));
 }
 
-TimerPtr Timer::New(unsigned int milliSec)
+TimerMacPtr TimerMac::New(uint32_t milliSec)
 {
-  return new Timer(milliSec);
+  return new TimerMac(milliSec);
 }
 
-Timer::Timer(unsigned int milliSec)
+TimerMac::TimerMac(uint32_t milliSec)
 : mImpl(new Impl(this, milliSec))
 {
 }
 
-Timer::~Timer()
+TimerMac::~TimerMac()
 {
   // stop timers
   Stop();
@@ -145,35 +147,35 @@ Timer::~Timer()
   mImpl = NULL;
 }
 
-void Timer::Start()
+void TimerMac::Start()
 {
   mImpl->Start();
 }
 
-void Timer::Stop()
+void TimerMac::Stop()
 {
   mImpl->Stop();
 }
 
-void Timer::Pause()
+void TimerMac::Pause()
 {
 }
 
-void Timer::Resume()
+void TimerMac::Resume()
 {
 }
 
-void Timer::SetInterval(unsigned int interval, bool restart)
+void TimerMac::SetInterval(uint32_t interval, bool restart)
 {
   mImpl->Reset(this, interval);
 }
 
-unsigned int Timer::GetInterval() const
+uint32_t TimerMac::GetInterval() const
 {
   return mImpl->GetInterval();
 }
 
-bool Timer::Tick()
+bool TimerMac::Tick()
 {
   // Guard against destruction during signal emission
   Dali::Timer handle(this);
@@ -204,12 +206,7 @@ bool Timer::Tick()
   return retVal;
 }
 
-Dali::Timer::TimerSignalType& Timer::TickSignal()
-{
-  return mTickSignal;
-}
-
-bool Timer::IsRunning() const
+bool TimerMac::IsRunning() const
 {
   return mImpl->IsRunning();
 }
diff --git a/dali/internal/system/macos/timer-impl-mac.h b/dali/internal/system/macos/timer-impl-mac.h
new file mode 100644 (file)
index 0000000..534ff26
--- /dev/null
@@ -0,0 +1,116 @@
+#ifndef DALI_INTERNAL_ADAPTOR_SYSTEM_MACOS_TIMER_H
+#define DALI_INTERNAL_ADAPTOR_SYSTEM_MACOS_TIMER_H
+
+/*
+ * 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.
+ * 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.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali/internal/system/common/timer-impl.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+class TimerMac;
+
+typedef IntrusivePtr<TimerMac> TimerMacPtr;
+
+/**
+ * @brief TimerMac class provides an Timer Mac implementation.
+ */
+class TimerMac : public Timer
+{
+public:
+  static TimerMacPtr New(uint32_t milliSec);
+
+  /**
+   * Constructor
+   * @param[in]  milliSec  Interval in milliseconds.
+   */
+  TimerMac(uint32_t milliSec);
+
+  /**
+   * Destructor.
+   */
+  virtual ~TimerMac();
+
+public:
+  /**
+   * @copydoc Dali::Timer::Start()
+   */
+  void Start() override;
+
+  /**
+   * @copydoc Dali::Timer::Stop()
+   */
+  void Stop() override;
+
+  /**
+   * @copydoc Dali::Timer::Pause()
+   */
+  void Pause() override;
+
+  /**
+   * @copydoc Dali::Timer::Resume()
+   */
+  void Resume() override;
+
+  /**
+   * @copydoc Dali::Timer::SetInterval()
+   */
+  void SetInterval(uint32_t interval, bool restart) override;
+
+  /**
+   * @copydoc Dali::Timer::GetInterval()
+   */
+  uint32_t GetInterval() const override;
+
+  /**
+   * @copydoc Dali::Timer::IsRunning()
+   */
+  bool IsRunning() const override;
+
+  /**
+   * Tick
+   */
+  bool Tick();
+
+private: // Implementation
+  // not implemented
+  TimerMac(const TimerMac&) = delete;
+  TimerMac& operator=(const TimerMac&) = delete;
+
+  /**
+   * Resets any stored timer data.
+   */
+  void ResetTimerData();
+
+private: // Data
+  // To hide away implementation details
+  struct Impl;
+  Impl* mImpl;
+};
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
+
+#endif // DALI_INTERNAL_ADAPTOR_SYSTEM_MACOS_TIMER_H
index b37e1ad..7871819 100644 (file)
@@ -1,5 +1,5 @@
 /*\r
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.\r
+ * Copyright (c) 2023 Samsung Electronics Co., Ltd.\r
  *\r
  * Licensed under the Apache License, Version 2.0 (the "License");\r
  * you may not use this file except in compliance with the License.\r
@@ -101,12 +101,6 @@ void WinCallbackManager::RemoveIdleEntererCallback(CallbackBase* callback)
 {\r
 }\r
 \r
-// Creates a concrete interface for CallbackManager\r
-CallbackManager* CallbackManager::New()\r
-{\r
-  return new WinCallbackManager;\r
-}\r
-\r
 } // namespace Adaptor\r
 \r
 } // namespace Internal\r
index 3915ec4..b648425 100644 (file)
@@ -1,8 +1,8 @@
-#ifndef DALI_WIN_CALLBACK_MANAGER_H
-#define DALI_WIN_CALLBACK_MANAGER_H
+#ifndef DALI_INTERNAL_ADAPTOR_SYSTEM_WINDOWS_CALLBACK_MANAGER_H
+#define DALI_INTERNAL_ADAPTOR_SYSTEM_WINDOWS_CALLBACK_MANAGER_H
 
 /*
- * Copyright (c) 2021 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.
@@ -38,74 +38,79 @@ class WinCallbackManager : public CallbackManager
 {
 public:
   /**
-     * @brief constructor
-     */
+   * @brief constructor
+   */
   WinCallbackManager();
 
   /**
-     * @brief destructor
-     */
+   * @brief destructor
+   */
   ~WinCallbackManager()
   {
   }
 
   /**
-     * @copydoc CallbackManager::AddIdleCallback()
-     */
+   * @copydoc CallbackManager::AddIdleCallback()
+   */
   bool AddIdleCallback(CallbackBase* callback, bool hasReturnValue) override;
 
   /**
-     * @copydoc CallbackManager::RemoveIdleCallback()
-     */
+   * @copydoc CallbackManager::RemoveIdleCallback()
+   */
   void RemoveIdleCallback(CallbackBase* callback) override;
 
   /**
-     * @copydoc CallbackManager::ProcessIdle()
-     */
+   * @copydoc CallbackManager::ProcessIdle()
+   */
   bool ProcessIdle() override;
 
   /**
-     * @copydoc CallbackManager::ClearIdleCallbacks()
-     */
+   * @copydoc CallbackManager::ClearIdleCallbacks()
+   */
   void ClearIdleCallbacks() override;
 
   /**
-    * @brief Adds a @p callback to be run when entering an idle state.
-    * @note Must be called from the main thread only.
-    *
-    * A callback of the following type should be used:
-    * @code
-    *   bool MyFunction();
-    * @endcode
-    * This callback will be called repeatedly as long as it returns true. A return of 0 deletes this callback.
-    *
-    * @param[in] callback custom callback function.
-    *
-    * @return true on success
-    */
+   * @brief Adds a @p callback to be run when entering an idle state.
+   * @note Must be called from the main thread only.
+   *
+   * A callback of the following type should be used:
+   * @code
+   *   bool MyFunction();
+   * @endcode
+   * This callback will be called repeatedly as long as it returns true. A return of 0 deletes this callback.
+   *
+   * @param[in] callback custom callback function.
+   *
+   * @return true on success
+   */
   bool AddIdleEntererCallback(CallbackBase* callback) override;
 
   /**
-    * @brief Removes a previously added the idle enterer callback.
-    * @note Must be called from main thread only.
-    *
-    * Does nothing if the @p callback doesn't exist.
-    *
-    * @param[in] callback The callback to be removed.
-    */
+   * @brief Removes a previously added the idle enterer callback.
+   * @note Must be called from main thread only.
+   *
+   * Does nothing if the @p callback doesn't exist.
+   *
+   * @param[in] callback The callback to be removed.
+   */
   void RemoveIdleEntererCallback(CallbackBase* callback) override;
 
   /**
-     * @copydoc CallbackManager::Start()
-     */
+   * @copydoc CallbackManager::Start()
+   */
   void Start() override;
 
   /**
-     * @copydoc CallbackManager::Stop()
-     */
+   * @copydoc CallbackManager::Stop()
+   */
   void Stop() override;
 
 private:
+  // Undefined
+  WinCallbackManager(const WinCallbackManager&) = delete;
+  WinCallbackManager& operator=(WinCallbackManager&) = delete;
+
+private:
   std::set<CallbackBase*> mCallbacks;
   bool                    mRunning; ///< flag is set to true if when running
 };
@@ -116,4 +121,4 @@ private:
 
 } // namespace Dali
 
-#endif // DALI_WIN_CALLBACK_MANAGER_H
+#endif // DALI_INTERNAL_ADAPTOR_SYSTEM_WINDOWS_CALLBACK_MANAGER_H
index d937daa..eee61f2 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021 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.
@@ -16,7 +16,7 @@
  */
 
 // CLASS HEADER
-#include <dali/internal/system/common/file-descriptor-monitor.h>
+#include <dali/internal/system/windows/file-descriptor-monitor-windows.h>
 
 // EXTERNAL INCLUDES
 #include <dali/integration-api/debug.h>
@@ -27,12 +27,13 @@ namespace Internal
 {
 namespace Adaptor
 {
-FileDescriptorMonitor::FileDescriptorMonitor(int fileDescriptor, CallbackBase* callback, int eventBitmask)
+FileDescriptorMonitorWin::FileDescriptorMonitorWin(int fileDescriptor, CallbackBase* callback, int eventBitmask)
+: FileDescriptorMonitor(fileDescriptor, callback, eventBitmask)
 {
   DALI_LOG_WARNING("Implementation missing for MS Windows");
 }
 
-FileDescriptorMonitor::~FileDescriptorMonitor()
+FileDescriptorMonitorWin::~FileDescriptorMonitorWin()
 {
 }
 
diff --git a/dali/internal/system/windows/file-descriptor-monitor-windows.h b/dali/internal/system/windows/file-descriptor-monitor-windows.h
new file mode 100644 (file)
index 0000000..4867262
--- /dev/null
@@ -0,0 +1,67 @@
+#ifndef DALI_INTERNAL_ADAPTOR_SYSTEM_WINDOWS_FILE_DESCRIPTOR_MONITOR_H
+#define DALI_INTERNAL_ADAPTOR_SYSTEM_WINDOWS_FILE_DESCRIPTOR_MONITOR_H
+
+/*
+ * 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.
+ * 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 <dali/public-api/signals/callback.h>
+
+// INTERNAL INCLUDES
+#include <dali/internal/system/common/file-descriptor-monitor.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+/**
+ * @brief FileDescriptorMonitorWin class provides an FileDescriptorMonitor Windows implementation.
+ */
+class FileDescriptorMonitorWin : public FileDescriptorMonitor
+{
+public:
+  /**
+   * @copydoc Dali::Internal::Adaptor::FileDescriptorMonitor()
+   */
+  FileDescriptorMonitorWin(int fileDescriptor, CallbackBase* callback, int eventBitmask);
+
+  /**
+   * Destructor
+   */
+  ~FileDescriptorMonitorWin();
+
+private:
+  // Undefined
+  FileDescriptorMonitorWin(const FileDescriptorMonitorWin& fileDescriptorMonitor) = delete;
+
+  // Undefined
+  FileDescriptorMonitorWin& operator=(const FileDescriptorMonitorWin& fileDescriptorMonitor) = delete;
+
+private:
+  struct Impl;
+  Impl* mImpl;
+};
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
+
+#endif // DALI_INTERNAL_ADAPTOR_SYSTEM_WINDOWS_FILE_DESCRIPTOR_MONITOR_H
diff --git a/dali/internal/system/windows/system-factory-win.cpp b/dali/internal/system/windows/system-factory-win.cpp
new file mode 100644 (file)
index 0000000..244dcc4
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * 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.
+ * 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 <dali/internal/system/windows/system-factory-win.h>
+
+// INTERNAL HEADERS
+#include <dali/internal/system/windows/callback-manager-win.h>
+#include <dali/internal/system/windows/file-descriptor-monitor-windows.h>
+#include <dali/internal/system/windows/timer-impl-win.h>
+#include <dali/internal/window-system/common/display-utils.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+std::unique_ptr<CallbackManager> SystemFactoryWin::CreateCallbackManager()
+{
+  return Utils::MakeUnique<WinCallbackManager>();
+}
+
+std::unique_ptr<FileDescriptorMonitor> SystemFactoryWin::CreateFileDescriptorMonitor(int fileDescriptor, CallbackBase* callback, int eventBitmask)
+{
+  return Utils::MakeUnique<FileDescriptorMonitorWin>(fileDescriptor, callback, eventBitmask);
+}
+
+TimerPtr SystemFactoryWin::CreateTimer(uint32_t milliSec)
+{
+  return TimerWin::New(milliSec);
+}
+
+std::unique_ptr<SystemFactory> GetSystemFactory()
+{
+  return Utils::MakeUnique<SystemFactoryWin>();
+}
+
+} // namespace Adaptor
+} // namespace Internal
+} // namespace Dali
diff --git a/dali/internal/system/windows/system-factory-win.h b/dali/internal/system/windows/system-factory-win.h
new file mode 100644 (file)
index 0000000..aa805b5
--- /dev/null
@@ -0,0 +1,42 @@
+#ifndef DALI_INTERNAL_ADAPTOR_SYSTEM_WINDOWS_SYSTEM_FACTORY_H
+#define DALI_INTERNAL_ADAPTOR_SYSTEM_WINDOWS_SYSTEM_FACTORY_H
+
+/*
+ * 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.
+ * 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.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali/internal/system/common/system-factory.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+class SystemFactoryWin : public SystemFactory
+{
+public:
+  std::unique_ptr<CallbackManager>       CreateCallbackManager() override;
+  std::unique_ptr<FileDescriptorMonitor> CreateFileDescriptorMonitor(int fileDescriptor, CallbackBase* callback, int eventBitmask) override;
+  TimerPtr                               CreateTimer(uint32_t milliSec) override;
+};
+
+} // namespace Adaptor
+} // namespace Internal
+} // namespace Dali
+
+#endif // DALI_INTERNAL_ADAPTOR_SYSTEM_WINDOWS_SYSTEM_FACTORY_H
index 8462ab2..776efc5 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021 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.
@@ -16,7 +16,7 @@
  */
 
 // CLASS HEADER
-#include <dali/internal/system/common/timer-impl.h>
+#include <dali/internal/system/windows/timer-impl-win.h>
 
 // INTERNAL INCLUDES
 #include <dali/internal/window-system/windows/platform-implement-win.h>
@@ -32,7 +32,7 @@ namespace
 {
 bool TimerSourceFunc(void* data)
 {
-  Timer* timer = static_cast<Timer*>(data);
+  TimerWin* timer = static_cast<TimerWin*>(data);
   return timer->Tick();
 }
 } // namespace
@@ -40,9 +40,9 @@ bool TimerSourceFunc(void* data)
 /**
  * Struct to hide away Windows implementation details
  */
-struct Timer::Impl
+struct TimerWin::Impl
 {
-  Impl(unsigned int milliSec)
+  Impl(uint32_t milliSec)
   : mId(-1),
     mInterval(milliSec)
   {
@@ -50,21 +50,21 @@ struct Timer::Impl
 
   intptr_t mId;
 
-  unsigned int mInterval;
+  uint32_t mInterval;
 };
 
-TimerPtr Timer::New(unsigned int milliSec)
+TimerWinPtr TimerWin::New(uint32_t milliSec)
 {
-  TimerPtr timer(new Timer(milliSec));
+  TimerWinPtr timer(new TimerWin(milliSec));
   return timer;
 }
 
-Timer::Timer(unsigned int milliSec)
+TimerWin::TimerWin(uint32_t milliSec)
 : mImpl(new Impl(milliSec))
 {
 }
 
-Timer::~Timer()
+TimerWin::~TimerWin()
 {
   // stop timers
   Stop();
@@ -73,7 +73,7 @@ Timer::~Timer()
   mImpl = NULL;
 }
 
-void Timer::Start()
+void TimerWin::Start()
 {
   if(0 > mImpl->mId)
   {
@@ -81,7 +81,7 @@ void Timer::Start()
   }
 }
 
-void Timer::Stop()
+void TimerWin::Stop()
 {
   if(0 <= mImpl->mId)
   {
@@ -90,15 +90,15 @@ void Timer::Stop()
   }
 }
 
-void Timer::Pause()
+void TimerWin::Pause()
 {
 }
 
-void Timer::Resume()
+void TimerWin::Resume()
 {
 }
 
-void Timer::SetInterval(unsigned int interval, bool restart)
+void TimerWin::SetInterval(uint32_t interval, bool restart)
 {
   if(true == restart)
   {
@@ -114,12 +114,12 @@ void Timer::SetInterval(unsigned int interval, bool restart)
   }
 }
 
-unsigned int Timer::GetInterval() const
+uint32_t TimerWin::GetInterval() const
 {
   return mImpl->mInterval;
 }
 
-bool Timer::Tick()
+bool TimerWin::Tick()
 {
   // Guard against destruction during signal emission
   Dali::Timer handle(this);
@@ -150,12 +150,7 @@ bool Timer::Tick()
   return retVal;
 }
 
-Dali::Timer::TimerSignalType& Timer::TickSignal()
-{
-  return mTickSignal;
-}
-
-bool Timer::IsRunning() const
+bool TimerWin::IsRunning() const
 {
   return 0 <= mImpl->mId;
 }
diff --git a/dali/internal/system/windows/timer-impl-win.h b/dali/internal/system/windows/timer-impl-win.h
new file mode 100644 (file)
index 0000000..56b738f
--- /dev/null
@@ -0,0 +1,116 @@
+#ifndef DALI_INTERNAL_ADAPTOR_SYSTEM_WINDOWS_TIMER_H
+#define DALI_INTERNAL_ADAPTOR_SYSTEM_WINDOWS_TIMER_H
+
+/*
+ * 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.
+ * 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.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali/internal/system/common/timer-impl.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+class TimerWin;
+
+typedef IntrusivePtr<TimerWin> TimerWinPtr;
+
+/**
+ * @brief TimerWin class provides an Timer Windows implementation.
+ */
+class TimerWin : public Timer
+{
+public:
+  static TimerWinPtr New(uint32_t milliSec);
+
+  /**
+   * Constructor
+   * @param[in]  milliSec  Interval in milliseconds.
+   */
+  TimerWin(uint32_t milliSec);
+
+  /**
+   * Destructor.
+   */
+  virtual ~TimerWin();
+
+public:
+  /**
+   * @copydoc Dali::Timer::Start()
+   */
+  void Start() override;
+
+  /**
+   * @copydoc Dali::Timer::Stop()
+   */
+  void Stop() override;
+
+  /**
+   * @copydoc Dali::Timer::Pause()
+   */
+  void Pause() override;
+
+  /**
+   * @copydoc Dali::Timer::Resume()
+   */
+  void Resume() override;
+
+  /**
+   * @copydoc Dali::Timer::SetInterval()
+   */
+  void SetInterval(uint32_t interval, bool restart) override;
+
+  /**
+   * @copydoc Dali::Timer::GetInterval()
+   */
+  uint32_t GetInterval() const override;
+
+  /**
+   * @copydoc Dali::Timer::IsRunning()
+   */
+  bool IsRunning() const override;
+
+  /**
+   * Tick
+   */
+  bool Tick();
+
+private: // Implementation
+  // not implemented
+  TimerWin(const TimerWin&) = delete;
+  TimerWin& operator=(const TimerWin&) = delete;
+
+  /**
+   * Resets any stored timer data.
+   */
+  void ResetTimerData();
+
+private: // Data
+  // To hide away implementation details
+  struct Impl;
+  Impl* mImpl;
+};
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
+
+#endif // DALI_INTERNAL_ADAPTOR_SYSTEM_WINDOWS_TIMER_H
index 1f9dcfc..e6e4556 100644 (file)
@@ -30,6 +30,7 @@
 #include <dali/internal/graphics/gles/egl-graphics.h>
 #include <dali/internal/graphics/gles/egl-implementation.h>
 #include <dali/internal/system/common/environment-variables.h>
+#include <dali/internal/system/common/system-factory.h>
 #include <dali/internal/window-system/common/window-base.h>
 #include <dali/internal/window-system/common/window-factory.h>
 #include <dali/internal/window-system/common/window-system.h>
@@ -763,9 +764,7 @@ void WindowRenderSurface::ProcessFrameCallback()
   {
     if(!iter->fileDescriptorMonitor)
     {
-      iter->fileDescriptorMonitor = std::unique_ptr<FileDescriptorMonitor>(new FileDescriptorMonitor(iter->fileDescriptor,
-                                                                                                     MakeCallback(this, &WindowRenderSurface::OnFileDescriptorEventDispatched),
-                                                                                                     FileDescriptorMonitor::FD_READABLE));
+      iter->fileDescriptorMonitor = Dali::Internal::Adaptor::GetSystemFactory()->CreateFileDescriptorMonitor(iter->fileDescriptor, MakeCallback(this, &WindowRenderSurface::OnFileDescriptorEventDispatched), FileDescriptorMonitor::FD_READABLE);
 
       DALI_LOG_RELEASE_INFO("WindowRenderSurface::ProcessFrameCallback: Add handler [%d]\n", iter->fileDescriptor);
     }
index 616c6f2..406ca2b 100644 (file)
@@ -21,6 +21,7 @@
 // INTERNAL HEADERS
 #include <dali/devel-api/adaptor-framework/keyboard.h>
 #include <dali/internal/system/common/file-descriptor-monitor.h>
+#include <dali/internal/system/common/system-factory.h>
 #include <dali/internal/window-system/common/window-system.h>
 
 // EXTERNAL_HEADERS
@@ -455,7 +456,7 @@ struct WindowSystemX::Impl
     XInitThreads();
     mDisplay = XOpenDisplay(nullptr); // Note, DisplayConnection now reads this var.
 
-    mXEventMonitor = new FileDescriptorMonitor(
+    mXEventMonitor = Dali::Internal::Adaptor::GetSystemFactory()->CreateFileDescriptorMonitor(
       ConnectionNumber(mDisplay),
       MakeCallback(this, &WindowSystemX::Impl::XPollCallback),
       FileDescriptorMonitor::FD_READABLE);
@@ -470,7 +471,6 @@ struct WindowSystemX::Impl
   {
     // @todo Flush events, delete fd handlers, shutdown other X subsystems
     XCloseDisplay(mDisplay);
-    delete mXEventMonitor;
   }
 
   ::Display* GetXDisplay()
@@ -663,7 +663,7 @@ struct WindowSystemX::Impl
   using EventHandlerFunctionPointer = void (*)(const XEvent*);
   std::unordered_map<int, EventHandlerFunctionPointer> mXEventHandlers;
   std::vector<WindowSystemBase::EventHandler>          mHandlers;
-  FileDescriptorMonitor*                               mXEventMonitor;
+  std::unique_ptr<FileDescriptorMonitor>               mXEventMonitor;
   XIDeviceInfo*                                        mXi2Devices{nullptr};
   int                                                  mXi2NumberOfDevices{0};
   int                                                  mXi2OpCode{-1};
index ef779f8..9a7a59c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 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.
@@ -19,6 +19,7 @@
 #include <dali/public-api/adaptor-framework/timer.h>
 
 // INTERNAL INCLUDES
+#include <dali/internal/system/common/system-factory.h>
 #include <dali/internal/system/common/timer-impl.h>
 #include <dali/public-api/dali-adaptor-common.h>
 
@@ -28,9 +29,9 @@ Timer::Timer()
 {
 }
 
-Timer Timer::New(unsigned int milliSec)
+Timer Timer::New(uint32_t milliSec)
 {
-  Internal::Adaptor::TimerPtr internal = Internal::Adaptor::Timer::New(milliSec);
+  Internal::Adaptor::TimerPtr internal = Dali::Internal::Adaptor::GetSystemFactory()->CreateTimer(milliSec);
   return Timer(internal.Get());
 }
 
index 2b1df7f..3569f29 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_TIMER_H
 
 /*
- * Copyright (c) 2020 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.
@@ -75,7 +75,7 @@ public: // API
    * @param[in] milliSec Interval in milliseconds
    * @return A new timer
    */
-  static Timer New(unsigned int milliSec);
+  static Timer New(uint32_t milliSec);
 
   /**
    * @brief Copy constructor.
@@ -165,7 +165,7 @@ public: // API
    * @SINCE_1_0.0
    * @param[in] milliSec Interval in milliseconds
    */
-  void SetInterval(unsigned int milliSec);
+  void SetInterval(uint32_t milliSec);
 
   /**
    * @brief Sets a new interval on the timer with option to restart the timer.
@@ -175,7 +175,7 @@ public: // API
    * @param[in] milliSec Interval in milliseconds
    * @param[in] restart Flag to set enabled to restart or not.
    */
-  void SetInterval(unsigned int milliSec, bool restart);
+  void SetInterval(uint32_t milliSec, bool restart);
 
   /**
    * @brief Gets the interval of timer.
@@ -183,7 +183,7 @@ public: // API
    * @SINCE_1_0.0
    * @return Interval in milliseconds
    */
-  unsigned int GetInterval() const;
+  uint32_t GetInterval() const;
 
   /**
    * @brief Tells whether timer is running.