Create render pass for surface rendering
[platform/core/uifw/dali-core.git] / dali / internal / common / message-buffer.h
index d731b9d..5c791f0 100644 (file)
@@ -1,8 +1,8 @@
-#ifndef __DALI_INTERNAL_MESSAGE_BUFFER_H__
-#define __DALI_INTERNAL_MESSAGE_BUFFER_H__
+#ifndef DALI_INTERNAL_MESSAGE_BUFFER_H
+#define DALI_INTERNAL_MESSAGE_BUFFER_H
 
 /*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
  */
 
 // EXTERNAL INCLUDES
-#include <cstddef>
-
-// INTERNAL INCLUDES
-#include <dali/devel-api/common/mutex.h>
+#include <cstddef> // size_t
+#include <cstdint> // uint32_t
 
 namespace Dali
 {
-
 namespace Internal
 {
-
 /**
  * Utility class to reserve a buffer for storing messages.
  */
 class MessageBuffer
 {
 public:
-  typedef std::ptrdiff_t WordType;
+  using WordType = std::ptrdiff_t;
 
   /**
    * Create a new MessageBuffer
    * @param[in] The smallest capacity which the buffer will allocate, with respect to the size of type "char".
    * @note The buffer will not allocate memory until the first call to ReserveMessageSlot().
    */
-  MessageBuffer( std::size_t initialCapacity );
+  MessageBuffer(std::size_t initialCapacity);
 
   /**
    * Non-virtual destructor; not suitable as a base class
@@ -56,7 +52,7 @@ public:
    * @param[in] size The message size with respect to the size of type "char".
    * @return A pointer to the address allocated for the message, aligned to a word boundary
    */
-  unsigned int* ReserveMessageSlot( std::size_t size );
+  uint32_t* ReserveMessageSlot(std::size_t size);
 
   /**
    * Query the capacity of the message buffer.
@@ -70,7 +66,6 @@ public:
   class Iterator
   {
   public:
-
     // Constructor
     Iterator(WordType* current);
 
@@ -84,7 +79,7 @@ public:
     // Inlined for performance
     WordType* Get()
     {
-      return ( 0 != mMessageSize ) ? mCurrent : NULL;
+      return (0 != mMessageSize) ? mCurrent : nullptr;
     }
 
     // Inlined for performance
@@ -99,13 +94,11 @@ public:
     Iterator(const Iterator& copy);
 
   private:
-
     // Undefined
     Iterator& operator=(const Iterator& rhs);
 
   private:
-
-    WordType* mCurrent;
+    WordType*   mCurrent;
     std::size_t mMessageSize;
   };
 
@@ -123,7 +116,6 @@ public:
   void Reset();
 
 private:
-
   // Undefined
   MessageBuffer(const MessageBuffer&);
 
@@ -135,10 +127,9 @@ private:
    * @pre The newCapacity is greater than mCapacity.
    * @param[in] The newCapacity
    */
-  void IncreaseCapacity( std::size_t newCapacity );
+  void IncreaseCapacity(std::size_t newCapacity);
 
 private:
-
   std::size_t mInitialCapacity; ///< The capacity to allocate during first call to ReserveMessageSlot
 
   WordType* mData;     ///< The data allocated for the message buffer
@@ -146,11 +137,10 @@ private:
 
   std::size_t mCapacity; ///< The memory allocated with respect to sizeof(WordType)
   std::size_t mSize;     ///< The memory reserved for messages with respect to sizeof(WordType)
-  Dali::Mutex mMutex;    ///< Mutex to ensure correct access locking
 };
 
 } // namespace Internal
 
 } // namespace Dali
 
-#endif // __DALI_INTERNAL_MESSAGE_BUFFER_H__
+#endif // DALI_INTERNAL_MESSAGE_BUFFER_H