summaryrefslogtreecommitdiff
path: root/ucb
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2023-02-13 19:00:27 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2023-02-13 20:05:41 +0000
commit155dd761e85600445e95f1f2a844d44544446a64 (patch)
tree405f511b08f8d3ca4fbde78f6e0cda617cf4bac3 /ucb
parent45d9d71c3acdde55743bc8c08fc36d44a5bdd5b4 (diff)
osl::Mutex->std::mutex in ContentResultSetWrapper
Change-Id: I8d015bf1435c6b3becd40ffd9056b9906a6dd19b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146938 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'ucb')
-rw-r--r--ucb/source/cacher/cachedcontentresultset.cxx486
-rw-r--r--ucb/source/cacher/cachedcontentresultset.hxx24
-rw-r--r--ucb/source/cacher/cachedcontentresultsetstub.cxx110
-rw-r--r--ucb/source/cacher/cachedcontentresultsetstub.hxx14
-rw-r--r--ucb/source/cacher/contentresultsetwrapper.cxx432
-rw-r--r--ucb/source/cacher/contentresultsetwrapper.hxx47
6 files changed, 519 insertions, 594 deletions
diff --git a/ucb/source/cacher/cachedcontentresultset.cxx b/ucb/source/cacher/cachedcontentresultset.cxx
index c169a3734b58..7c1f316d1c65 100644
--- a/ucb/source/cacher/cachedcontentresultset.cxx
+++ b/ucb/source/cacher/cachedcontentresultset.cxx
@@ -54,14 +54,13 @@ using namespace cppu;
template<typename T> T CachedContentResultSet::rowOriginGet(
T (SAL_CALL css::sdbc::XRow::* f)(sal_Int32), sal_Int32 columnIndex)
{
- impl_EnsureNotDisposed();
- osl::ResettableMutexGuard aGuard(m_aMutex);
+ std::unique_lock aGuard(m_aMutex);
+ impl_EnsureNotDisposed(aGuard);
sal_Int32 nRow = m_nRow;
sal_Int32 nFetchSize = m_nFetchSize;
sal_Int32 nFetchDirection = m_nFetchDirection;
if( !m_aCache.hasRow( nRow ) )
{
- bool isCleared = false;
if( !m_aCache.hasCausedException( nRow ) )
{
if( !m_xFetchProvider.is() )
@@ -69,23 +68,17 @@ template<typename T> T CachedContentResultSet::rowOriginGet(
OSL_FAIL( "broadcaster was disposed already" );
throw SQLException();
}
- aGuard.clear();
- isCleared = true;
- if( impl_isForwardOnly() )
- applyPositionToOrigin( nRow );
+ if( impl_isForwardOnly(aGuard) )
+ applyPositionToOrigin( aGuard, nRow );
- impl_fetchData( nRow, nFetchSize, nFetchDirection );
- }
- if (isCleared)
- {
- aGuard.reset();
+ impl_fetchData( aGuard, nRow, nFetchSize, nFetchDirection );
}
if( !m_aCache.hasRow( nRow ) )
{
m_bLastReadWasFromCache = false;
- aGuard.clear();
- applyPositionToOrigin( nRow );
- impl_init_xRowOrigin();
+ applyPositionToOrigin( aGuard, nRow );
+ impl_init_xRowOrigin(aGuard);
+ aGuard.unlock();
return (m_xRowOrigin.get()->*f)( columnIndex );
}
}
@@ -96,7 +89,7 @@ template<typename T> T CachedContentResultSet::rowOriginGet(
/* Last chance. Try type converter service... */
if ( m_bLastCachedReadWasNull && rValue.hasValue() )
{
- Reference< XTypeConverter > xConverter = getTypeConverter();
+ Reference< XTypeConverter > xConverter = getTypeConverter(aGuard);
if ( xConverter.is() )
{
try
@@ -665,9 +658,9 @@ CachedContentResultSet::~CachedContentResultSet()
bool CachedContentResultSet
- ::applyPositionToOrigin( sal_Int32 nRow )
+ ::applyPositionToOrigin( std::unique_lock<std::mutex>& rGuard, sal_Int32 nRow )
{
- impl_EnsureNotDisposed();
+ impl_EnsureNotDisposed(rGuard);
/**
@returns
@@ -675,7 +668,6 @@ bool CachedContentResultSet
the result set.
*/
- osl::ResettableMutexGuard aGuard(m_aMutex);
OSL_ENSURE( nRow >= 0, "only positive values supported" );
if( !m_xResultSetOrigin.is() )
{
@@ -689,7 +681,7 @@ bool CachedContentResultSet
bool bAfterLast = m_bAfterLast;
sal_Int32 nForwardOnly = m_nForwardOnly;
- aGuard.clear();
+ rGuard.unlock();
if( bAfterLastApplied || nLastAppliedPos != nRow )
{
@@ -706,7 +698,7 @@ bool CachedContentResultSet
break;
}
- aGuard.reset();
+ rGuard.lock();
m_nLastAppliedPos += nM;
m_bAfterLastApplied = nRow != m_nLastAppliedPos;
return nRow == m_nLastAppliedPos;
@@ -716,7 +708,7 @@ bool CachedContentResultSet
{
m_xResultSetOrigin->beforeFirst();
- aGuard.reset();
+ rGuard.lock();
m_nLastAppliedPos = 0;
m_bAfterLastApplied = false;
return false;
@@ -729,7 +721,7 @@ bool CachedContentResultSet
{
bool bValid = m_xResultSetOrigin->absolute( nRow );
- aGuard.reset();
+ rGuard.lock();
m_nLastAppliedPos = nRow;
m_bAfterLastApplied = !bValid;
return bValid;
@@ -738,7 +730,7 @@ bool CachedContentResultSet
{
bool bValid = m_xResultSetOrigin->relative( nRow - nLastAppliedPos );
- aGuard.reset();
+ rGuard.lock();
m_nLastAppliedPos += ( nRow - nLastAppliedPos );
m_bAfterLastApplied = !bValid;
return bValid;
@@ -746,7 +738,8 @@ bool CachedContentResultSet
}
catch (const SQLException&)
{
- if( !bAfterLastApplied && !bAfterLast && nRow > nLastAppliedPos && impl_isForwardOnly() )
+ rGuard.lock();
+ if( !bAfterLastApplied && !bAfterLast && nRow > nLastAppliedPos && impl_isForwardOnly(rGuard) )
{
sal_Int32 nN = nRow - nLastAppliedPos;
sal_Int32 nM;
@@ -756,7 +749,6 @@ bool CachedContentResultSet
break;
}
- aGuard.reset();
m_nLastAppliedPos += nM;
m_bAfterLastApplied = nRow != m_nLastAppliedPos;
}
@@ -778,27 +770,25 @@ bool bDirection = !!( \
nFetchDirection != FetchDirection::REVERSE ); \
FetchResult aResult = \
fetchInterface->fetchMethod( nRow, nFetchSize, bDirection ); \
-osl::ClearableGuard< osl::Mutex > aGuard2( m_aMutex ); \
aCache.loadData( aResult ); \
sal_Int32 nMax = aCache.getMaxRow(); \
sal_Int32 nCurCount = m_nKnownCount; \
bool bIsFinalCount = aCache.hasKnownLast(); \
bool bCurIsFinalCount = m_bFinalCount; \
-aGuard2.clear(); \
if( nMax > nCurCount ) \
- impl_changeRowCount( nCurCount, nMax ); \
+ impl_changeRowCount( rGuard, nCurCount, nMax ); \
if( bIsFinalCount && !bCurIsFinalCount ) \
- impl_changeIsRowCountFinal( bCurIsFinalCount, bIsFinalCount );
+ impl_changeIsRowCountFinal( rGuard, bCurIsFinalCount, bIsFinalCount );
void CachedContentResultSet
- ::impl_fetchData( sal_Int32 nRow
+ ::impl_fetchData( std::unique_lock<std::mutex>& rGuard, sal_Int32 nRow
, sal_Int32 nFetchSize, sal_Int32 nFetchDirection )
{
FETCH_XXX( m_aCache, m_xFetchProvider, fetch );
}
void CachedContentResultSet
- ::impl_changeRowCount( sal_Int32 nOld, sal_Int32 nNew )
+ ::impl_changeRowCount( std::unique_lock<std::mutex>& rGuard, sal_Int32 nOld, sal_Int32 nNew )
{
OSL_ENSURE( nNew > nOld, "RowCount only can grow" );
if( nNew <= nOld )
@@ -806,22 +796,19 @@ void CachedContentResultSet
//create PropertyChangeEvent and set value
PropertyChangeEvent aEvt;
- {
- osl::Guard< osl::Mutex > aGuard( m_aMutex );
- aEvt.Source = static_cast< XPropertySet * >( this );
- aEvt.Further = false;
- aEvt.OldValue <<= nOld;
- aEvt.NewValue <<= nNew;
+ aEvt.Source = static_cast< XPropertySet * >( this );
+ aEvt.Further = false;
+ aEvt.OldValue <<= nOld;
+ aEvt.NewValue <<= nNew;
- m_nKnownCount = nNew;
- }
+ m_nKnownCount = nNew;
//send PropertyChangeEvent to listeners
- impl_notifyPropertyChangeListeners( aEvt );
+ impl_notifyPropertyChangeListeners( rGuard, aEvt );
}
void CachedContentResultSet
- ::impl_changeIsRowCountFinal( bool bOld, bool bNew )
+ ::impl_changeIsRowCountFinal( std::unique_lock<std::mutex>& rGuard, bool bOld, bool bNew )
{
OSL_ENSURE( !bOld && bNew, "This change is not allowed for IsRowCountFinal" );
if( bOld || !bNew )
@@ -829,29 +816,26 @@ void CachedContentResultSet
//create PropertyChangeEvent and set value
PropertyChangeEvent aEvt;
- {
- osl::Guard< osl::Mutex > aGuard( m_aMutex );
- aEvt.Source = static_cast< XPropertySet * >( this );
- aEvt.Further = false;
- aEvt.OldValue <<= bOld;
- aEvt.NewValue <<= bNew;
+ aEvt.Source = static_cast< XPropertySet * >( this );
+ aEvt.Further = false;
+ aEvt.OldValue <<= bOld;
+ aEvt.NewValue <<= bNew;
- m_bFinalCount = bNew;
- }
+ m_bFinalCount = bNew;
//send PropertyChangeEvent to listeners
- impl_notifyPropertyChangeListeners( aEvt );
+ impl_notifyPropertyChangeListeners( rGuard, aEvt );
}
bool CachedContentResultSet
- ::impl_isKnownValidPosition( sal_Int32 nRow ) const
+ ::impl_isKnownValidPosition( std::unique_lock<std::mutex>& /*rGuard*/, sal_Int32 nRow ) const
{
return m_nKnownCount && nRow
&& nRow <= m_nKnownCount;
}
bool CachedContentResultSet
- ::impl_isKnownInvalidPosition( sal_Int32 nRow ) const
+ ::impl_isKnownInvalidPosition( std::unique_lock<std::mutex>& /*rGuard*/, sal_Int32 nRow ) const
{
if( !nRow )
return true;
@@ -863,11 +847,10 @@ bool CachedContentResultSet
//virtual
void CachedContentResultSet
- ::impl_initPropertySetInfo()
+ ::impl_initPropertySetInfo(std::unique_lock<std::mutex>& rGuard)
{
- ContentResultSetWrapper::impl_initPropertySetInfo();
+ ContentResultSetWrapper::impl_initPropertySetInfo(rGuard);
- osl::Guard< osl::Mutex > aGuard( m_aMutex );
if( m_xMyPropertySetInfo.is() )
return;
m_xMyPropertySetInfo = new CCRS_PropertySetInfo( m_xPropertySetInfo );
@@ -948,12 +931,12 @@ css::uno::Sequence< OUString > SAL_CALL CachedContentResultSet::getSupportedServ
// virtual
-void SAL_CALL CachedContentResultSet
- ::setPropertyValue( const OUString& aPropertyName, const Any& aValue )
+void CachedContentResultSet
+ ::setPropertyValueImpl( std::unique_lock<std::mutex>& rGuard, const OUString& aPropertyName, const Any& aValue )
{
- impl_EnsureNotDisposed();
+ impl_EnsureNotDisposed(rGuard);
- if( !getPropertySetInfo().is() )
+ if( !getPropertySetInfoImpl(rGuard).is() )
{
OSL_FAIL( "broadcaster was disposed already" );
throw UnknownPropertyException();
@@ -988,21 +971,18 @@ void SAL_CALL CachedContentResultSet
//create PropertyChangeEvent and set value
PropertyChangeEvent aEvt;
- {
- osl::Guard< osl::Mutex > aGuard( m_aMutex );
- aEvt.Source = static_cast< XPropertySet * >( this );
- aEvt.PropertyName = aPropertyName;
- aEvt.Further = false;
- aEvt.PropertyHandle = m_xMyPropertySetInfo->
- m_nFetchDirectionPropertyHandle;
- aEvt.OldValue <<= m_nFetchDirection;
- aEvt.NewValue <<= nNew;
-
- m_nFetchDirection = nNew;
- }
+ aEvt.Source = static_cast< XPropertySet * >( this );
+ aEvt.PropertyName = aPropertyName;
+ aEvt.Further = false;
+ aEvt.PropertyHandle = m_xMyPropertySetInfo->
+ m_nFetchDirectionPropertyHandle;
+ aEvt.OldValue <<= m_nFetchDirection;
+ aEvt.NewValue <<= nNew;
+
+ m_nFetchDirection = nNew;
//send PropertyChangeEvent to listeners
- impl_notifyPropertyChangeListeners( aEvt );
+ impl_notifyPropertyChangeListeners( rGuard, aEvt );
}
else if( aProp.Name == g_sPropertyNameForFetchSize )
{
@@ -1020,32 +1000,26 @@ void SAL_CALL CachedContentResultSet
//create PropertyChangeEvent and set value
PropertyChangeEvent aEvt;
- {
- osl::Guard< osl::Mutex > aGuard( m_aMutex );
- aEvt.Source = static_cast< XPropertySet * >( this );
- aEvt.PropertyName = aPropertyName;
- aEvt.Further = false;
- aEvt.PropertyHandle = m_xMyPropertySetInfo->
- m_nFetchSizePropertyHandle;
- aEvt.OldValue <<= m_nFetchSize;
- aEvt.NewValue <<= nNew;
-
- m_nFetchSize = nNew;
- }
+ aEvt.Source = static_cast< XPropertySet * >( this );
+ aEvt.PropertyName = aPropertyName;
+ aEvt.Further = false;
+ aEvt.PropertyHandle = m_xMyPropertySetInfo->
+ m_nFetchSizePropertyHandle;
+ aEvt.OldValue <<= m_nFetchSize;
+ aEvt.NewValue <<= nNew;
+
+ m_nFetchSize = nNew;
//send PropertyChangeEvent to listeners
- impl_notifyPropertyChangeListeners( aEvt );
+ impl_notifyPropertyChangeListeners( rGuard, aEvt );
}
else
{
- impl_init_xPropertySetOrigin();
+ impl_init_xPropertySetOrigin(rGuard);
+ if( !m_xPropertySetOrigin.is() )
{
- osl::Guard< osl::Mutex > aGuard( m_aMutex );
- if( !m_xPropertySetOrigin.is() )
- {
- OSL_FAIL( "broadcaster was disposed already" );
- return;
- }
+ OSL_FAIL( "broadcaster was disposed already" );
+ return;
}
m_xPropertySetOrigin->setPropertyValue( aPropertyName, aValue );
}
@@ -1056,9 +1030,10 @@ void SAL_CALL CachedContentResultSet
Any SAL_CALL CachedContentResultSet
::getPropertyValue( const OUString& rPropertyName )
{
- impl_EnsureNotDisposed();
+ std::unique_lock aGuard(m_aMutex);
+ impl_EnsureNotDisposed(aGuard);
- if( !getPropertySetInfo().is() )
+ if( !getPropertySetInfoImpl(aGuard).is() )
{
OSL_FAIL( "broadcaster was disposed already" );
throw UnknownPropertyException();
@@ -1070,35 +1045,29 @@ Any SAL_CALL CachedContentResultSet
Any aValue;
if( rPropertyName == g_sPropertyNameForCount )
{
- osl::Guard< osl::Mutex > aGuard( m_aMutex );
aValue <<= m_nKnownCount;
}
else if( rPropertyName == g_sPropertyNameForFinalCount )
{
- osl::Guard< osl::Mutex > aGuard( m_aMutex );
aValue <<= m_bFinalCount;
}
else if( rPropertyName == g_sPropertyNameForFetchSize )
{
- osl::Guard< osl::Mutex > aGuard( m_aMutex );
aValue <<= m_nFetchSize;
}
else if( rPropertyName == g_sPropertyNameForFetchDirection )
{
- osl::Guard< osl::Mutex > aGuard( m_aMutex );
aValue <<= m_nFetchDirection;
}
else
{
- impl_init_xPropertySetOrigin();
+ impl_init_xPropertySetOrigin(aGuard);
+ if( !m_xPropertySetOrigin.is() )
{
- osl::Guard< osl::Mutex > aGuard( m_aMutex );
- if( !m_xPropertySetOrigin.is() )
- {
- OSL_FAIL( "broadcaster was disposed already" );
- throw UnknownPropertyException();
- }
+ OSL_FAIL( "broadcaster was disposed already" );
+ throw UnknownPropertyException();
}
+ aGuard.unlock();
aValue = m_xPropertySetOrigin->getPropertyValue( rPropertyName );
}
return aValue;
@@ -1108,13 +1077,13 @@ Any SAL_CALL CachedContentResultSet
// own methods. ( inherited )
-//virtual
+//virtual, only called from ContentResultSetWrapperListener
void CachedContentResultSet
::impl_disposing( const EventObject& rEventObject )
{
{
- impl_EnsureNotDisposed();
- osl::Guard< osl::Mutex > aGuard( m_aMutex );
+ std::unique_lock aGuard(m_aMutex);
+ impl_EnsureNotDisposed(aGuard);
//release all references to the broadcaster:
m_xFetchProvider.clear();
m_xFetchProviderForContentAccess.clear();
@@ -1122,11 +1091,12 @@ void CachedContentResultSet
ContentResultSetWrapper::impl_disposing( rEventObject );
}
-//virtual
+//virtual, only called from ContentResultSetWrapperListener
void CachedContentResultSet
::impl_propertyChange( const PropertyChangeEvent& rEvt )
{
- impl_EnsureNotDisposed();
+ std::unique_lock aGuard(m_aMutex);
+ impl_EnsureNotDisposed(aGuard);
PropertyChangeEvent aEvt( rEvt );
aEvt.Source = static_cast< XPropertySet * >( this );
@@ -1153,7 +1123,7 @@ void CachedContentResultSet
return;
}
- impl_changeRowCount( m_nKnownCount, nNew );
+ impl_changeRowCount( aGuard, m_nKnownCount, nNew );
}
else if( aEvt.PropertyName == g_sPropertyNameForFinalCount )
{//IsRowCountFinal changed
@@ -1165,21 +1135,22 @@ void CachedContentResultSet
OSL_FAIL( "PropertyChangeEvent contains wrong data" );
return;
}
- impl_changeIsRowCountFinal( m_bFinalCount, bNew );
+ impl_changeIsRowCountFinal( aGuard, m_bFinalCount, bNew );
}
return;
}
- impl_notifyPropertyChangeListeners( aEvt );
+ impl_notifyPropertyChangeListeners( aGuard, aEvt );
}
-//virtual
+//virtual, only called from ContentResultSetWrapperListener
void CachedContentResultSet
::impl_vetoableChange( const PropertyChangeEvent& rEvt )
{
- impl_EnsureNotDisposed();
+ std::unique_lock aGuard(m_aMutex);
+ impl_EnsureNotDisposed(aGuard);
//don't notify events on my properties, cause they are not vetoable
if( CCRS_PropertySetInfo
@@ -1193,7 +1164,7 @@ void CachedContentResultSet
aEvt.Source = static_cast< XPropertySet * >( this );
aEvt.Further = false;
- impl_notifyVetoableChangeListeners( aEvt );
+ impl_notifyVetoableChangeListeners( aGuard, aEvt );
}
@@ -1201,8 +1172,7 @@ void CachedContentResultSet
#define XCONTENTACCESS_queryXXX( queryXXX, XXX, TYPE ) \
-impl_EnsureNotDisposed(); \
-osl::ResettableMutexGuard aGuard(m_aMutex); \
+impl_EnsureNotDisposed(rGuard); \
sal_Int32 nRow = m_nRow; \
sal_Int32 nFetchSize = m_nFetchSize; \
sal_Int32 nFetchDirection = m_nFetchDirection; \
@@ -1210,7 +1180,6 @@ if( !m_aCache##XXX.hasRow( nRow ) ) \
{ \
try \
{ \
- bool isCleared = false; \
if( !m_aCache##XXX.hasCausedException( nRow ) ) \
{ \
if( !m_xFetchProviderForContentAccess.is() ) \
@@ -1218,22 +1187,15 @@ if( !m_aCache##XXX.hasRow( nRow ) ) \
OSL_FAIL( "broadcaster was disposed already" ); \
throw RuntimeException(); \
} \
- aGuard.clear(); \
- isCleared = true; \
- if( impl_isForwardOnly() ) \
- applyPositionToOrigin( nRow ); \
+ if( impl_isForwardOnly(rGuard) ) \
+ applyPositionToOrigin( rGuard, nRow ); \
\
FETCH_XXX( m_aCache##XXX, m_xFetchProviderForContentAccess, fetch##XXX##s ); \
} \
- if (isCleared) \
- { \
- aGuard.reset(); \
- } \
if( !m_aCache##XXX.hasRow( nRow ) ) \
{ \
- aGuard.clear(); \
- applyPositionToOrigin( nRow ); \
- TYPE aRet = ContentResultSetWrapper::queryXXX();\
+ applyPositionToOrigin( rGuard, nRow ); \
+ TYPE aRet = ContentResultSetWrapper::query##XXX();\
if( m_xContentIdentifierMapping.is() ) \
return m_xContentIdentifierMapping->map##XXX( aRet );\
return aRet; \
@@ -1254,8 +1216,8 @@ if( !m_aCache##XXX.hasRow( nRow ) ) \
return m_aCache##XXX.get##XXX( nRow );
// virtual
-OUString SAL_CALL CachedContentResultSet
- ::queryContentIdentifierString()
+OUString CachedContentResultSet
+ ::queryContentIdentifierStringImpl(std::unique_lock<std::mutex>& rGuard)
{
XCONTENTACCESS_queryXXX( queryContentIdentifierString, ContentIdentifierString, OUString )
}
@@ -1265,6 +1227,7 @@ OUString SAL_CALL CachedContentResultSet
Reference< XContentIdentifier > SAL_CALL CachedContentResultSet
::queryContentIdentifier()
{
+ std::unique_lock rGuard(m_aMutex);
XCONTENTACCESS_queryXXX( queryContentIdentifier, ContentIdentifier, Reference< XContentIdentifier > )
}
@@ -1273,6 +1236,7 @@ Reference< XContentIdentifier > SAL_CALL CachedContentResultSet
Reference< XContent > SAL_CALL CachedContentResultSet
::queryContent()
{
+ std::unique_lock rGuard(m_aMutex);
XCONTENTACCESS_queryXXX( queryContent, Content, Reference< XContent > )
}
@@ -1284,24 +1248,24 @@ Reference< XContent > SAL_CALL CachedContentResultSet
sal_Bool SAL_CALL CachedContentResultSet
::next()
{
- impl_EnsureNotDisposed();
+ std::unique_lock aGuard(m_aMutex);
+ impl_EnsureNotDisposed(aGuard);
- osl::ResettableMutexGuard aGuard(m_aMutex);
//after last
if( m_bAfterLast )
return false;
//last
- aGuard.clear();
+ aGuard.unlock();
if( isLast() )
{
- aGuard.reset();
+ aGuard.lock();
m_nRow++;
m_bAfterLast = true;
return false;
}
- aGuard.reset();
+ aGuard.lock();
//known valid position
- if( impl_isKnownValidPosition( m_nRow + 1 ) )
+ if( impl_isKnownValidPosition( aGuard, m_nRow + 1 ) )
{
m_nRow++;
return true;
@@ -1309,11 +1273,9 @@ sal_Bool SAL_CALL CachedContentResultSet
//unknown position
sal_Int32 nRow = m_nRow;
- aGuard.clear();
- bool bValid = applyPositionToOrigin( nRow + 1 );
+ bool bValid = applyPositionToOrigin( aGuard, nRow + 1 );
- aGuard.reset();
m_nRow = nRow + 1;
m_bAfterLast = !bValid;
return bValid;
@@ -1323,12 +1285,12 @@ sal_Bool SAL_CALL CachedContentResultSet
sal_Bool SAL_CALL CachedContentResultSet
::previous()
{
- impl_EnsureNotDisposed();
+ std::unique_lock aGuard(m_aMutex);
+ impl_EnsureNotDisposed(aGuard);
- if( impl_isForwardOnly() )
+ if( impl_isForwardOnly(aGuard) )
throw SQLException();
- osl::ResettableMutexGuard aGuard(m_aMutex);
//before first ?:
if( !m_bAfterLast && !m_nRow )
return false;
@@ -1340,7 +1302,7 @@ sal_Bool SAL_CALL CachedContentResultSet
return false;
}
//known valid position ?:
- if( impl_isKnownValidPosition( m_nRow - 1 ) )
+ if( impl_isKnownValidPosition( aGuard, m_nRow - 1 ) )
{
m_nRow--;
m_bAfterLast = false;
@@ -1348,11 +1310,9 @@ sal_Bool SAL_CALL CachedContentResultSet
}
//unknown position:
sal_Int32 nRow = m_nRow;
- aGuard.clear();
- bool bValid = applyPositionToOrigin( nRow - 1 );
+ bool bValid = applyPositionToOrigin( aGuard, nRow - 1 );
- aGuard.reset();
m_nRow = nRow - 1;
m_bAfterLast = false;
return bValid;
@@ -1362,16 +1322,15 @@ sal_Bool SAL_CALL CachedContentResultSet
sal_Bool SAL_CALL CachedContentResultSet
::absolute( sal_Int32 row )
{
- impl_EnsureNotDisposed();
+ std::unique_lock aGuard(m_aMutex);
+ impl_EnsureNotDisposed(aGuard);
if( !row )
throw SQLException();
- if( impl_isForwardOnly() )
+ if( impl_isForwardOnly(aGuard) )
throw SQLException();
- osl::ResettableMutexGuard aGuard(m_aMutex);
-
if( !m_xResultSetOrigin.is() )
{
OSL_FAIL( "broadcaster was disposed already" );
@@ -1393,11 +1352,11 @@ sal_Bool SAL_CALL CachedContentResultSet
return bValid;
}
//unknown final count:
- aGuard.clear();
+ aGuard.unlock();
bool bValid = m_xResultSetOrigin->absolute( row );
- aGuard.reset();
+ aGuard.lock();
if( m_bFinalCount )
{
sal_Int32 nNewRow = m_nKnownCount + 1 + row;
@@ -1408,11 +1367,11 @@ sal_Bool SAL_CALL CachedContentResultSet
m_bAfterLastApplied = m_bAfterLast = false;
return bValid;
}
- aGuard.clear();
+ aGuard.unlock();
sal_Int32 nCurRow = m_xResultSetOrigin->getRow();
- aGuard.reset();
+ aGuard.lock();
m_nLastAppliedPos = nCurRow;
m_nRow = nCurRow;
m_bAfterLast = false;
@@ -1432,11 +1391,11 @@ sal_Bool SAL_CALL CachedContentResultSet
return true;
}
//unknown new position:
- aGuard.clear();
+ aGuard.unlock();
bool bValid = m_xResultSetOrigin->absolute( row );
- aGuard.reset();
+ aGuard.lock();
if( m_bFinalCount )
{
sal_Int32 nNewRow = row;
@@ -1452,12 +1411,12 @@ sal_Bool SAL_CALL CachedContentResultSet
m_nRow = nNewRow;
return bValid;
}
- aGuard.clear();
+ aGuard.unlock();
sal_Int32 nCurRow = m_xResultSetOrigin->getRow();
bool bIsAfterLast = m_xResultSetOrigin->isAfterLast();
- aGuard.reset();
+ aGuard.lock();
m_nLastAppliedPos = nCurRow;
m_nRow = nCurRow;
m_bAfterLastApplied = m_bAfterLast = bIsAfterLast;
@@ -1468,13 +1427,13 @@ sal_Bool SAL_CALL CachedContentResultSet
sal_Bool SAL_CALL CachedContentResultSet
::relative( sal_Int32 rows )
{
- impl_EnsureNotDisposed();
+ std::unique_lock aGuard(m_aMutex);
+ impl_EnsureNotDisposed(aGuard);
- if( impl_isForwardOnly() )
+ if( impl_isForwardOnly(aGuard) )
throw SQLException();
- osl::ResettableMutexGuard aGuard(m_aMutex);
- if( m_bAfterLast || impl_isKnownInvalidPosition( m_nRow ) )
+ if( m_bAfterLast || impl_isKnownInvalidPosition( aGuard, m_nRow ) )
throw SQLException();
if( !rows )
@@ -1484,7 +1443,7 @@ sal_Bool SAL_CALL CachedContentResultSet
if( nNewRow < 0 )
nNewRow = 0;
- if( impl_isKnownValidPosition( nNewRow ) )
+ if( impl_isKnownValidPosition( aGuard, nNewRow ) )
{
m_nRow = nNewRow;
m_bAfterLast = false;
@@ -1506,10 +1465,7 @@ sal_Bool SAL_CALL CachedContentResultSet
return false;
}
//unknown new position:
- aGuard.clear();
- bool bValid = applyPositionToOrigin( nNewRow );
-
- aGuard.reset();
+ bool bValid = applyPositionToOrigin( aGuard, nNewRow );
m_nRow = nNewRow;
m_bAfterLast = !bValid; // only nNewRow > 0 possible here
return bValid;
@@ -1521,30 +1477,26 @@ sal_Bool SAL_CALL CachedContentResultSet
sal_Bool SAL_CALL CachedContentResultSet
::first()
{
- impl_EnsureNotDisposed();
+ std::unique_lock aGuard(m_aMutex);
+ impl_EnsureNotDisposed(aGuard);
- if( impl_isForwardOnly() )
+ if( impl_isForwardOnly(aGuard) )
throw SQLException();
- osl::ResettableMutexGuard aGuard(m_aMutex);
- if( impl_isKnownValidPosition( 1 ) )
+ if( impl_isKnownValidPosition( aGuard, 1 ) )
{
m_nRow = 1;
m_bAfterLast = false;
return true;
}
- if( impl_isKnownInvalidPosition( 1 ) )
+ if( impl_isKnownInvalidPosition( aGuard, 1 ) )
{
m_nRow = 1;
m_bAfterLast = false;
return false;
}
//unknown position
- aGuard.clear();
-
- bool bValid = applyPositionToOrigin( 1 );
-
- aGuard.reset();
+ bool bValid = applyPositionToOrigin( aGuard, 1 );
m_nRow = 1;
m_bAfterLast = false;
return bValid;
@@ -1554,12 +1506,12 @@ sal_Bool SAL_CALL CachedContentResultSet
sal_Bool SAL_CALL CachedContentResultSet
::last()
{
- impl_EnsureNotDisposed();
+ std::unique_lock aGuard(m_aMutex);
+ impl_EnsureNotDisposed(aGuard);
- if( impl_isForwardOnly() )
+ if( impl_isForwardOnly(aGuard) )
throw SQLException();
- osl::ResettableMutexGuard aGuard(m_aMutex);
if( m_bFinalCount )
{
m_nRow = m_nKnownCount;
@@ -1572,11 +1524,11 @@ sal_Bool SAL_CALL CachedContentResultSet
OSL_FAIL( "broadcaster was disposed already" );
return false;
}
- aGuard.clear();
+ aGuard.unlock();
bool bValid = m_xResultSetOrigin->last();
- aGuard.reset();
+ aGuard.lock();
m_bAfterLastApplied = m_bAfterLast = false;
if( m_bFinalCount )
{
@@ -1584,11 +1536,11 @@ sal_Bool SAL_CALL CachedContentResultSet
m_nRow = m_nKnownCount;
return bValid;
}
- aGuard.clear();
+ aGuard.unlock();
sal_Int32 nCurRow = m_xResultSetOrigin->getRow();
- aGuard.reset();
+ aGuard.lock();
m_nLastAppliedPos = nCurRow;
m_nRow = nCurRow;
OSL_ENSURE( nCurRow >= m_nKnownCount, "position of last row < known Count, that could not be" );
@@ -1601,12 +1553,12 @@ sal_Bool SAL_CALL CachedContentResultSet
void SAL_CALL CachedContentResultSet
::beforeFirst()
{
- impl_EnsureNotDisposed();
+ std::unique_lock aGuard(m_aMutex);
+ impl_EnsureNotDisposed(aGuard);
- if( impl_isForwardOnly() )
+ if( impl_isForwardOnly(aGuard) )
throw SQLException();
- osl::Guard< osl::Mutex > aGuard( m_aMutex );
m_nRow = 0;
m_bAfterLast = false;
}
@@ -1615,12 +1567,12 @@ void SAL_CALL CachedContentResultSet
void SAL_CALL CachedContentResultSet
::afterLast()
{
- impl_EnsureNotDisposed();
+ std::unique_lock aGuard(m_aMutex);
+ impl_EnsureNotDisposed(aGuard);
- if( impl_isForwardOnly() )
+ if( impl_isForwardOnly(aGuard) )
throw SQLException();
- osl::Guard< osl::Mutex > aGuard( m_aMutex );
m_nRow = 1;
m_bAfterLast = true;
}
@@ -1629,9 +1581,9 @@ void SAL_CALL CachedContentResultSet
sal_Bool SAL_CALL CachedContentResultSet
::isAfterLast()
{
- impl_EnsureNotDisposed();
+ std::unique_lock aGuard(m_aMutex);
+ impl_EnsureNotDisposed(aGuard);
- osl::ResettableMutexGuard aGuard(m_aMutex);
if( !m_bAfterLast )
return false;
if( m_nKnownCount )
@@ -1644,14 +1596,14 @@ sal_Bool SAL_CALL CachedContentResultSet
OSL_FAIL( "broadcaster was disposed already" );
return false;
}
- aGuard.clear();
+ aGuard.unlock();
//find out whether the original resultset contains rows or not
m_xResultSetOrigin->afterLast();
- aGuard.reset();
+ aGuard.lock();
m_bAfterLastApplied = true;
- aGuard.clear();
+ aGuard.unlock();
return m_xResultSetOrigin->isAfterLast();
}
@@ -1660,9 +1612,9 @@ sal_Bool SAL_CALL CachedContentResultSet
sal_Bool SAL_CALL CachedContentResultSet
::isBeforeFirst()
{
- impl_EnsureNotDisposed();
+ std::unique_lock aGuard(m_aMutex);
+ impl_EnsureNotDisposed(aGuard);
- osl::ResettableMutexGuard aGuard(m_aMutex);
if( m_bAfterLast )
return false;
if( m_nRow )
@@ -1677,15 +1629,15 @@ sal_Bool SAL_CALL CachedContentResultSet
OSL_FAIL( "broadcaster was disposed already" );
return false;
}
- aGuard.clear();
+ aGuard.unlock();
//find out whether the original resultset contains rows or not
m_xResultSetOrigin->beforeFirst();
- aGuard.reset();
+ aGuard.lock();
m_bAfterLastApplied = false;
m_nLastAppliedPos = 0;
- aGuard.clear();
+ aGuard.unlock();
return m_xResultSetOrigin->isBeforeFirst();
}
@@ -1694,63 +1646,55 @@ sal_Bool SAL_CALL CachedContentResultSet
sal_Bool SAL_CALL CachedContentResultSet
::isFirst()
{
- impl_EnsureNotDisposed();
+ std::unique_lock aGuard(m_aMutex);
+ impl_EnsureNotDisposed(aGuard);
sal_Int32 nRow = 0;
Reference< XResultSet > xResultSetOrigin;
- {
- osl::Guard< osl::Mutex > aGuard( m_aMutex );
- if( m_bAfterLast )
- return false;
- if( m_nRow != 1 )
- return false;
- if( m_nKnownCount )
- return true;
- if( m_bFinalCount )
- return false;
+ if( m_bAfterLast )
+ return false;
+ if( m_nRow != 1 )
+ return false;
+ if( m_nKnownCount )
+ return true;
+ if( m_bFinalCount )
+ return false;
- nRow = m_nRow;
- xResultSetOrigin = m_xResultSetOrigin;
- }
+ nRow = m_nRow;
+ xResultSetOrigin = m_xResultSetOrigin;
//need to ask origin
- {
- if( applyPositionToOrigin( nRow ) )
- return xResultSetOrigin->isFirst();
- else
- return false;
- }
+ if( !applyPositionToOrigin( aGuard, nRow ) )
+ return false;
+ aGuard.unlock();
+ return xResultSetOrigin->isFirst();
}
//virtual
sal_Bool SAL_CALL CachedContentResultSet
::isLast()
{
- impl_EnsureNotDisposed();
+ std::unique_lock aGuard(m_aMutex);
+ impl_EnsureNotDisposed(aGuard);
sal_Int32 nRow = 0;
Reference< XResultSet > xResultSetOrigin;
- {
- osl::Guard< osl::Mutex > aGuard( m_aMutex );
- if( m_bAfterLast )
- return false;
- if( m_nRow < m_nKnownCount )
- return false;
- if( m_bFinalCount )
- return m_nKnownCount && m_nRow == m_nKnownCount;
+ if( m_bAfterLast )
+ return false;
+ if( m_nRow < m_nKnownCount )
+ return false;
+ if( m_bFinalCount )
+ return m_nKnownCount && m_nRow == m_nKnownCount;
- nRow = m_nRow;
- xResultSetOrigin = m_xResultSetOrigin;
- }
+ nRow = m_nRow;
+ xResultSetOrigin = m_xResultSetOrigin;
//need to ask origin
- {
- if( applyPositionToOrigin( nRow ) )
- return xResultSetOrigin->isLast();
- else
- return false;
- }
+ if( !applyPositionToOrigin( aGuard, nRow ) )
+ return false;
+ aGuard.unlock();
+ return xResultSetOrigin->isLast();
}
@@ -1758,9 +1702,9 @@ sal_Bool SAL_CALL CachedContentResultSet
sal_Int32 SAL_CALL CachedContentResultSet
::getRow()
{
- impl_EnsureNotDisposed();
+ std::unique_lock aGuard(m_aMutex);
+ impl_EnsureNotDisposed(aGuard);
- osl::Guard< osl::Mutex > aGuard( m_aMutex );
if( m_bAfterLast )
return 0;
return m_nRow;
@@ -1770,7 +1714,8 @@ sal_Int32 SAL_CALL CachedContentResultSet
void SAL_CALL CachedContentResultSet
::refreshRow()
{
- impl_EnsureNotDisposed();
+ std::unique_lock aGuard(m_aMutex);
+ impl_EnsureNotDisposed(aGuard);
//the ContentResultSet is static and will not change
//therefore we don't need to reload anything
@@ -1780,7 +1725,8 @@ void SAL_CALL CachedContentResultSet
sal_Bool SAL_CALL CachedContentResultSet
::rowUpdated()
{
- impl_EnsureNotDisposed();
+ std::unique_lock aGuard(m_aMutex);
+ impl_EnsureNotDisposed(aGuard);
//the ContentResultSet is static and will not change
return false;
@@ -1789,7 +1735,8 @@ sal_Bool SAL_CALL CachedContentResultSet
sal_Bool SAL_CALL CachedContentResultSet
::rowInserted()
{
- impl_EnsureNotDisposed();
+ std::unique_lock aGuard(m_aMutex);
+ impl_EnsureNotDisposed(aGuard);
//the ContentResultSet is static and will not change
return false;
@@ -1799,7 +1746,8 @@ sal_Bool SAL_CALL CachedContentResultSet
sal_Bool SAL_CALL CachedContentResultSet
::rowDeleted()
{
- impl_EnsureNotDisposed();
+ std::unique_lock aGuard(m_aMutex);
+ impl_EnsureNotDisposed(aGuard);
//the ContentResultSet is static and will not change
return false;
@@ -1809,7 +1757,8 @@ sal_Bool SAL_CALL CachedContentResultSet
Reference< XInterface > SAL_CALL CachedContentResultSet
::getStatement()
{
- impl_EnsureNotDisposed();
+ std::unique_lock aGuard(m_aMutex);
+ impl_EnsureNotDisposed(aGuard);
//@todo ?return anything
return Reference< XInterface >();
}
@@ -1822,18 +1771,17 @@ Reference< XInterface > SAL_CALL CachedContentResultSet
sal_Bool SAL_CALL CachedContentResultSet
::wasNull()
{
- impl_EnsureNotDisposed();
- impl_init_xRowOrigin();
+ std::unique_lock aGuard(m_aMutex);
+ impl_EnsureNotDisposed(aGuard);
+ impl_init_xRowOrigin(aGuard);
+ if( m_bLastReadWasFromCache )
+ return m_bLastCachedReadWasNull;
+ if( !m_xRowOrigin.is() )
{
- osl::Guard< osl::Mutex > aGuard( m_aMutex );
- if( m_bLastReadWasFromCache )
- return m_bLastCachedReadWasNull;
- if( !m_xRowOrigin.is() )
- {
- OSL_FAIL( "broadcaster was disposed already" );
- return false;
- }
+ OSL_FAIL( "broadcaster was disposed already" );
+ return false;
}
+ aGuard.unlock();
return m_xRowOrigin->wasNull();
}
@@ -1952,13 +1900,12 @@ Any SAL_CALL CachedContentResultSet
//if you change this function please pay attention to
//function template rowOriginGet, where this is similar implemented
- osl::ResettableMutexGuard aGuard(m_aMutex);
+ std::unique_lock aGuard(m_aMutex);
sal_Int32 nRow = m_nRow;
sal_Int32 nFetchSize = m_nFetchSize;
sal_Int32 nFetchDirection = m_nFetchDirection;
if( !m_aCache.hasRow( nRow ) )
{
- bool isCleared = false;
if( !m_aCache.hasCausedException( nRow ) )
{
if( !m_xFetchProvider.is() )
@@ -1966,21 +1913,14 @@ Any SAL_CALL CachedContentResultSet
OSL_FAIL( "broadcaster was disposed already" );
return Any();
}
- isCleared = true;
- aGuard.clear();
-
- impl_fetchData( nRow, nFetchSize, nFetchDirection );
- }
- if (isCleared)
- {
- aGuard.reset();
+ impl_fetchData( aGuard, nRow, nFetchSize, nFetchDirection );
}
if( !m_aCache.hasRow( nRow ) )
{
m_bLastReadWasFromCache = false;
- aGuard.clear();
- applyPositionToOrigin( nRow );
- impl_init_xRowOrigin();
+ applyPositionToOrigin( aGuard, nRow );
+ impl_init_xRowOrigin(aGuard);
+ aGuard.unlock();
return m_xRowOrigin->getObject( columnIndex, typeMap );
}
}
@@ -2027,10 +1967,8 @@ Reference< XArray > SAL_CALL CachedContentResultSet
// Type Converter Support
-const Reference< XTypeConverter >& CachedContentResultSet::getTypeConverter()
+const Reference< XTypeConverter >& CachedContentResultSet::getTypeConverter(std::unique_lock<std::mutex>& )
{
- osl::Guard< osl::Mutex > aGuard( m_aMutex );
-
if ( !m_bTriedToGetTypeConverter && !m_xTypeConverter.is() )
{
m_bTriedToGetTypeConverter = true;
diff --git a/ucb/source/cacher/cachedcontentresultset.hxx b/ucb/source/cacher/cachedcontentresultset.hxx
index 2f6ee771a640..4bca955ee76e 100644
--- a/ucb/source/cacher/cachedcontentresultset.hxx
+++ b/ucb/source/cacher/cachedcontentresultset.hxx
@@ -150,29 +150,29 @@ class CachedContentResultSet
private:
//helping XPropertySet methods.
- virtual void impl_initPropertySetInfo() override;
+ virtual void impl_initPropertySetInfo(std::unique_lock<std::mutex>& rGuard) override;
/// @throws css::sdbc::SQLException
/// @throws css::uno::RuntimeException
bool
- applyPositionToOrigin( sal_Int32 nRow );
+ applyPositionToOrigin( std::unique_lock<std::mutex>& rGuard, sal_Int32 nRow );
/// @throws css::uno::RuntimeException
void
- impl_fetchData( sal_Int32 nRow, sal_Int32 nCount
+ impl_fetchData( std::unique_lock<std::mutex>& rGuard, sal_Int32 nRow, sal_Int32 nCount
, sal_Int32 nFetchDirection );
bool
- impl_isKnownValidPosition( sal_Int32 nRow ) const;
+ impl_isKnownValidPosition( std::unique_lock<std::mutex>& rGuard, sal_Int32 nRow ) const;
bool
- impl_isKnownInvalidPosition( sal_Int32 nRow ) const;
+ impl_isKnownInvalidPosition( std::unique_lock<std::mutex>& rGuard, sal_Int32 nRow ) const;
void
- impl_changeRowCount( sal_Int32 nOld, sal_Int32 nNew );
+ impl_changeRowCount( std::unique_lock<std::mutex>& rGuard, sal_Int32 nOld, sal_Int32 nNew );
void
- impl_changeIsRowCountFinal( bool bOld, bool bNew );
+ impl_changeIsRowCountFinal( std::unique_lock<std::mutex>& rGuard, bool bOld, bool bNew );
public:
CachedContentResultSet(
@@ -203,8 +203,8 @@ public:
// XPropertySet inherited
- virtual void SAL_CALL
- setPropertyValue( const OUString& aPropertyName,
+ virtual void
+ setPropertyValueImpl( std::unique_lock<std::mutex>& rGuard, const OUString& aPropertyName,
const css::uno::Any& aValue ) override;
virtual css::uno::Any SAL_CALL
@@ -225,8 +225,8 @@ public:
// XContentAccess inherited
- virtual OUString SAL_CALL
- queryContentIdentifierString() override;
+ virtual OUString
+ queryContentIdentifierStringImpl(std::unique_lock<std::mutex>& rGuard) override;
virtual css::uno::Reference<
css::ucb::XContentIdentifier > SAL_CALL
@@ -350,7 +350,7 @@ private:
css::uno::Reference< css::script::XTypeConverter > m_xTypeConverter;
const css::uno::Reference<
- css::script::XTypeConverter >& getTypeConverter();
+ css::script::XTypeConverter >& getTypeConverter(std::unique_lock<std::mutex>& rGuard);
template<typename T> T rowOriginGet(
T (SAL_CALL css::sdbc::XRow::* f)(sal_Int32), sal_Int32 columnIndex);
diff --git a/ucb/source/cacher/cachedcontentresultsetstub.cxx b/ucb/source/cacher/cachedcontentresultsetstub.cxx
index a84d8f98f5bf..d1b96abf432b 100644
--- a/ucb/source/cacher/cachedcontentresultsetstub.cxx
+++ b/ucb/source/cacher/cachedcontentresultsetstub.cxx
@@ -91,11 +91,12 @@ Any SAL_CALL CachedContentResultSetStub
// own methods. ( inherited )
-//virtual
+//virtual, only called from ContentResultSetWrapperListener
void CachedContentResultSetStub
::impl_propertyChange( const PropertyChangeEvent& rEvt )
{
- impl_EnsureNotDisposed();
+ std::unique_lock aGuard(m_aMutex);
+ impl_EnsureNotDisposed(aGuard);
//don't notify events on fetchsize and fetchdirection to the above CachedContentResultSet
//because it will ignore them anyway and we can save this remote calls
@@ -107,15 +108,16 @@ void CachedContentResultSetStub
aEvt.Source = static_cast< XPropertySet * >( this );
aEvt.Further = false;
- impl_notifyPropertyChangeListeners( aEvt );
+ impl_notifyPropertyChangeListeners( aGuard, aEvt );
}
-//virtual
+//virtual, only called from ContentResultSetWrapperListener
void CachedContentResultSetStub
::impl_vetoableChange( const PropertyChangeEvent& rEvt )
{
- impl_EnsureNotDisposed();
+ std::unique_lock aGuard(m_aMutex);
+ impl_EnsureNotDisposed(aGuard);
//don't notify events on fetchsize and fetchdirection to the above CachedContentResultSet
//because it will ignore them anyway and we can save this remote calls
@@ -127,7 +129,7 @@ void CachedContentResultSetStub
aEvt.Source = static_cast< XPropertySet * >( this );
aEvt.Further = false;
- impl_notifyVetoableChangeListeners( aEvt );
+ impl_notifyVetoableChangeListeners( aGuard, aEvt );
}
@@ -181,22 +183,23 @@ css::uno::Sequence< OUString > SAL_CALL CachedContentResultSetStub::getSupported
FetchResult CachedContentResultSetStub::impl_fetchHelper(
+ std::unique_lock<std::mutex>& rGuard,
sal_Int32 nRowStartPosition, sal_Int32 nRowCount, bool bDirection,
- std::function<void( css::uno::Any& rRowContent)> impl_loadRow)
+ std::function<void( std::unique_lock<std::mutex>&, css::uno::Any& rRowContent)> impl_loadRow)
{
- impl_EnsureNotDisposed();
+ impl_EnsureNotDisposed(rGuard);
if( !m_xResultSetOrigin.is() )
{
OSL_FAIL( "broadcaster was disposed already" );
throw RuntimeException();
}
- impl_propagateFetchSizeAndDirection( nRowCount, bDirection );
+ impl_propagateFetchSizeAndDirection( rGuard, nRowCount, bDirection );
FetchResult aRet;
aRet.StartIndex = nRowStartPosition;
aRet.Orientation = bDirection;
aRet.FetchError = FetchError::SUCCESS; /*ENDOFDATA, EXCEPTION*/
sal_Int32 nOldOriginal_Pos = m_xResultSetOrigin->getRow();
- if( impl_isForwardOnly() )
+ if( impl_isForwardOnly(rGuard) )
{
if( nOldOriginal_Pos != nRowStartPosition )
{
@@ -211,7 +214,7 @@ FetchResult CachedContentResultSetStub::impl_fetchHelper(
try
{
- impl_loadRow( aRet.Rows.getArray()[0] );
+ impl_loadRow( rGuard, aRet.Rows.getArray()[0] );
}
catch( SQLException& )
{
@@ -258,7 +261,7 @@ FetchResult CachedContentResultSetStub::impl_fetchHelper(
}
for( ; nN <= nRowCount; )
{
- impl_loadRow( pRows[nN-1] );
+ impl_loadRow( rGuard, pRows[nN-1] );
nN++;
if( nN <= nRowCount )
{
@@ -302,22 +305,20 @@ FetchResult SAL_CALL CachedContentResultSetStub
::fetch( sal_Int32 nRowStartPosition
, sal_Int32 nRowCount, sal_Bool bDirection )
{
- impl_init_xRowOrigin();
- return impl_fetchHelper( nRowStartPosition, nRowCount, bDirection,
- [&](css::uno::Any& rRowContent)
- { return impl_getCurrentRowContent(rRowContent, m_xRowOrigin); });
+ std::unique_lock aGuard(m_aMutex);
+ impl_init_xRowOrigin(aGuard);
+ return impl_fetchHelper( aGuard, nRowStartPosition, nRowCount, bDirection,
+ [&](std::unique_lock<std::mutex>& rGuard, css::uno::Any& rRowContent)
+ { return impl_getCurrentRowContent(rGuard, rRowContent, m_xRowOrigin); });
}
sal_Int32 CachedContentResultSetStub
- ::impl_getColumnCount()
+ ::impl_getColumnCount(std::unique_lock<std::mutex>& /*rGuard*/)
{
sal_Int32 nCount;
bool bCached;
- {
- osl::Guard< osl::Mutex > aGuard( m_aMutex );
- nCount = m_nColumnCount;
- bCached = m_bColumnCountCached;
- }
+ nCount = m_nColumnCount;
+ bCached = m_bColumnCountCached;
if( !bCached )
{
try
@@ -332,17 +333,16 @@ sal_Int32 CachedContentResultSetStub
nCount = 0;
}
}
- osl::Guard< osl::Mutex > aGuard( m_aMutex );
m_nColumnCount = nCount;
m_bColumnCountCached = true;
return m_nColumnCount;
}
void CachedContentResultSetStub
- ::impl_getCurrentRowContent( Any& rRowContent
+ ::impl_getCurrentRowContent( std::unique_lock<std::mutex>& rGuard, Any& rRowContent
, const Reference< XRow >& xRow )
{
- sal_Int32 nCount = impl_getColumnCount();
+ sal_Int32 nCount = impl_getColumnCount(rGuard);
Sequence< Any > aContent( nCount );
auto aContentRange = asNonConstRange(aContent);
@@ -355,7 +355,7 @@ void CachedContentResultSetStub
}
void CachedContentResultSetStub
- ::impl_propagateFetchSizeAndDirection( sal_Int32 nFetchSize, bool bFetchDirection )
+ ::impl_propagateFetchSizeAndDirection( std::unique_lock<std::mutex>& rGuard, sal_Int32 nFetchSize, bool bFetchDirection )
{
//this is done only for the case, that there is another CachedContentResultSet in the chain of underlying ResultSets
@@ -371,13 +371,10 @@ void CachedContentResultSetStub
sal_Int32 nLastSize;
bool bLastDirection;
bool bFirstPropagationDone;
- {
- osl::Guard< osl::Mutex > aGuard( m_aMutex );
- bNeedAction = m_bNeedToPropagateFetchSize;
- nLastSize = m_nLastFetchSize;
- bLastDirection = m_bLastFetchDirection;
- bFirstPropagationDone = m_bFirstFetchSizePropagationDone;
- }
+ bNeedAction = m_bNeedToPropagateFetchSize;
+ nLastSize = m_nLastFetchSize;
+ bLastDirection = m_bLastFetchDirection;
+ bFirstPropagationDone = m_bFirstFetchSizePropagationDone;
if( !bNeedAction )
return;
@@ -396,7 +393,6 @@ void CachedContentResultSetStub
if(!bHasSize || !bHasDirection)
{
- osl::Guard< osl::Mutex > aGuard( m_aMutex );
m_bNeedToPropagateFetchSize = false;
return;
}
@@ -405,12 +401,9 @@ void CachedContentResultSetStub
bool bSetSize = ( nLastSize !=nFetchSize ) || !bFirstPropagationDone;
bool bSetDirection = ( bLastDirection !=bFetchDirection ) || !bFirstPropagationDone;
- {
- osl::Guard< osl::Mutex > aGuard( m_aMutex );
- m_bFirstFetchSizePropagationDone = true;
- m_nLastFetchSize = nFetchSize;
- m_bLastFetchDirection = bFetchDirection;
- }
+ m_bFirstFetchSizePropagationDone = true;
+ m_nLastFetchSize = nFetchSize;
+ m_bLastFetchDirection = bFetchDirection;
if( bSetSize )
{
@@ -418,7 +411,7 @@ void CachedContentResultSetStub
aValue <<= nFetchSize;
try
{
- setPropertyValue( m_aPropertyNameForFetchSize, aValue );
+ setPropertyValueImpl( rGuard, m_aPropertyNameForFetchSize, aValue );
}
catch( css::uno::Exception& ) {}
}
@@ -432,7 +425,7 @@ void CachedContentResultSetStub
aValue <<= nFetchDirection;
try
{
- setPropertyValue( m_aPropertyNameForFetchDirection, aValue );
+ setPropertyValueImpl( rGuard, m_aPropertyNameForFetchDirection, aValue );
}
catch( css::uno::Exception& ) {}
}
@@ -442,21 +435,21 @@ void CachedContentResultSetStub
void CachedContentResultSetStub
- ::impl_getCurrentContentIdentifierString( Any& rAny
+ ::impl_getCurrentContentIdentifierString( std::unique_lock<std::mutex>& /*rGuard*/, Any& rAny
, const Reference< XContentAccess >& xContentAccess )
{
rAny <<= xContentAccess->queryContentIdentifierString();
}
void CachedContentResultSetStub
- ::impl_getCurrentContentIdentifier( Any& rAny
+ ::impl_getCurrentContentIdentifier( std::unique_lock<std::mutex>& /*rGuard*/, Any& rAny
, const Reference< XContentAccess >& xContentAccess )
{
rAny <<= xContentAccess->queryContentIdentifier();
}
void CachedContentResultSetStub
- ::impl_getCurrentContent( Any& rAny
+ ::impl_getCurrentContent( std::unique_lock<std::mutex>& /*rGuard*/, Any& rAny
, const Reference< XContentAccess >& xContentAccess )
{
rAny <<= xContentAccess->queryContent();
@@ -467,10 +460,11 @@ FetchResult SAL_CALL CachedContentResultSetStub
::fetchContentIdentifierStrings( sal_Int32 nRowStartPosition
, sal_Int32 nRowCount, sal_Bool bDirection )
{
- impl_init_xContentAccessOrigin();
- return impl_fetchHelper( nRowStartPosition, nRowCount, bDirection,
- [&](css::uno::Any& rRowContent)
- { return impl_getCurrentContentIdentifierString(rRowContent, m_xContentAccessOrigin); });
+ std::unique_lock aGuard( m_aMutex );
+ impl_init_xContentAccessOrigin(aGuard);
+ return impl_fetchHelper( aGuard, nRowStartPosition, nRowCount, bDirection,
+ [&](std::unique_lock<std::mutex>& rGuard, css::uno::Any& rRowContent)
+ { return impl_getCurrentContentIdentifierString(rGuard, rRowContent, m_xContentAccessOrigin); });
}
//virtual
@@ -478,10 +472,11 @@ FetchResult SAL_CALL CachedContentResultSetStub
::fetchContentIdentifiers( sal_Int32 nRowStartPosition
, sal_Int32 nRowCount, sal_Bool bDirection )
{
- impl_init_xContentAccessOrigin();
- return impl_fetchHelper( nRowStartPosition, nRowCount, bDirection,
- [&](css::uno::Any& rRowContent)
- { return impl_getCurrentContentIdentifier(rRowContent, m_xContentAccessOrigin); });
+ std::unique_lock aGuard( m_aMutex );
+ impl_init_xContentAccessOrigin(aGuard);
+ return impl_fetchHelper( aGuard, nRowStartPosition, nRowCount, bDirection,
+ [&](std::unique_lock<std::mutex>& rGuard, css::uno::Any& rRowContent)
+ { return impl_getCurrentContentIdentifier(rGuard, rRowContent, m_xContentAccessOrigin); });
}
//virtual
@@ -489,10 +484,11 @@ FetchResult SAL_CALL CachedContentResultSetStub
::fetchContents( sal_Int32 nRowStartPosition
, sal_Int32 nRowCount, sal_Bool bDirection )
{
- impl_init_xContentAccessOrigin();
- return impl_fetchHelper( nRowStartPosition, nRowCount, bDirection,
- [&](css::uno::Any& rRowContent)
- { return impl_getCurrentContent(rRowContent, m_xContentAccessOrigin); });
+ std::unique_lock aGuard( m_aMutex );
+ impl_init_xContentAccessOrigin(aGuard);
+ return impl_fetchHelper( aGuard, nRowStartPosition, nRowCount, bDirection,
+ [&](std::unique_lock<std::mutex>& rGuard, css::uno::Any& rRowContent)
+ { return impl_getCurrentContent(rGuard, rRowContent, m_xContentAccessOrigin); });
}
diff --git a/ucb/source/cacher/cachedcontentresultsetstub.hxx b/ucb/source/cacher/cachedcontentresultsetstub.hxx
index 592a8d8afc06..23c66f828c53 100644
--- a/ucb/source/cacher/cachedcontentresultsetstub.hxx
+++ b/ucb/source/cacher/cachedcontentresultsetstub.hxx
@@ -50,36 +50,42 @@ private:
/// @throws css::uno::RuntimeException
void
impl_getCurrentRowContent(
+ std::unique_lock<std::mutex>& rGuard,
css::uno::Any& rRowContent,
const css::uno::Reference< css::sdbc::XRow >& xRow );
sal_Int32
- impl_getColumnCount();
+ impl_getColumnCount(std::unique_lock<std::mutex>&);
/// @throws css::uno::RuntimeException
static void
impl_getCurrentContentIdentifierString(
+ std::unique_lock<std::mutex>& rGuard,
css::uno::Any& rAny
, const css::uno::Reference< css::ucb::XContentAccess >& xContentAccess );
/// @throws css::uno::RuntimeException
static void
impl_getCurrentContentIdentifier(
+ std::unique_lock<std::mutex>& rGuard,
css::uno::Any& rAny
, const css::uno::Reference< css::ucb::XContentAccess >& xContentAccess );
/// @throws css::uno::RuntimeException
static void
impl_getCurrentContent(
+ std::unique_lock<std::mutex>& rGuard,
css::uno::Any& rAny
, const css::uno::Reference< css::ucb::XContentAccess >& xContentAccess );
/// @throws css::uno::RuntimeException
void
- impl_propagateFetchSizeAndDirection( sal_Int32 nFetchSize, bool bFetchDirection );
+ impl_propagateFetchSizeAndDirection( std::unique_lock<std::mutex>& rGuard, sal_Int32 nFetchSize, bool bFetchDirection );
- css::ucb::FetchResult impl_fetchHelper(sal_Int32 nRowStartPosition, sal_Int32 nRowCount, bool bDirection,
- std::function<void(css::uno::Any& rRowContent)> impl_loadRow);
+ css::ucb::FetchResult impl_fetchHelper(
+ std::unique_lock<std::mutex>& rGuard,
+ sal_Int32 nRowStartPosition, sal_Int32 nRowCount, bool bDirection,
+ std::function<void(std::unique_lock<std::mutex>&, css::uno::Any& rRowContent)> impl_loadRow);
public:
CachedContentResultSetStub( css::uno::Reference< css::sdbc::XResultSet > const & xOrigin );
diff --git a/ucb/source/cacher/contentresultsetwrapper.cxx b/ucb/source/cacher/contentresultsetwrapper.cxx
index 0106b3a37551..e5917f3fdbc5 100644
--- a/ucb/source/cacher/contentresultsetwrapper.cxx
+++ b/ucb/source/cacher/contentresultsetwrapper.cxx
@@ -51,56 +51,37 @@ ContentResultSetWrapper::ContentResultSetWrapper(
};
-void ContentResultSetWrapper::impl_init_xRowOrigin()
+void ContentResultSetWrapper::impl_init_xRowOrigin(std::unique_lock<std::mutex>&)
{
- {
- osl::Guard< osl::Mutex > aGuard( m_aMutex );
- if(m_xRowOrigin.is())
- return;
- }
+ if(m_xRowOrigin.is())
+ return;
Reference< XRow > xOrgig( m_xResultSetOrigin, UNO_QUERY );
-
- {
- osl::Guard< osl::Mutex > aGuard( m_aMutex );
- m_xRowOrigin = xOrgig;
- OSL_ENSURE( m_xRowOrigin.is(), "interface XRow is required" );
- }
+ m_xRowOrigin = xOrgig;
+ OSL_ENSURE( m_xRowOrigin.is(), "interface XRow is required" );
}
-void ContentResultSetWrapper::impl_init_xContentAccessOrigin()
+void ContentResultSetWrapper::impl_init_xContentAccessOrigin(std::unique_lock<std::mutex>&)
{
- {
- osl::Guard< osl::Mutex > aGuard( m_aMutex );
- if(m_xContentAccessOrigin.is())
- return;
- }
+ if(m_xContentAccessOrigin.is())
+ return;
Reference< XContentAccess > xOrgig( m_xResultSetOrigin, UNO_QUERY );
- {
- osl::Guard< osl::Mutex > aGuard( m_aMutex );
- m_xContentAccessOrigin = xOrgig;
- OSL_ENSURE( m_xContentAccessOrigin.is(), "interface XContentAccess is required" );
- }
+ m_xContentAccessOrigin = xOrgig;
+ OSL_ENSURE( m_xContentAccessOrigin.is(), "interface XContentAccess is required" );
}
-void ContentResultSetWrapper::impl_init_xPropertySetOrigin()
+void ContentResultSetWrapper::impl_init_xPropertySetOrigin(std::unique_lock<std::mutex>&)
{
- {
- osl::Guard< osl::Mutex > aGuard( m_aMutex );
- if( m_xPropertySetOrigin.is() )
- return;
- }
+ if( m_xPropertySetOrigin.is() )
+ return;
Reference< XPropertySet > xOrig( m_xResultSetOrigin, UNO_QUERY );
- {
- osl::Guard< osl::Mutex > aGuard( m_aMutex );
- m_xPropertySetOrigin = xOrig;
- OSL_ENSURE( m_xPropertySetOrigin.is(), "interface XPropertySet is required" );
- }
+ m_xPropertySetOrigin = xOrig;
+ OSL_ENSURE( m_xPropertySetOrigin.is(), "interface XPropertySet is required" );
}
void ContentResultSetWrapper::impl_init()
@@ -127,106 +108,90 @@ void ContentResultSetWrapper::impl_deinit()
}
//virtual
-void ContentResultSetWrapper::impl_initPropertySetInfo()
+void ContentResultSetWrapper::impl_initPropertySetInfo(std::unique_lock<std::mutex>& rGuard)
{
- {
- osl::Guard< osl::Mutex > aGuard( m_aMutex );
- if( m_xPropertySetInfo.is() )
- return;
+ if( m_xPropertySetInfo.is() )
+ return;
- impl_init_xPropertySetOrigin();
- if( !m_xPropertySetOrigin.is() )
- return;
- }
+ impl_init_xPropertySetOrigin(rGuard);
+ if( !m_xPropertySetOrigin.is() )
+ return;
Reference< XPropertySetInfo > xOrig =
m_xPropertySetOrigin->getPropertySetInfo();
- {
- osl::Guard< osl::Mutex > aGuard( m_aMutex );
- m_xPropertySetInfo = xOrig;
- }
+ m_xPropertySetInfo = xOrig;
}
-void ContentResultSetWrapper::impl_EnsureNotDisposed()
+void ContentResultSetWrapper::impl_EnsureNotDisposed(std::unique_lock<std::mutex>& /*rGuard*/)
{
- osl::Guard< osl::Mutex > aGuard( m_aMutex );
if( m_bDisposed )
throw DisposedException();
}
-void ContentResultSetWrapper::impl_getPropertyChangeListenerContainer()
+void ContentResultSetWrapper::impl_getPropertyChangeListenerContainer(std::unique_lock<std::mutex>& /*rGuard*/)
{
- osl::Guard< osl::Mutex > aGuard( m_aMutex );
if ( !m_pPropertyChangeListeners )
m_pPropertyChangeListeners.reset(
- new PropertyChangeListenerContainer_Impl( m_aContainerMutex ) );
+ new PropertyChangeListenerContainer_Impl() );
}
-void ContentResultSetWrapper::impl_getVetoableChangeListenerContainer()
+void ContentResultSetWrapper::impl_getVetoableChangeListenerContainer(std::unique_lock<std::mutex>& /*rGuard*/)
{
- osl::Guard< osl::Mutex > aGuard( m_aMutex );
if ( !m_pVetoableChangeListeners )
m_pVetoableChangeListeners.reset(
- new VetoableChangeListenerContainer_Impl( m_aContainerMutex ) );
+ new VetoableChangeListenerContainer_Impl() );
}
-void ContentResultSetWrapper::impl_notifyPropertyChangeListeners( const PropertyChangeEvent& rEvt )
+void ContentResultSetWrapper::impl_notifyPropertyChangeListeners( std::unique_lock<std::mutex>& rGuard, const PropertyChangeEvent& rEvt )
{
- {
- osl::Guard< osl::Mutex > aGuard( m_aMutex );
- if( !m_pPropertyChangeListeners )
- return;
- }
+ if( !m_pPropertyChangeListeners )
+ return;
// Notify listeners interested especially in the changed property.
- OInterfaceContainerHelper3<XPropertyChangeListener>* pContainer =
- m_pPropertyChangeListeners->getContainer( rEvt.PropertyName );
+ OInterfaceContainerHelper4<XPropertyChangeListener>* pContainer =
+ m_pPropertyChangeListeners->getContainer( rGuard, rEvt.PropertyName );
if( pContainer )
{
- pContainer->notifyEach( &XPropertyChangeListener::propertyChange, rEvt );
+ pContainer->notifyEach( rGuard, &XPropertyChangeListener::propertyChange, rEvt );
}
// Notify listeners interested in all properties.
- pContainer = m_pPropertyChangeListeners->getContainer( OUString() );
+ pContainer = m_pPropertyChangeListeners->getContainer( rGuard, OUString() );
if( pContainer )
{
- pContainer->notifyEach( &XPropertyChangeListener::propertyChange, rEvt );
+ pContainer->notifyEach( rGuard, &XPropertyChangeListener::propertyChange, rEvt );
}
}
-void ContentResultSetWrapper::impl_notifyVetoableChangeListeners( const PropertyChangeEvent& rEvt )
+void ContentResultSetWrapper::impl_notifyVetoableChangeListeners( std::unique_lock<std::mutex>& rGuard, const PropertyChangeEvent& rEvt )
{
- {
- osl::Guard< osl::Mutex > aGuard( m_aMutex );
- if( !m_pVetoableChangeListeners )
- return;
- }
+ if( !m_pVetoableChangeListeners )
+ return;
// Notify listeners interested especially in the changed property.
- OInterfaceContainerHelper3<XVetoableChangeListener>* pContainer =
- m_pVetoableChangeListeners->getContainer( rEvt.PropertyName );
+ OInterfaceContainerHelper4<XVetoableChangeListener>* pContainer =
+ m_pVetoableChangeListeners->getContainer( rGuard, rEvt.PropertyName );
if( pContainer )
{
- pContainer->notifyEach( &XVetoableChangeListener::vetoableChange, rEvt );
+ pContainer->notifyEach( rGuard, &XVetoableChangeListener::vetoableChange, rEvt );
}
// Notify listeners interested in all properties.
- pContainer = m_pVetoableChangeListeners->getContainer( OUString() );
+ pContainer = m_pVetoableChangeListeners->getContainer( rGuard, OUString() );
if( pContainer )
{
- pContainer->notifyEach( &XVetoableChangeListener::vetoableChange, rEvt );
+ pContainer->notifyEach( rGuard, &XVetoableChangeListener::vetoableChange, rEvt );
}
}
-bool ContentResultSetWrapper::impl_isForwardOnly()
+bool ContentResultSetWrapper::impl_isForwardOnly(std::unique_lock<std::mutex>& /*rGuard*/)
{
//m_nForwardOnly == 2 -> don't know
//m_nForwardOnly == 1 -> YES
//m_nForwardOnly == 0 -> NO
//@todo replace this with lines in comment
- osl::Guard< osl::Mutex > aGuard( m_aMutex );
m_nForwardOnly = 0;
return false;
@@ -293,17 +258,17 @@ css::uno::Any SAL_CALL ContentResultSetWrapper::queryInterface( const css::uno::
// virtual
void SAL_CALL ContentResultSetWrapper::dispose()
{
- impl_EnsureNotDisposed();
+ std::unique_lock aGuard(m_aMutex);
+ impl_EnsureNotDisposed(aGuard);
bool isCleared = false;
- osl::ResettableMutexGuard aGuard(m_aMutex);
if( m_bInDispose || m_bDisposed )
return;
m_bInDispose = true;
if( m_xPropertySetOrigin.is() )
{
- aGuard.clear();
+ aGuard.unlock();
isCleared = true;
try
{
@@ -331,53 +296,30 @@ void SAL_CALL ContentResultSetWrapper::dispose()
if (isCleared)
{
- aGuard.reset();
+ aGuard.lock();
isCleared = false;
}
- if( m_pDisposeEventListeners && m_pDisposeEventListeners->getLength() )
+ if( m_pDisposeEventListeners && m_pDisposeEventListeners->getLength(aGuard) )
{
EventObject aEvt;
aEvt.Source = static_cast< XComponent * >( this );
-
- aGuard.clear();
- isCleared = true;
- m_pDisposeEventListeners->disposeAndClear( aEvt );
+ m_pDisposeEventListeners->disposeAndClear( aGuard, aEvt );
}
- if (isCleared)
- {
- aGuard.reset();
- isCleared = false;
- }
if( m_pPropertyChangeListeners )
{
EventObject aEvt;
aEvt.Source = static_cast< XPropertySet * >( this );
-
- aGuard.clear();
- isCleared = true;
- m_pPropertyChangeListeners->disposeAndClear( aEvt );
+ m_pPropertyChangeListeners->disposeAndClear( aGuard, aEvt );
}
- if (isCleared)
- {
- aGuard.reset();
- isCleared = false;
- }
if( m_pVetoableChangeListeners )
{
EventObject aEvt;
aEvt.Source = static_cast< XPropertySet * >( this );
-
- aGuard.clear();
- isCleared = true;
- m_pVetoableChangeListeners->disposeAndClear( aEvt );
+ m_pVetoableChangeListeners->disposeAndClear( aGuard, aEvt );
}
- if (isCleared)
- {
- aGuard.reset();
- }
m_bDisposed = true;
m_bInDispose = false;
}
@@ -386,25 +328,25 @@ void SAL_CALL ContentResultSetWrapper::dispose()
// virtual
void SAL_CALL ContentResultSetWrapper::addEventListener( const Reference< XEventListener >& Listener )
{
- impl_EnsureNotDisposed();
- osl::Guard< osl::Mutex > aGuard( m_aMutex );
+ std::unique_lock aGuard( m_aMutex );
+ impl_EnsureNotDisposed(aGuard);
if ( !m_pDisposeEventListeners )
m_pDisposeEventListeners.reset(
- new OInterfaceContainerHelper3<XEventListener>( m_aContainerMutex ) );
+ new OInterfaceContainerHelper4<XEventListener>() );
- m_pDisposeEventListeners->addInterface( Listener );
+ m_pDisposeEventListeners->addInterface( aGuard, Listener );
}
// virtual
void SAL_CALL ContentResultSetWrapper::removeEventListener( const Reference< XEventListener >& Listener )
{
- impl_EnsureNotDisposed();
- osl::Guard< osl::Mutex > aGuard( m_aMutex );
+ std::unique_lock aGuard( m_aMutex );
+ impl_EnsureNotDisposed(aGuard);
if ( m_pDisposeEventListeners )
- m_pDisposeEventListeners->removeInterface( Listener );
+ m_pDisposeEventListeners->removeInterface( aGuard, Listener );
}
@@ -413,7 +355,10 @@ void SAL_CALL ContentResultSetWrapper::removeEventListener( const Reference< XEv
//virtual
void SAL_CALL ContentResultSetWrapper::close()
{
- impl_EnsureNotDisposed();
+ {
+ std::unique_lock aGuard( m_aMutex );
+ impl_EnsureNotDisposed(aGuard);
+ }
dispose();
}
@@ -423,9 +368,9 @@ void SAL_CALL ContentResultSetWrapper::close()
//virtual
Reference< XResultSetMetaData > SAL_CALL ContentResultSetWrapper::getMetaData()
{
- impl_EnsureNotDisposed();
+ std::unique_lock aGuard(m_aMutex);
+ impl_EnsureNotDisposed(aGuard);
- osl::ResettableMutexGuard aGuard(m_aMutex);
if( !m_xMetaDataFromOrigin.is() && m_xResultSetOrigin.is() )
{
Reference< XResultSetMetaDataSupplier > xMetaDataSupplier(
@@ -433,12 +378,12 @@ Reference< XResultSetMetaData > SAL_CALL ContentResultSetWrapper::getMetaData()
if( xMetaDataSupplier.is() )
{
- aGuard.clear();
+ aGuard.unlock();
Reference< XResultSetMetaData > xMetaData
= xMetaDataSupplier->getMetaData();
- aGuard.reset();
+ aGuard.lock();
m_xMetaDataFromOrigin = xMetaData;
}
}
@@ -451,21 +396,32 @@ Reference< XResultSetMetaData > SAL_CALL ContentResultSetWrapper::getMetaData()
// virtual
Reference< XPropertySetInfo > SAL_CALL ContentResultSetWrapper::getPropertySetInfo()
{
- impl_EnsureNotDisposed();
- {
- osl::Guard< osl::Mutex > aGuard( m_aMutex );
- if( m_xPropertySetInfo.is() )
- return m_xPropertySetInfo;
- }
- impl_initPropertySetInfo();
+ std::unique_lock aGuard( m_aMutex );
+ return getPropertySetInfoImpl(aGuard);
+}
+
+// virtual
+Reference< XPropertySetInfo > ContentResultSetWrapper::getPropertySetInfoImpl(std::unique_lock<std::mutex>& rGuard)
+{
+ impl_EnsureNotDisposed(rGuard);
+ if( m_xPropertySetInfo.is() )
+ return m_xPropertySetInfo;
+ impl_initPropertySetInfo(rGuard);
return m_xPropertySetInfo;
}
// virtual
void SAL_CALL ContentResultSetWrapper::setPropertyValue( const OUString& rPropertyName, const Any& rValue )
{
- impl_EnsureNotDisposed();
- impl_init_xPropertySetOrigin();
+ std::unique_lock aGuard( m_aMutex );
+ return setPropertyValueImpl(aGuard, rPropertyName, rValue);
+}
+
+// virtual
+void ContentResultSetWrapper::setPropertyValueImpl( std::unique_lock<std::mutex>& rGuard, const OUString& rPropertyName, const Any& rValue )
+{
+ impl_EnsureNotDisposed(rGuard);
+ impl_init_xPropertySetOrigin(rGuard);
if( !m_xPropertySetOrigin.is() )
{
OSL_FAIL( "broadcaster was disposed already" );
@@ -478,8 +434,9 @@ void SAL_CALL ContentResultSetWrapper::setPropertyValue( const OUString& rProper
// virtual
Any SAL_CALL ContentResultSetWrapper::getPropertyValue( const OUString& rPropertyName )
{
- impl_EnsureNotDisposed();
- impl_init_xPropertySetOrigin();
+ std::unique_lock aGuard( m_aMutex );
+ impl_EnsureNotDisposed(aGuard);
+ impl_init_xPropertySetOrigin(aGuard);
if( !m_xPropertySetOrigin.is() )
{
OSL_FAIL( "broadcaster was disposed already" );
@@ -492,7 +449,8 @@ Any SAL_CALL ContentResultSetWrapper::getPropertyValue( const OUString& rPropert
// virtual
void SAL_CALL ContentResultSetWrapper::addPropertyChangeListener( const OUString& aPropertyName, const Reference< XPropertyChangeListener >& xListener )
{
- impl_EnsureNotDisposed();
+ std::unique_lock aGuard( m_aMutex );
+ impl_EnsureNotDisposed(aGuard);
if( !getPropertySetInfo().is() )
{
@@ -506,20 +464,17 @@ void SAL_CALL ContentResultSetWrapper::addPropertyChangeListener( const OUString
//throws UnknownPropertyException, if so
}
- impl_getPropertyChangeListenerContainer();
- bool bNeedRegister = !m_pPropertyChangeListeners->hasContainedTypes();
- m_pPropertyChangeListeners->addInterface( aPropertyName, xListener );
+ impl_getPropertyChangeListenerContainer(aGuard);
+ bool bNeedRegister = !m_pPropertyChangeListeners->hasContainedTypes(aGuard);
+ m_pPropertyChangeListeners->addInterface( aGuard, aPropertyName, xListener );
if( !bNeedRegister )
return;
- impl_init_xPropertySetOrigin();
+ impl_init_xPropertySetOrigin(aGuard);
+ if( !m_xPropertySetOrigin.is() )
{
- osl::Guard< osl::Mutex > aGuard( m_aMutex );
- if( !m_xPropertySetOrigin.is() )
- {
- OSL_FAIL( "broadcaster was disposed already" );
- return;
- }
+ OSL_FAIL( "broadcaster was disposed already" );
+ return;
}
try
{
@@ -528,7 +483,7 @@ void SAL_CALL ContentResultSetWrapper::addPropertyChangeListener( const OUString
}
catch( Exception& )
{
- m_pPropertyChangeListeners->removeInterface( aPropertyName, xListener );
+ m_pPropertyChangeListeners->removeInterface( aGuard, aPropertyName, xListener );
throw;
}
}
@@ -537,7 +492,8 @@ void SAL_CALL ContentResultSetWrapper::addPropertyChangeListener( const OUString
// virtual
void SAL_CALL ContentResultSetWrapper::addVetoableChangeListener( const OUString& rPropertyName, const Reference< XVetoableChangeListener >& xListener )
{
- impl_EnsureNotDisposed();
+ std::unique_lock aGuard( m_aMutex );
+ impl_EnsureNotDisposed(aGuard);
if( !getPropertySetInfo().is() )
{
@@ -550,15 +506,14 @@ void SAL_CALL ContentResultSetWrapper::addVetoableChangeListener( const OUString
//throws UnknownPropertyException, if so
}
- impl_getVetoableChangeListenerContainer();
- bool bNeedRegister = !m_pVetoableChangeListeners->hasContainedTypes();
- m_pVetoableChangeListeners->addInterface( rPropertyName, xListener );
+ impl_getVetoableChangeListenerContainer(aGuard);
+ bool bNeedRegister = !m_pVetoableChangeListeners->hasContainedTypes(aGuard);
+ m_pVetoableChangeListeners->addInterface( aGuard, rPropertyName, xListener );
if( !bNeedRegister )
return;
- impl_init_xPropertySetOrigin();
+ impl_init_xPropertySetOrigin(aGuard);
{
- osl::Guard< osl::Mutex > aGuard( m_aMutex );
if( !m_xPropertySetOrigin.is() )
{
OSL_FAIL( "broadcaster was disposed already" );
@@ -572,7 +527,7 @@ void SAL_CALL ContentResultSetWrapper::addVetoableChangeListener( const OUString
}
catch( Exception& )
{
- m_pVetoableChangeListeners->removeInterface( rPropertyName, xListener );
+ m_pVetoableChangeListeners->removeInterface( aGuard, rPropertyName, xListener );
throw;
}
}
@@ -581,16 +536,15 @@ void SAL_CALL ContentResultSetWrapper::addVetoableChangeListener( const OUString
// virtual
void SAL_CALL ContentResultSetWrapper::removePropertyChangeListener( const OUString& rPropertyName, const Reference< XPropertyChangeListener >& xListener )
{
- impl_EnsureNotDisposed();
+ std::unique_lock aGuard( m_aMutex );
+ impl_EnsureNotDisposed(aGuard);
- {
- //noop, if no listener registered
- osl::Guard< osl::Mutex > aGuard( m_aMutex );
- if( !m_pPropertyChangeListeners )
- return;
- }
- OInterfaceContainerHelper3<XPropertyChangeListener>* pContainer =
- m_pPropertyChangeListeners->getContainer( rPropertyName );
+ //noop, if no listener registered
+ if( !m_pPropertyChangeListeners )
+ return;
+
+ OInterfaceContainerHelper4<XPropertyChangeListener>* pContainer =
+ m_pPropertyChangeListeners->getContainer( aGuard, rPropertyName );
if( !pContainer )
{
@@ -605,19 +559,16 @@ void SAL_CALL ContentResultSetWrapper::removePropertyChangeListener( const OUStr
return; //the listener was not registered
}
- m_pPropertyChangeListeners->removeInterface( rPropertyName, xListener );
+ m_pPropertyChangeListeners->removeInterface( aGuard, rPropertyName, xListener );
- if( m_pPropertyChangeListeners->hasContainedTypes() )
+ if( m_pPropertyChangeListeners->hasContainedTypes(aGuard) )
return;
- impl_init_xPropertySetOrigin();
+ impl_init_xPropertySetOrigin(aGuard);
+ if( !m_xPropertySetOrigin.is() )
{
- osl::Guard< osl::Mutex > aGuard( m_aMutex );
- if( !m_xPropertySetOrigin.is() )
- {
- OSL_FAIL( "broadcaster was disposed already" );
- return;
- }
+ OSL_FAIL( "broadcaster was disposed already" );
+ return;
}
try
{
@@ -634,16 +585,14 @@ void SAL_CALL ContentResultSetWrapper::removePropertyChangeListener( const OUStr
// virtual
void SAL_CALL ContentResultSetWrapper::removeVetoableChangeListener( const OUString& rPropertyName, const Reference< XVetoableChangeListener >& xListener )
{
- impl_EnsureNotDisposed();
+ std::unique_lock aGuard( m_aMutex );
+ impl_EnsureNotDisposed(aGuard);
- {
- //noop, if no listener registered
- osl::Guard< osl::Mutex > aGuard( m_aMutex );
- if( !m_pVetoableChangeListeners )
- return;
- }
- OInterfaceContainerHelper3<XVetoableChangeListener>* pContainer =
- m_pVetoableChangeListeners->getContainer( rPropertyName );
+ //noop, if no listener registered
+ if( !m_pVetoableChangeListeners )
+ return;
+ OInterfaceContainerHelper4<XVetoableChangeListener>* pContainer =
+ m_pVetoableChangeListeners->getContainer( aGuard, rPropertyName );
if( !pContainer )
{
@@ -658,19 +607,16 @@ void SAL_CALL ContentResultSetWrapper::removeVetoableChangeListener( const OUStr
return; //the listener was not registered
}
- m_pVetoableChangeListeners->removeInterface( rPropertyName, xListener );
+ m_pVetoableChangeListeners->removeInterface( aGuard, rPropertyName, xListener );
- if( m_pVetoableChangeListeners->hasContainedTypes() )
+ if( m_pVetoableChangeListeners->hasContainedTypes(aGuard) )
return;
- impl_init_xPropertySetOrigin();
+ impl_init_xPropertySetOrigin(aGuard);
+ if( !m_xPropertySetOrigin.is() )
{
- osl::Guard< osl::Mutex > aGuard( m_aMutex );
- if( !m_xPropertySetOrigin.is() )
- {
- OSL_FAIL( "broadcaster was disposed already" );
- return;
- }
+ OSL_FAIL( "broadcaster was disposed already" );
+ return;
}
try
{
@@ -687,12 +633,12 @@ void SAL_CALL ContentResultSetWrapper::removeVetoableChangeListener( const OUStr
// own methods.
-//virtual
+//virtual, only called from ContentResultSetWrapperListener
void ContentResultSetWrapper::impl_disposing( const EventObject& )
{
- impl_EnsureNotDisposed();
+ std::unique_lock aGuard(m_aMutex);
- osl::Guard< osl::Mutex > aGuard( m_aMutex );
+ impl_EnsureNotDisposed(aGuard);
if( !m_xResultSetOrigin.is() )
return;
@@ -710,27 +656,30 @@ void ContentResultSetWrapper::impl_disposing( const EventObject& )
m_xPropertySetInfo.clear();
}
-//virtual
+//virtual, only called from ContentResultSetWrapperListener
void ContentResultSetWrapper::impl_propertyChange( const PropertyChangeEvent& rEvt )
{
- impl_EnsureNotDisposed();
+ std::unique_lock aGuard(m_aMutex);
+
+ impl_EnsureNotDisposed(aGuard);
PropertyChangeEvent aEvt( rEvt );
aEvt.Source = static_cast< XPropertySet * >( this );
aEvt.Further = false;
- impl_notifyPropertyChangeListeners( aEvt );
+ impl_notifyPropertyChangeListeners( aGuard, aEvt );
}
-//virtual
+//virtual, only called from ContentResultSetWrapperListener
void ContentResultSetWrapper::impl_vetoableChange( const PropertyChangeEvent& rEvt )
{
- impl_EnsureNotDisposed();
+ std::unique_lock aGuard(m_aMutex);
+ impl_EnsureNotDisposed(aGuard);
PropertyChangeEvent aEvt( rEvt );
aEvt.Source = static_cast< XPropertySet * >( this );
aEvt.Further = false;
- impl_notifyVetoableChangeListeners( aEvt );
+ impl_notifyVetoableChangeListeners( aGuard, aEvt );
}
@@ -740,8 +689,14 @@ void ContentResultSetWrapper::impl_vetoableChange( const PropertyChangeEvent& rE
// virtual
OUString SAL_CALL ContentResultSetWrapper::queryContentIdentifierString()
{
- impl_EnsureNotDisposed();
- impl_init_xContentAccessOrigin();
+ std::unique_lock aGuard(m_aMutex);
+ return queryContentIdentifierStringImpl(aGuard);
+}
+// virtual
+OUString ContentResultSetWrapper::queryContentIdentifierStringImpl(std::unique_lock<std::mutex>& rGuard)
+{
+ impl_EnsureNotDisposed(rGuard);
+ impl_init_xContentAccessOrigin(rGuard);
if( !m_xContentAccessOrigin.is() )
{
OSL_FAIL( "broadcaster was disposed already" );
@@ -754,8 +709,9 @@ OUString SAL_CALL ContentResultSetWrapper::queryContentIdentifierString()
// virtual
Reference< XContentIdentifier > SAL_CALL ContentResultSetWrapper::queryContentIdentifier()
{
- impl_EnsureNotDisposed();
- impl_init_xContentAccessOrigin();
+ std::unique_lock aGuard(m_aMutex);
+ impl_EnsureNotDisposed(aGuard);
+ impl_init_xContentAccessOrigin(aGuard);
if( !m_xContentAccessOrigin.is() )
{
OSL_FAIL( "broadcaster was disposed already" );
@@ -768,8 +724,9 @@ Reference< XContentIdentifier > SAL_CALL ContentResultSetWrapper::queryContentId
// virtual
Reference< XContent > SAL_CALL ContentResultSetWrapper::queryContent()
{
- impl_EnsureNotDisposed();
- impl_init_xContentAccessOrigin();
+ std::unique_lock aGuard(m_aMutex);
+ impl_EnsureNotDisposed(aGuard);
+ impl_init_xContentAccessOrigin(aGuard);
if( !m_xContentAccessOrigin.is() )
{
OSL_FAIL( "broadcaster was disposed already" );
@@ -785,7 +742,8 @@ Reference< XContent > SAL_CALL ContentResultSetWrapper::queryContent()
sal_Bool SAL_CALL ContentResultSetWrapper::next()
{
- impl_EnsureNotDisposed();
+ std::unique_lock aGuard(m_aMutex);
+ impl_EnsureNotDisposed(aGuard);
if( !m_xResultSetOrigin.is() )
{
@@ -798,7 +756,8 @@ sal_Bool SAL_CALL ContentResultSetWrapper::next()
//virtual
sal_Bool SAL_CALL ContentResultSetWrapper::previous()
{
- impl_EnsureNotDisposed();
+ std::unique_lock aGuard(m_aMutex);
+ impl_EnsureNotDisposed(aGuard);
if( !m_xResultSetOrigin.is() )
{
@@ -811,7 +770,8 @@ sal_Bool SAL_CALL ContentResultSetWrapper::previous()
//virtual
sal_Bool SAL_CALL ContentResultSetWrapper::absolute( sal_Int32 row )
{
- impl_EnsureNotDisposed();
+ std::unique_lock aGuard(m_aMutex);
+ impl_EnsureNotDisposed(aGuard);
if( !m_xResultSetOrigin.is() )
{
@@ -824,7 +784,8 @@ sal_Bool SAL_CALL ContentResultSetWrapper::absolute( sal_Int32 row )
//virtual
sal_Bool SAL_CALL ContentResultSetWrapper::relative( sal_Int32 rows )
{
- impl_EnsureNotDisposed();
+ std::unique_lock aGuard(m_aMutex);
+ impl_EnsureNotDisposed(aGuard);
if( !m_xResultSetOrigin.is() )
{
@@ -838,7 +799,8 @@ sal_Bool SAL_CALL ContentResultSetWrapper::relative( sal_Int32 rows )
//virtual
sal_Bool SAL_CALL ContentResultSetWrapper::first()
{
- impl_EnsureNotDisposed();
+ std::unique_lock aGuard(m_aMutex);
+ impl_EnsureNotDisposed(aGuard);
if( !m_xResultSetOrigin.is() )
{
@@ -851,7 +813,8 @@ sal_Bool SAL_CALL ContentResultSetWrapper::first()
//virtual
sal_Bool SAL_CALL ContentResultSetWrapper::last()
{
- impl_EnsureNotDisposed();
+ std::unique_lock aGuard(m_aMutex);
+ impl_EnsureNotDisposed(aGuard);
if( !m_xResultSetOrigin.is() )
{
@@ -864,7 +827,8 @@ sal_Bool SAL_CALL ContentResultSetWrapper::last()
//virtual
void SAL_CALL ContentResultSetWrapper::beforeFirst()
{
- impl_EnsureNotDisposed();
+ std::unique_lock aGuard(m_aMutex);
+ impl_EnsureNotDisposed(aGuard);
if( !m_xResultSetOrigin.is() )
{
@@ -877,7 +841,8 @@ void SAL_CALL ContentResultSetWrapper::beforeFirst()
//virtual
void SAL_CALL ContentResultSetWrapper::afterLast()
{
- impl_EnsureNotDisposed();
+ std::unique_lock aGuard(m_aMutex);
+ impl_EnsureNotDisposed(aGuard);
if( !m_xResultSetOrigin.is() )
{
@@ -890,7 +855,8 @@ void SAL_CALL ContentResultSetWrapper::afterLast()
//virtual
sal_Bool SAL_CALL ContentResultSetWrapper::isAfterLast()
{
- impl_EnsureNotDisposed();
+ std::unique_lock aGuard(m_aMutex);
+ impl_EnsureNotDisposed(aGuard);
if( !m_xResultSetOrigin.is() )
{
@@ -903,7 +869,8 @@ sal_Bool SAL_CALL ContentResultSetWrapper::isAfterLast()
//virtual
sal_Bool SAL_CALL ContentResultSetWrapper::isBeforeFirst()
{
- impl_EnsureNotDisposed();
+ std::unique_lock aGuard(m_aMutex);
+ impl_EnsureNotDisposed(aGuard);
if( !m_xResultSetOrigin.is() )
{
@@ -916,7 +883,8 @@ sal_Bool SAL_CALL ContentResultSetWrapper::isBeforeFirst()
//virtual
sal_Bool SAL_CALL ContentResultSetWrapper::isFirst()
{
- impl_EnsureNotDisposed();
+ std::unique_lock aGuard(m_aMutex);
+ impl_EnsureNotDisposed(aGuard);
if( !m_xResultSetOrigin.is() )
{
@@ -929,7 +897,8 @@ sal_Bool SAL_CALL ContentResultSetWrapper::isFirst()
//virtual
sal_Bool SAL_CALL ContentResultSetWrapper::isLast()
{
- impl_EnsureNotDisposed();
+ std::unique_lock aGuard(m_aMutex);
+ impl_EnsureNotDisposed(aGuard);
if( !m_xResultSetOrigin.is() )
{
@@ -943,7 +912,8 @@ sal_Bool SAL_CALL ContentResultSetWrapper::isLast()
//virtual
sal_Int32 SAL_CALL ContentResultSetWrapper::getRow()
{
- impl_EnsureNotDisposed();
+ std::unique_lock aGuard(m_aMutex);
+ impl_EnsureNotDisposed(aGuard);
if( !m_xResultSetOrigin.is() )
{
@@ -956,7 +926,8 @@ sal_Int32 SAL_CALL ContentResultSetWrapper::getRow()
//virtual
void SAL_CALL ContentResultSetWrapper::refreshRow()
{
- impl_EnsureNotDisposed();
+ std::unique_lock aGuard(m_aMutex);
+ impl_EnsureNotDisposed(aGuard);
if( !m_xResultSetOrigin.is() )
{
@@ -969,7 +940,8 @@ void SAL_CALL ContentResultSetWrapper::refreshRow()
//virtual
sal_Bool SAL_CALL ContentResultSetWrapper::rowUpdated()
{
- impl_EnsureNotDisposed();
+ std::unique_lock aGuard(m_aMutex);
+ impl_EnsureNotDisposed(aGuard);
if( !m_xResultSetOrigin.is() )
{
@@ -982,7 +954,8 @@ sal_Bool SAL_CALL ContentResultSetWrapper::rowUpdated()
//virtual
sal_Bool SAL_CALL ContentResultSetWrapper::rowInserted()
{
- impl_EnsureNotDisposed();
+ std::unique_lock aGuard(m_aMutex);
+ impl_EnsureNotDisposed(aGuard);
if( !m_xResultSetOrigin.is() )
{
@@ -995,7 +968,8 @@ sal_Bool SAL_CALL ContentResultSetWrapper::rowInserted()
//virtual
sal_Bool SAL_CALL ContentResultSetWrapper::rowDeleted()
{
- impl_EnsureNotDisposed();
+ std::unique_lock aGuard(m_aMutex);
+ impl_EnsureNotDisposed(aGuard);
if( !m_xResultSetOrigin.is() )
{
@@ -1008,7 +982,8 @@ sal_Bool SAL_CALL ContentResultSetWrapper::rowDeleted()
//virtual
Reference< XInterface > SAL_CALL ContentResultSetWrapper::getStatement()
{
- impl_EnsureNotDisposed();
+ std::unique_lock aGuard(m_aMutex);
+ impl_EnsureNotDisposed(aGuard);
//@todo ?return anything
return Reference< XInterface >();
}
@@ -1019,8 +994,9 @@ Reference< XInterface > SAL_CALL ContentResultSetWrapper::getStatement()
void ContentResultSetWrapper::verifyGet()
{
- impl_EnsureNotDisposed();
- impl_init_xRowOrigin();
+ std::unique_lock aGuard(m_aMutex);
+ impl_EnsureNotDisposed(aGuard);
+ impl_init_xRowOrigin(aGuard);
if( !m_xRowOrigin.is() )
{
OSL_FAIL( "broadcaster was disposed already" );
@@ -1031,8 +1007,9 @@ void ContentResultSetWrapper::verifyGet()
//virtual
sal_Bool SAL_CALL ContentResultSetWrapper::wasNull()
{
- impl_EnsureNotDisposed();
- impl_init_xRowOrigin();
+ std::unique_lock aGuard(m_aMutex);
+ impl_EnsureNotDisposed(aGuard);
+ impl_init_xRowOrigin(aGuard);
if( !m_xRowOrigin.is() )
{
OSL_FAIL( "broadcaster was disposed already" );
@@ -1145,8 +1122,9 @@ Any SAL_CALL ContentResultSetWrapper::getObject( sal_Int32 columnIndex, const Re
//if you change this macro please pay attention to
//define XROW_GETXXX, where this is similar implemented
- impl_EnsureNotDisposed();
- impl_init_xRowOrigin();
+ std::unique_lock aGuard(m_aMutex);
+ impl_EnsureNotDisposed(aGuard);
+ impl_init_xRowOrigin(aGuard);
if( !m_xRowOrigin.is() )
{
OSL_FAIL( "broadcaster was disposed already" );
diff --git a/ucb/source/cacher/contentresultsetwrapper.hxx b/ucb/source/cacher/contentresultsetwrapper.hxx
index 235e3181a816..4c67ca89ef29 100644
--- a/ucb/source/cacher/contentresultsetwrapper.hxx
+++ b/ucb/source/cacher/contentresultsetwrapper.hxx
@@ -21,7 +21,6 @@
#include <rtl/ustring.hxx>
#include <rtl/ref.hxx>
-#include <osl/mutex.hxx>
#include <cppuhelper/weak.hxx>
#include <com/sun/star/lang/XComponent.hpp>
#include <com/sun/star/sdbc/XCloseable.hpp>
@@ -30,8 +29,8 @@
#include <com/sun/star/sdbc/XRow.hpp>
#include <com/sun/star/ucb/XContentAccess.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
-#include <comphelper/interfacecontainer3.hxx>
-#include <comphelper/multiinterfacecontainer3.hxx>
+#include <comphelper/interfacecontainer4.hxx>
+#include <comphelper/multiinterfacecontainer4.hxx>
#include <memory>
@@ -47,15 +46,15 @@ class ContentResultSetWrapper
, public css::sdbc::XRow
{
protected:
- typedef comphelper::OMultiTypeInterfaceContainerHelperVar3<css::beans::XPropertyChangeListener, OUString>
+ typedef comphelper::OMultiTypeInterfaceContainerHelperVar4<OUString, css::beans::XPropertyChangeListener>
PropertyChangeListenerContainer_Impl;
- typedef comphelper::OMultiTypeInterfaceContainerHelperVar3<css::beans::XVetoableChangeListener, OUString>
+ typedef comphelper::OMultiTypeInterfaceContainerHelperVar4<OUString, css::beans::XVetoableChangeListener>
VetoableChangeListenerContainer_Impl;
//members
//my Mutex
- osl::Mutex m_aMutex;
+ std::mutex m_aMutex;
//different Interfaces from Origin:
css::uno::Reference< css::sdbc::XResultSet >
@@ -86,8 +85,7 @@ private:
//management of listeners
bool m_bDisposed; ///Dispose call ready.
bool m_bInDispose;///In dispose call
- osl::Mutex m_aContainerMutex;
- std::unique_ptr<comphelper::OInterfaceContainerHelper3<css::lang::XEventListener>>
+ std::unique_ptr<comphelper::OInterfaceContainerHelper4<css::lang::XEventListener>>
m_pDisposeEventListeners;
std::unique_ptr<PropertyChangeListenerContainer_Impl>
m_pPropertyChangeListeners;
@@ -98,10 +96,10 @@ private:
//methods:
private:
void
- impl_getPropertyChangeListenerContainer();
+ impl_getPropertyChangeListenerContainer(std::unique_lock<std::mutex>& rGuard);
void
- impl_getVetoableChangeListenerContainer();
+ impl_getVetoableChangeListenerContainer(std::unique_lock<std::mutex>& rGuard);
void verifyGet();
@@ -117,30 +115,32 @@ protected:
//--
- void impl_init_xRowOrigin();
- void impl_init_xContentAccessOrigin();
- void impl_init_xPropertySetOrigin();
+ void impl_init_xRowOrigin(std::unique_lock<std::mutex>&);
+ void impl_init_xContentAccessOrigin(std::unique_lock<std::mutex>&);
+ void impl_init_xPropertySetOrigin(std::unique_lock<std::mutex>&);
//--
- virtual void impl_initPropertySetInfo(); //helping XPropertySet
+ virtual void impl_initPropertySetInfo(std::unique_lock<std::mutex>& rGuard); //helping XPropertySet
/// @throws css::lang::DisposedException
/// @throws css::uno::RuntimeException
void
- impl_EnsureNotDisposed();
+ impl_EnsureNotDisposed(std::unique_lock<std::mutex>& rGuard);
void
impl_notifyPropertyChangeListeners(
+ std::unique_lock<std::mutex>& rGuard,
const css::beans::PropertyChangeEvent& rEvt );
/// @throws css::beans::PropertyVetoException
/// @throws css::uno::RuntimeException
void
impl_notifyVetoableChangeListeners(
+ std::unique_lock<std::mutex>& rGuard,
const css::beans::PropertyChangeEvent& rEvt );
- bool impl_isForwardOnly();
+ bool impl_isForwardOnly(std::unique_lock<std::mutex>& rGuard);
public:
@@ -154,7 +154,7 @@ public:
// XComponent
virtual void SAL_CALL
- dispose() override;
+ dispose() override final;
virtual void SAL_CALL
addEventListener( const css::uno::Reference< css::lang::XEventListener >& Listener ) override;
@@ -178,11 +178,16 @@ public:
// XPropertySet
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL
- getPropertySetInfo() override;
+ getPropertySetInfo() override final;
+ css::uno::Reference< css::beans::XPropertySetInfo >
+ getPropertySetInfoImpl(std::unique_lock<std::mutex>& rGuard);
virtual void SAL_CALL
setPropertyValue( const OUString& aPropertyName,
- const css::uno::Any& aValue ) override;
+ const css::uno::Any& aValue ) final override;
+ virtual void
+ setPropertyValueImpl( std::unique_lock<std::mutex>& rGuard, const OUString& aPropertyName,
+ const css::uno::Any& aValue );
virtual css::uno::Any SAL_CALL
getPropertyValue( const OUString& PropertyName ) override;
@@ -223,7 +228,9 @@ public:
// XContentAccess
virtual OUString SAL_CALL
- queryContentIdentifierString() override;
+ queryContentIdentifierString() override final;
+ virtual OUString
+ queryContentIdentifierStringImpl(std::unique_lock<std::mutex>& rGuard);
virtual css::uno::Reference< css::ucb::XContentIdentifier > SAL_CALL
queryContentIdentifier() override;