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,\ ...@@ -36,6 +36,7 @@ $(eval $(call gb_Library_use_libraries,sot,\
cppu \ cppu \
cppuhelper \ cppuhelper \
sal \ sal \
salhelper \
i18nlangtag \ i18nlangtag \
tl \ tl \
ucbhelper \ ucbhelper \
......
...@@ -37,8 +37,7 @@ ...@@ -37,8 +37,7 @@
// the correctness of the I/O. // the correctness of the I/O.
StgPage::StgPage( short nSize, sal_Int32 nPage ) StgPage::StgPage( short nSize, sal_Int32 nPage )
: mnRefCount( 0 ) : mnPage( nPage )
, mnPage( nPage )
, mpData( new sal_uInt8[ nSize ] ) , mpData( new sal_uInt8[ nSize ] )
, mnSize( nSize ) , mnSize( nSize )
{ {
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include <stgelem.hxx> #include <stgelem.hxx>
#include <boost/noncopyable.hpp> #include <boost/noncopyable.hpp>
#include <boost/unordered_map.hpp> #include <boost/unordered_map.hpp>
#include <salhelper/simplereferenceobject.hxx>
class UCBStorageStream; class UCBStorageStream;
class StgPage; class StgPage;
...@@ -95,8 +96,8 @@ public: ...@@ -95,8 +96,8 @@ public:
void Clear(); // clear the cache void Clear(); // clear the cache
}; };
class StgPage : public rtl::IReference, private boost::noncopyable { class StgPage : public salhelper::SimpleReferenceObject, private boost::noncopyable
sal_uInt32 mnRefCount; {
const sal_Int32 mnPage; // page index const sal_Int32 mnPage; // page index
sal_uInt8* mpData; // nSize bytes sal_uInt8* mpData; // nSize bytes
short mnSize; // size of this page short mnSize; // size of this page
...@@ -110,19 +111,6 @@ public: ...@@ -110,19 +111,6 @@ public:
short GetSize() { return mnSize; } short GetSize() { return mnSize; }
public: 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 ); 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