Kaydet (Commit) 9aeadc76 authored tarafından Michael Meeks's avatar Michael Meeks

Cleanup intrusive_ptr usage temporarily.

When we update boost, we should use boost::intrusive_ref_counter
in non-threadsafe mode instead here.

Change-Id: Id63610bf14d7fcb7f681e009a5ac6e4f8e077a81
üst c04a0895
...@@ -102,8 +102,8 @@ OOXMLFactory::Pointer_t OOXMLFactory::m_Instance; ...@@ -102,8 +102,8 @@ OOXMLFactory::Pointer_t OOXMLFactory::m_Instance;
OOXMLFactory::OOXMLFactory() OOXMLFactory::OOXMLFactory()
{ {
// multi-thread-safe mutex for all platforms // multi-thread-safe mutex for all platforms
osl::MutexGuard aGuard(OOXMLFactory_Mutex::get()); osl::MutexGuard aGuard(OOXMLFactory_Mutex::get());
mnRefCnt = 0;
} }
OOXMLFactory::~OOXMLFactory() OOXMLFactory::~OOXMLFactory()
......
...@@ -148,16 +148,8 @@ public: ...@@ -148,16 +148,8 @@ public:
void endAction(OOXMLFastContextHandler * pHandler, Token_t nToken); void endAction(OOXMLFastContextHandler * pHandler, Token_t nToken);
virtual ~OOXMLFactory(); virtual ~OOXMLFactory();
inline void IncRef() const{osl_atomic_increment(&mnRefCnt);} public:
inline void DecRef() const sal_uInt32 mnRefCnt;
{
if (!osl_atomic_decrement(&mnRefCnt))
const_cast<OOXMLFactory*>(this)->Delete();
}
inline void Delete() {delete this;}
inline oslInterlockedCount GetRef() const { return mnRefCnt; }
protected:
mutable oslInterlockedCount mnRefCnt; // reference count
private: private:
static Pointer_t m_Instance; static Pointer_t m_Instance;
...@@ -170,13 +162,14 @@ private: ...@@ -170,13 +162,14 @@ private:
Token_t Element); Token_t Element);
}; };
inline void intrusive_ptr_add_ref(const OOXMLFactory* p) inline void intrusive_ptr_add_ref(OOXMLFactory* p)
{ {
p->IncRef(); p->mnRefCnt++;
} }
inline void intrusive_ptr_release(const OOXMLFactory* p) inline void intrusive_ptr_release(OOXMLFactory* p)
{ {
p->DecRef(); if (!(--p->mnRefCnt))
delete p;
} }
} }
} }
......
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