summaryrefslogtreecommitdiff
path: root/include/comphelper
diff options
context:
space:
mode:
authorArnaud Versini <arnaud.versini@gmail.com>2017-06-05 16:12:27 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-06-12 08:45:48 +0200
commita7532d8f061986c2e828df32f47f1fee1a339a14 (patch)
treea7a1421a1476e246e620a03c6188b312db015c06 /include/comphelper
parent0b8c2c72c988488895d74d1bb36e60378283a4da (diff)
Remove VCLExternalSolarLock and IMutex.
Next step is to remove OContextEntryGuard. Change-Id: I9460fb67fba6f3bfb3c809b730c33f38d225a64e Reviewed-on: https://gerrit.libreoffice.org/38411 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'include/comphelper')
-rw-r--r--include/comphelper/accessiblecomponenthelper.hxx8
-rw-r--r--include/comphelper/accessiblecontexthelper.hxx80
-rw-r--r--include/comphelper/accessibleselectionhelper.hxx3
-rw-r--r--include/comphelper/accessibletexthelper.hxx3
4 files changed, 9 insertions, 85 deletions
diff --git a/include/comphelper/accessiblecomponenthelper.hxx b/include/comphelper/accessiblecomponenthelper.hxx
index 42a886a0a5a3..e7ac2fa157a6 100644
--- a/include/comphelper/accessiblecomponenthelper.hxx
+++ b/include/comphelper/accessiblecomponenthelper.hxx
@@ -41,7 +41,7 @@ namespace comphelper
{
protected:
/// see the respective base class ctor for an extensive comment on this, please
- OCommonAccessibleComponent( IMutex* _pExternalLock );
+ OCommonAccessibleComponent();
virtual ~OCommonAccessibleComponent() override;
protected:
@@ -87,8 +87,7 @@ namespace comphelper
,public OAccessibleComponentHelper_Base
{
protected:
- /// see the respective base class ctor for an extensive comment on this, please
- OAccessibleComponentHelper( IMutex* _pExternalLock );
+ OAccessibleComponentHelper();
public:
// XInterface
@@ -118,8 +117,7 @@ namespace comphelper
,public OAccessibleExtendedComponentHelper_Base
{
protected:
- /// see the respective base class ctor for an extensive comment on this, please
- OAccessibleExtendedComponentHelper( IMutex* _pExternalLock );
+ OAccessibleExtendedComponentHelper( );
public:
// XInterface
diff --git a/include/comphelper/accessiblecontexthelper.hxx b/include/comphelper/accessiblecontexthelper.hxx
index 7163817280a3..1cc27da80b3e 100644
--- a/include/comphelper/accessiblecontexthelper.hxx
+++ b/include/comphelper/accessiblecontexthelper.hxx
@@ -26,6 +26,7 @@
#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
#include <com/sun/star/lang/DisposedException.hpp>
#include <comphelper/comphelperdllapi.h>
+#include <comphelper/solarmutex.hxx>
#include <memory>
@@ -33,45 +34,6 @@ namespace comphelper
{
- //= IMutex
-
-
- // This whole thingie here (own mutex classes and such) is a HACK. I hate the SolarMutex.
- // See below for more explanations ....
-
- /** abstract interface for implementing a mutex
- */
- class COMPHELPER_DLLPUBLIC IMutex
- {
- public:
- virtual ~IMutex();
- virtual void acquire() = 0;
- virtual void release() = 0;
- };
-
-
- //= OMutexGuard
-
-
- class OMutexGuard
- {
- IMutex* m_pMutex;
- public:
- OMutexGuard( IMutex* _pMutex )
- :m_pMutex( _pMutex )
- {
- if ( m_pMutex )
- m_pMutex->acquire();
- }
-
- ~OMutexGuard( )
- {
- if ( m_pMutex )
- m_pMutex->release();
- }
- };
-
-
//= OAccessibleContextHelper
@@ -92,33 +54,7 @@ namespace comphelper
protected:
virtual ~OAccessibleContextHelper( ) override;
- /** ctor
-
- <p>If you need additional object safety for your class, and want to ensure that your own
- mutex is locked before the mutex this class provides is, than use this ctor.</p>
-
- <p>Beware that this is a hack. Unfortunately, OpenOffice.org has two different mutex hierarchies,
- which are not compatible. In addition, wide parts of the code (especially VCL) is not thread-safe,
- but instead relies on a <em>single global mutex</em>. As a consequence, components using
- directly or indirectly such code need to care for this global mutex. Yes, this is as ugly as
- anything.</p>
-
- <p>Note that the external lock is used as additional lock, not as the only one. The own mutex of the
- instance is used for internal actions, and every action which potentially involves external code
- (for instance every call to a virtual method overridden by derivees) is <em>additionally</em> and
- <em>first</em> guarded by with the external lock.</p>
-
- <p>Beware of the lifetime of the lock - you must ensure that the lock exists at least as long as
- the context does. A good approach to implement the lock may be to derive you own context
- not only from OAccessibleContextHelper, but also from IMutex.</p>
-
- <p>One more note. This lock is definitely not used once the dtor is reached. Means whatever
- the dtor implementation does, it does <em>not</em> guard the external lock. See this as a contract.
- <br/>You should ensure the same thing for own derivees which do not supply the lock themself,
- but get them from yet another derivee.</p>
- @see forgetExternalLock
- */
- OAccessibleContextHelper( IMutex* _pExternalLock );
+ OAccessibleContextHelper( );
/** late construction
@param _rxAccessible
@@ -180,7 +116,6 @@ namespace comphelper
// ensures that the object is alive
inline void ensureAlive( const OAccessControl& ) const;
- inline IMutex* getExternalLock( const OAccessControl& );
inline ::osl::Mutex& GetMutex( const OAccessControl& );
protected:
@@ -224,7 +159,6 @@ namespace comphelper
// access to the base class' broadcast helper/mutex
::osl::Mutex& GetMutex() { return m_aMutex; }
- IMutex* getExternalLock( );
};
@@ -234,12 +168,6 @@ namespace comphelper
}
- inline IMutex* OAccessibleContextHelper::getExternalLock( const OAccessControl& )
- {
- return getExternalLock();
- }
-
-
inline ::osl::Mutex& OAccessibleContextHelper::GetMutex( const OAccessControl& )
{
return GetMutex();
@@ -287,7 +215,7 @@ namespace comphelper
//= OExternalLockGuard
class OExternalLockGuard
- :public OMutexGuard
+ :public osl::Guard<SolarMutex>
,public OContextEntryGuard
{
public:
@@ -296,7 +224,7 @@ namespace comphelper
inline OExternalLockGuard::OExternalLockGuard( OAccessibleContextHelper* _pContext )
- :OMutexGuard( _pContext->getExternalLock( OAccessibleContextHelper::OAccessControl() ) )
+ :osl::Guard<SolarMutex>( SolarMutex::get() )
,OContextEntryGuard( _pContext )
{
// Only lock the external mutex,
diff --git a/include/comphelper/accessibleselectionhelper.hxx b/include/comphelper/accessibleselectionhelper.hxx
index 0a67e48f498b..d96347f51bb8 100644
--- a/include/comphelper/accessibleselectionhelper.hxx
+++ b/include/comphelper/accessibleselectionhelper.hxx
@@ -104,8 +104,7 @@ namespace comphelper
{
protected:
- /// see the respective base class ctor for an extensive comment on this, please
- OAccessibleSelectionHelper( IMutex* _pExternalLock );
+ OAccessibleSelectionHelper();
// return ourself here by default
virtual css::uno::Reference< css::accessibility::XAccessibleContext > implGetAccessibleContext() override;
diff --git a/include/comphelper/accessibletexthelper.hxx b/include/comphelper/accessibletexthelper.hxx
index 8083ba6ed211..7b5e1a144eac 100644
--- a/include/comphelper/accessibletexthelper.hxx
+++ b/include/comphelper/accessibletexthelper.hxx
@@ -128,8 +128,7 @@ namespace comphelper
public OAccessibleTextHelper_Base
{
protected:
- // see the respective base class ctor for an extensive comment on this, please
- OAccessibleTextHelper( IMutex* _pExternalLock );
+ OAccessibleTextHelper();
public:
// XInterface