X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Finternal%2Fcommon%2Ffixed-size-memory-pool.h;h=ff4138d68730797b7914cd3e0e08e8d8c3ccae1c;hb=4e6d17f009f42e3b9a7f74cdc65377a04b30abe4;hp=30d70c143a544e1b73f6425e0369f7697866a4f4;hpb=533424c32862b9764cc0592a4c174589a0914c98;p=platform%2Fcore%2Fuifw%2Fdali-core.git diff --git a/dali/internal/common/fixed-size-memory-pool.h b/dali/internal/common/fixed-size-memory-pool.h index 30d70c1..ff4138d 100644 --- a/dali/internal/common/fixed-size-memory-pool.h +++ b/dali/internal/common/fixed-size-memory-pool.h @@ -2,7 +2,7 @@ #define DALI_INTERNAL_FIXED_SIZE_MEMORY_POOL_H /* - * Copyright (c) 2019 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. @@ -24,18 +24,16 @@ namespace Dali { - namespace Internal { - /** * @brief Calculate the size of a type taking alignment into account */ -template< typename T > +template struct TypeSizeWithAlignment { ///< The size of the type with alignment taken into account - static const size_t size = ( ( sizeof( T ) + sizeof( void* ) - 1 ) / sizeof( void* ) ) * sizeof( void* ); + static const size_t size = ((sizeof(T) + sizeof(void*) - 1) / sizeof(void*)) * sizeof(void*); }; /** @@ -52,11 +50,9 @@ struct TypeSizeWithAlignment class FixedSizeMemoryPool { public: - - typedef uint32_t SizeType; + using SizeType = uint32_t; public: - /** * @brief Constructor. * @@ -66,7 +62,7 @@ public: * @param maximumBlockCapacity The maximum size that a new block of memory can be allocated. Defaults to * a large value (1024 * 1024 = 1048576). */ - explicit FixedSizeMemoryPool( SizeType fixedSize, SizeType initialCapacity = 32, SizeType maximumBlockCapacity = 1048576 ); + explicit FixedSizeMemoryPool(SizeType fixedSize, SizeType initialCapacity = 32, SizeType maximumBlockCapacity = 1048576); /** * @brief Destructor. @@ -92,28 +88,25 @@ public: * * @param memory The memory to be deleted. Must have been allocated by this memory pool */ - void Free( void* memory ); + void Free(void* memory); /** * @brief Thread-safe version of Free() * * @param memory The memory to be deleted. Must have been allocated by this memory pool */ - void FreeThreadSafe( void* memory ); + void FreeThreadSafe(void* memory); private: - // Undefined - FixedSizeMemoryPool( const FixedSizeMemoryPool& fixedSizeMemoryPool ); + FixedSizeMemoryPool(const FixedSizeMemoryPool& fixedSizeMemoryPool); // Undefined - FixedSizeMemoryPool& operator=( const FixedSizeMemoryPool& fixedSizeMemoryPool ); + FixedSizeMemoryPool& operator=(const FixedSizeMemoryPool& fixedSizeMemoryPool); private: - struct Impl; Impl* mImpl; - }; } // namespace Internal