Kaydet (Commit) 0ae79a13 authored tarafından Noel Grandin's avatar Noel Grandin

use SimpleReferenceObject in StgPage

to replace hand-rolled version

Change-Id: I5301ef1df786b08b3c5d585a366d95722506f220
üst e656d583
......@@ -36,6 +36,7 @@ $(eval $(call gb_Library_use_libraries,sot,\
cppu \
cppuhelper \
sal \
salhelper \
i18nlangtag \
tl \
ucbhelper \
......
......@@ -37,8 +37,7 @@
// the correctness of the I/O.
StgPage::StgPage( short nSize, sal_Int32 nPage )
: mnRefCount( 0 )
, mnPage( nPage )
: mnPage( nPage )
, mpData( new sal_uInt8[ nSize ] )
, mnSize( nSize )
{
......
......@@ -27,6 +27,7 @@
#include <stgelem.hxx>
#include <boost/noncopyable.hpp>
#include <boost/unordered_map.hpp>
#include <salhelper/simplereferenceobject.hxx>
class UCBStorageStream;
class StgPage;
......@@ -95,8 +96,8 @@ public:
void Clear(); // clear the cache
};
class StgPage : public rtl::IReference, private boost::noncopyable {
sal_uInt32 mnRefCount;
class StgPage : public salhelper::SimpleReferenceObject, private boost::noncopyable
{
const sal_Int32 mnPage; // page index
sal_uInt8* mpData; // nSize bytes
short mnSize; // size of this page
......@@ -110,19 +111,6 @@ public:
short GetSize() { return mnSize; }
public:
virtual oslInterlockedCount SAL_CALL acquire() SAL_OVERRIDE
{
return ++mnRefCount;
}
virtual oslInterlockedCount SAL_CALL release() SAL_OVERRIDE
{
if ( --mnRefCount == 0)
{
delete this;
return 0;
}
return mnRefCount;
}
static bool IsPageGreater( const StgPage *pA, const StgPage *pB );
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment