Merge "Changed 'virtual' function override declarations to 'override' in automated...
[platform/core/uifw/dali-adaptor.git] / dali / internal / legacy / common / tizen-platform-abstraction.h
index 67b9a56..9f501d7 100644 (file)
@@ -1,8 +1,8 @@
-#ifndef __DALI_TIZEN_PLATFORM_ABSTRACTION_H__
-#define __DALI_TIZEN_PLATFORM_ABSTRACTION_H__
+#ifndef DALI_TIZEN_PLATFORM_ABSTRACTION_H
+#define DALI_TIZEN_PLATFORM_ABSTRACTION_H
 
 /*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  */
 
 // INTERNAL INCLUDES
+#include <dali/public-api/adaptor-framework/timer.h>
 #include <dali/public-api/dali-adaptor-common.h>
 
+
 // EXTERNAL INCLUDES
+#include <cstdint>
 #include <string>
+#include <memory>
 #include <dali/integration-api/platform-abstraction.h>
 
 namespace Dali
 {
 
+class CallbackBase;
+
 namespace TizenPlatform
 {
-
 class ResourceLoader;
 
 /**
@@ -49,47 +54,57 @@ public: // Construction & Destruction
   /**
    * Destructor
    */
-  virtual ~TizenPlatformAbstraction();
+  ~TizenPlatformAbstraction() override;
 
 public: // PlatformAbstraction overrides
 
   /**
    * @copydoc PlatformAbstraction::GetClosestImageSize()
    */
-  virtual ImageDimensions GetClosestImageSize( const std::string& filename,
-                                               ImageDimensions size,
-                                               FittingMode::Type fittingMode,
-                                               SamplingMode::Type samplingMode,
-                                               bool orientationCorrection );
+  ImageDimensions GetClosestImageSize( const std::string& filename,
+                                       ImageDimensions size,
+                                       FittingMode::Type fittingMode,
+                                       SamplingMode::Type samplingMode,
+                                       bool orientationCorrection ) override;
 
   /**
    * @copydoc PlatformAbstraction::GetClosestImageSize()
    */
-  virtual ImageDimensions GetClosestImageSize( Integration::ResourcePointer resourceBuffer,
-                                               ImageDimensions size,
-                                               FittingMode::Type fittingMode,
-                                               SamplingMode::Type samplingMode,
-                                               bool orientationCorrection );
+  ImageDimensions GetClosestImageSize( Integration::ResourcePointer resourceBuffer,
+                                       ImageDimensions size,
+                                       FittingMode::Type fittingMode,
+                                       SamplingMode::Type samplingMode,
+                                       bool orientationCorrection ) override;
 
   /**
    * @copydoc PlatformAbstraction::LoadImageSynchronously()
    */
-  virtual Integration::ResourcePointer LoadImageSynchronously(const Integration::BitmapResourceType& resource, const std::string& resourcePath);
+  Integration::ResourcePointer LoadImageSynchronously(const Integration::BitmapResourceType& resource, const std::string& resourcePath) override;
 
   /**
    * @copydoc PlatformAbstraction::DecodeBuffer()
    */
-  virtual Integration::BitmapPtr DecodeBuffer( const Integration::BitmapResourceType& resource, uint8_t * buffer, size_t size );
+  Integration::BitmapPtr DecodeBuffer( const Integration::BitmapResourceType& resource, uint8_t * buffer, size_t size ) override;
 
   /**
    * @copydoc PlatformAbstraction::LoadShaderBinaryFile()
    */
-  virtual bool LoadShaderBinaryFile( const std::string& filename, Dali::Vector< unsigned char >& buffer ) const;
+  bool LoadShaderBinaryFile( const std::string& filename, Dali::Vector< unsigned char >& buffer ) const override;
 
   /**
    * @copydoc PlatformAbstraction::SaveShaderBinaryFile()
    */
-  virtual bool SaveShaderBinaryFile( const std::string& filename, const unsigned char * buffer, unsigned int numBytes ) const;
+  bool SaveShaderBinaryFile( const std::string& filename, const unsigned char * buffer, unsigned int numBytes ) const override;
+
+  /**
+   * @copydoc PlatformAbstraction::StartTimer()
+   */
+  uint32_t StartTimer( uint32_t milliseconds, CallbackBase* callback ) override;
+
+  /**
+   * @copydoc PlatformAbstraction::CancelTimer()
+   */
+  void CancelTimer ( uint32_t timerId ) override;
 
   /**
    * Sets path for data/resource storage.
@@ -97,13 +112,27 @@ public: // PlatformAbstraction overrides
    */
   void SetDataStoragePath( const std::string& path );
 
+  /**
+   * Clears the timers that have completed
+   */
+  void CleanupTimers();
+
 private:
 
+  struct TimerCallback;
+
+  /*
+   * Executes callback function and cleans up timer
+   */
+  void RunTimerFunction(TimerCallback& timerPtr);
+
   TizenPlatformAbstraction( const TizenPlatformAbstraction& ); ///< Undefined
   TizenPlatformAbstraction& operator=( const TizenPlatformAbstraction& ); ///< Undefined
 
   std::string mDataStoragePath;
 
+  std::vector< std::unique_ptr< TimerCallback > > mTimerPairsWaiting;
+  std::vector< std::unique_ptr< TimerCallback > > mTimerPairsSpent;
 };
 
 /**
@@ -125,4 +154,4 @@ bool SaveFile( const std::string& filename, const unsigned char * buffer, unsign
 
 }  // namespace Dali
 
-#endif // __DALI_TIZEN_PLATFORM_ABSTRACTION_H__
+#endif // DALI_TIZEN_PLATFORM_ABSTRACTION_H