Move memory pool class internal 77/36377/1
authorKingsley Stephens <k.stephens@partner.samsung.com>
Thu, 5 Mar 2015 15:09:04 +0000 (15:09 +0000)
committerKingsley Stephens <k.stephens@partner.samsung.com>
Thu, 5 Mar 2015 15:09:04 +0000 (15:09 +0000)
Change-Id: Ic4eadc317eb46b92f5531d8ee5e489dc6fa9c34d

automated-tests/src/dali-internal/CMakeLists.txt
automated-tests/src/dali-internal/utc-Dali-Internal-FixedSizeMemoryPool.cpp [moved from automated-tests/src/dali/utc-Dali-FixedSizeMemoryPool.cpp with 86% similarity]
automated-tests/src/dali-internal/utc-Dali-Internal-MemoryPoolObjectAllocator.cpp [moved from automated-tests/src/dali/utc-Dali-MemoryPoolObjectAllocator.cpp with 89% similarity]
automated-tests/src/dali/CMakeLists.txt
dali/internal/common/fixed-size-memory-pool.cpp [moved from dali/public-api/common/fixed-size-memory-pool.cpp with 98% similarity]
dali/internal/common/fixed-size-memory-pool.h [moved from dali/public-api/common/fixed-size-memory-pool.h with 93% similarity]
dali/internal/common/memory-pool-object-allocator.h [moved from dali/public-api/common/memory-pool-object-allocator.h with 89% similarity]
dali/internal/file.list
dali/public-api/dali-core.h
dali/public-api/file.list

index 4eb0052..26b6e8f 100644 (file)
@@ -16,6 +16,8 @@ SET(TC_SOURCES
         utc-Dali-Internal-Image-Culling.cpp
         utc-Dali-Internal-Text-Culling.cpp
         utc-Dali-Internal-Constraint.cpp
+        utc-Dali-Internal-FixedSizeMemoryPool.cpp
+        utc-Dali-Internal-MemoryPoolObjectAllocator.cpp
 )
 
 LIST(APPEND TC_SOURCES
 #include <dali/public-api/dali-core.h>
 #include <dali-test-suite-utils.h>
 
+// Internal headers are allowed here
+
+#include <dali/internal/common/fixed-size-memory-pool.h>
+
 using namespace Dali;
 
-void utc_dali_fixedsizememorypool_startup(void)
+void utc_dali_internal_fixedsizememorypool_startup(void)
 {
   test_return_value = TET_UNDEF;
 }
 
-void utc_dali_fixedsizememorypool_cleanup(void)
+void utc_dali_internal_fixedsizememorypool_cleanup(void)
 {
   test_return_value = TET_PASS;
 }
@@ -84,7 +88,7 @@ int UtcDaliFixedSizeMemoryPoolCreate(void)
   gTestObjectMethod = 0;
   gTestObjectDataAccess = 0;
 
-  FixedSizeMemoryPool memoryPool( TypeSizeWithAlignment< TestObject >::size );
+  Internal::FixedSizeMemoryPool memoryPool( Internal::TypeSizeWithAlignment< TestObject >::size );
 
   TestObject* testObject1 = new (memoryPool.Allocate()) TestObject();
   DALI_TEST_CHECK( testObject1 );
@@ -115,7 +119,7 @@ int UtcDaliFixedSizeMemoryPoolStressTest(void)
 
   const unsigned int numObjects = 1024 * 1024;
 
-  FixedSizeMemoryPool memoryPool( TypeSizeWithAlignment< TestObject >::size, initialCapacity, maximumCapacity );
+  Internal::FixedSizeMemoryPool memoryPool( Internal::TypeSizeWithAlignment< TestObject >::size, initialCapacity, maximumCapacity );
 
   Dali::Vector<TestObject*> objects;
   objects.Reserve( numObjects );
 #include <dali/public-api/dali-core.h>
 #include <dali-test-suite-utils.h>
 
+// Internal headers are allowed here
+
+#include <dali/internal/common/memory-pool-object-allocator.h>
+
 using namespace Dali;
 
-void utc_dali_memorypoolobjectallocator_startup(void)
+void utc_dali_internal_memorypoolobjectallocator_startup(void)
 {
   test_return_value = TET_UNDEF;
 }
 
-void utc_dali_memorypoolobjectallocator_cleanup(void)
+void utc_dali_internal_memorypoolobjectallocator_cleanup(void)
 {
   test_return_value = TET_PASS;
 }
@@ -98,7 +102,7 @@ private:
 int UtcDaliMemoryPoolObjectAllocatorObjectAllocation(void)
 {
 
-  MemoryPoolObjectAllocator< MemoryPoolObjectAllocatorTestObject > allocator;
+  Internal::MemoryPoolObjectAllocator< MemoryPoolObjectAllocatorTestObject > allocator;
 
   // Allocate an object
   MemoryPoolObjectAllocatorTestObject* testObject1 = allocator.Allocate();
@@ -139,7 +143,7 @@ int UtcDaliMemoryPoolObjectAllocatorObjectAllocation(void)
 
 int UtcDaliMemoryPoolObjectAllocatorObjectRawAllocation(void)
 {
-  MemoryPoolObjectAllocator< MemoryPoolObjectAllocatorTestObject > allocator;
+  Internal::MemoryPoolObjectAllocator< MemoryPoolObjectAllocatorTestObject > allocator;
 
   MemoryPoolObjectAllocatorTestObject* testObject = new ( allocator.AllocateRaw() ) MemoryPoolObjectAllocatorTestObject();
   DALI_TEST_CHECK( testObject );
@@ -161,7 +165,7 @@ int UtcDaliMemoryPoolObjectAllocatorObjectRawAllocation(void)
 
 int UtcDaliMemoryPoolObjectAllocatorObjectAllocationPOD(void)
 {
-  MemoryPoolObjectAllocator< bool > allocator;
+  Internal::MemoryPoolObjectAllocator< bool > allocator;
 
   bool* testObject1 = allocator.Allocate();
   DALI_TEST_CHECK( testObject1 );
index b07df63..a3cd3aa 100644 (file)
@@ -30,7 +30,6 @@ SET(TC_SOURCES
         utc-Dali-DynamicsWorld.cpp
         utc-Dali-DynamicsWorldConfig.cpp
         utc-Dali-EncodedBufferImage.cpp
-        utc-Dali-FixedSizeMemoryPool.cpp
         utc-Dali-Font.cpp
         utc-Dali-FontParameters.cpp
         utc-Dali-FrameBufferImage.cpp
@@ -51,7 +50,6 @@ SET(TC_SOURCES
         utc-Dali-MathUtils.cpp
         utc-Dali-Matrix.cpp
         utc-Dali-Matrix3.cpp
-        utc-Dali-MemoryPoolObjectAllocator.cpp
         utc-Dali-MeshActor.cpp
         utc-Dali-MeshData.cpp
         utc-Dali-MouseWheelEvent.cpp
@@ -16,7 +16,7 @@
  */
 
 // CLASS HEADER
-#include <dali/public-api/common/fixed-size-memory-pool.h>
+#include <dali/internal/common/fixed-size-memory-pool.h>
 
 // INTERNAL HEADERS
 #include <dali/public-api/dali-core.h>
@@ -24,6 +24,9 @@
 namespace Dali
 {
 
+namespace Internal
+{
+
 /**
  * @brief Private implementation class
  */
@@ -125,8 +128,6 @@ struct FixedSizeMemoryPool::Impl
   void* mDeletedObjects;              ///< Pointer to the head of the list of deleted objects. The addresses are stored in the allocated memory blocks.
 };
 
-
-
 FixedSizeMemoryPool::FixedSizeMemoryPool( SizeType fixedSize, SizeType initialCapacity, SizeType maximumBlockCapacity )
 {
   mImpl = new Impl( fixedSize, initialCapacity, maximumBlockCapacity );
@@ -168,4 +169,6 @@ void FixedSizeMemoryPool::Free( void* memory )
   mImpl->mDeletedObjects = memory;
 }
 
+} // namespace Internal
+
 } // namespace Dali
@@ -1,5 +1,5 @@
-#ifndef __DALI_FIXED_SIZE_MEMORY_POOL_H__
-#define __DALI_FIXED_SIZE_MEMORY_POOL_H__
+#ifndef __DALI_INTERNAL_FIXED_SIZE_MEMORY_POOL_H__
+#define __DALI_INTERNAL_FIXED_SIZE_MEMORY_POOL_H__
 
 /*
  * Copyright (c) 2015 Samsung Electronics Co., Ltd.
@@ -25,6 +25,9 @@
 namespace Dali
 {
 
+namespace Internal
+{
+
 /**
  * @brief Calculate the size of a type taking alignment into account
  */
@@ -91,7 +94,8 @@ private:
 
 };
 
+} // namespace Internal
 
 } // namespace Dali
 
-#endif /* __DALI_FIXED_SIZE_MEMORY_POOL_H__ */
+#endif /* __DALI_INTERNAL_FIXED_SIZE_MEMORY_POOL_H__ */
@@ -1,5 +1,5 @@
-#ifndef __DALI_MEMORY_POOL_OBJECT_ALLOCATOR_H__
-#define __DALI_MEMORY_POOL_OBJECT_ALLOCATOR_H__
+#ifndef __DALI_INTERNAL_MEMORY_POOL_OBJECT_ALLOCATOR_H__
+#define __DALI_INTERNAL_MEMORY_POOL_OBJECT_ALLOCATOR_H__
 
 /*
  * Copyright (c) 2015 Samsung Electronics Co., Ltd.
  */
 
 // INTERNAL INCLUDES
-#include <dali/public-api/common/fixed-size-memory-pool.h>
+#include <dali/internal/common/fixed-size-memory-pool.h>
 
 namespace Dali
 {
 
+namespace Internal
+{
+
 /**
  * @brief Helper for allocating/deallocating objects using a memory pool.
  *
@@ -107,6 +110,8 @@ private:
 
 };
 
+} // namespace Internal
+
 } // namespace Dali
 
-#endif /* __DALI_MEMORY_POOL_OBJECT_ALLOCATOR_H__ */
+#endif /* __DALI_INTERNAL_MEMORY_POOL_OBJECT_ALLOCATOR_H__ */
index 7e22718..5d1554c 100644 (file)
@@ -8,6 +8,7 @@ internal_src_files = \
   $(internal_src_dir)/common/text-parameters.cpp \
   $(internal_src_dir)/common/image-sampler.cpp \
   $(internal_src_dir)/common/dali-hash.cpp \
+  $(internal_src_dir)/common/fixed-size-memory-pool.cpp \
   \
   $(internal_src_dir)/event/actor-attachments/actor-attachment-impl.cpp \
   $(internal_src_dir)/event/actor-attachments/camera-attachment-impl.cpp \
index caa6819..55a7b4d 100644 (file)
 #include <dali/public-api/common/constants.h>
 #include <dali/public-api/common/dali-common.h>
 #include <dali/public-api/common/dali-vector.h>
-#include <dali/public-api/common/fixed-size-memory-pool.h>
 #include <dali/public-api/common/intrusive-ptr.h>
 #include <dali/public-api/common/loading-state.h>
-#include <dali/public-api/common/memory-pool-object-allocator.h>
 #include <dali/public-api/common/mutex.h>
 #include <dali/public-api/common/stage.h>
 #include <dali/public-api/common/vector-wrapper.h>
index 021d96a..b68aa3a 100644 (file)
@@ -23,7 +23,6 @@ public_api_src_files = \
   $(public_api_src_dir)/common/constants.cpp \
   $(public_api_src_dir)/common/dali-common.cpp \
   $(public_api_src_dir)/common/dali-vector.cpp \
-  $(public_api_src_dir)/common/fixed-size-memory-pool.cpp \
   $(public_api_src_dir)/common/mutex.cpp \
   $(public_api_src_dir)/common/stage.cpp \
   $(public_api_src_dir)/dynamics/dynamics-body.cpp \
@@ -155,12 +154,10 @@ public_api_core_common_header_files = \
   $(public_api_src_dir)/common/constants.h \
   $(public_api_src_dir)/common/dali-common.h \
   $(public_api_src_dir)/common/dali-vector.h \
-  $(public_api_src_dir)/common/fixed-size-memory-pool.h \
   $(public_api_src_dir)/common/intrusive-ptr.h \
   $(public_api_src_dir)/common/loading-state.h \
   $(public_api_src_dir)/common/mutex.h \
   $(public_api_src_dir)/common/map-wrapper.h \
-  $(public_api_src_dir)/common/memory-pool-object-allocator.h \
   $(public_api_src_dir)/common/ref-counted-dali-vector.h \
   $(public_api_src_dir)/common/set-wrapper.h \
   $(public_api_src_dir)/common/scoped-pointer.h \