1*0ee16518SIngo Weinhold /* 2*0ee16518SIngo Weinhold * Copyright 2009,2011, Haiku, Inc. 3*0ee16518SIngo Weinhold * Distributed under the terms of the MIT License. 4*0ee16518SIngo Weinhold */ 5*0ee16518SIngo Weinhold #ifndef _PACKAGE__HPKG__BLOCK_BUFFER_POOL_H_ 6*0ee16518SIngo Weinhold #define _PACKAGE__HPKG__BLOCK_BUFFER_POOL_H_ 7*0ee16518SIngo Weinhold 8*0ee16518SIngo Weinhold 9*0ee16518SIngo Weinhold #include <SupportDefs.h> 10*0ee16518SIngo Weinhold 11*0ee16518SIngo Weinhold #include <package/hpkg/BufferPool.h> 12*0ee16518SIngo Weinhold 13*0ee16518SIngo Weinhold 14*0ee16518SIngo Weinhold namespace BPackageKit { 15*0ee16518SIngo Weinhold 16*0ee16518SIngo Weinhold namespace BHPKG { 17*0ee16518SIngo Weinhold 18*0ee16518SIngo Weinhold 19*0ee16518SIngo Weinhold namespace BPrivate { 20*0ee16518SIngo Weinhold class BlockBufferPoolImpl; 21*0ee16518SIngo Weinhold } 22*0ee16518SIngo Weinhold using BPrivate::BlockBufferPoolImpl; 23*0ee16518SIngo Weinhold 24*0ee16518SIngo Weinhold 25*0ee16518SIngo Weinhold class BBlockBufferPool : public BBufferPool, public BBufferPoolLockable { 26*0ee16518SIngo Weinhold public: 27*0ee16518SIngo Weinhold BBlockBufferPool(size_t blockSize, 28*0ee16518SIngo Weinhold uint32 maxCachedBlocks); 29*0ee16518SIngo Weinhold virtual ~BBlockBufferPool(); 30*0ee16518SIngo Weinhold 31*0ee16518SIngo Weinhold virtual status_t Init(); 32*0ee16518SIngo Weinhold 33*0ee16518SIngo Weinhold virtual PoolBuffer* GetBuffer(size_t size, 34*0ee16518SIngo Weinhold PoolBuffer** owner = NULL, 35*0ee16518SIngo Weinhold bool* _newBuffer = NULL); 36*0ee16518SIngo Weinhold virtual void PutBufferAndCache(PoolBuffer** owner); 37*0ee16518SIngo Weinhold virtual void PutBuffer(PoolBuffer** owner); 38*0ee16518SIngo Weinhold 39*0ee16518SIngo Weinhold private: 40*0ee16518SIngo Weinhold BlockBufferPoolImpl* fImpl; 41*0ee16518SIngo Weinhold }; 42*0ee16518SIngo Weinhold 43*0ee16518SIngo Weinhold 44*0ee16518SIngo Weinhold } // namespace BHPKG 45*0ee16518SIngo Weinhold 46*0ee16518SIngo Weinhold } // namespace BPackageKit 47*0ee16518SIngo Weinhold 48*0ee16518SIngo Weinhold 49*0ee16518SIngo Weinhold #endif // _PACKAGE__HPKG__BLOCK_BUFFER_POOL_H_ 50