Kaydet (Commit) 508f7829 authored tarafından Giuseppe Castagno's avatar Giuseppe Castagno

tdf#101094 (21): Simplify cache removal: LOCK, UNLOCK

Change-Id: Ib963fc6e0834606dcb6f42b3c0df5a408ebc5351
Reviewed-on: https://gerrit.libreoffice.org/28030Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarGiuseppe Castagno <giuseppe.castagno@acca-esse.eu>
üst 1f2179bb
......@@ -3109,8 +3109,6 @@ void Content::lock(
aURL = m_xIdentifier->getContentIdentifier();
}
OUString aTargetUrl = aURL;
try
{
std::unique_ptr< DAVResourceAccess > xResAccess;
......@@ -3132,12 +3130,9 @@ void Content::lock(
//-1, // infinite lock
uno::Sequence< OUString >() );
// update the URL
aTargetUrl = xResAccess->getURL();
// OPTIONS may change as a consequence of the lock operation
aStaticDAVOptionsCache.removeDAVOptions( xResAccess->getURL() );
xResAccess->LOCK( aLock, Environment );
// OPTIONS may have changed as a consequence of the lock operation
aStaticDAVOptionsCache.removeDAVOptions( aTargetUrl );
{
osl::Guard< osl::Mutex > aGuard( m_aMutex );
......@@ -3146,7 +3141,6 @@ void Content::lock(
}
catch ( DAVException const & e )
{
aStaticDAVOptionsCache.removeDAVOptions( aTargetUrl );
// check if the exception thrown is 'already locked'
// this exception is mapped directly to the ucb correct one, without
// going into the cancelCommandExecution() user interaction
......@@ -3247,8 +3241,6 @@ void Content::unlock(
const uno::Reference< ucb::XCommandEnvironment >& Environment )
throw( uno::Exception, std::exception )
{
// save the URL to clean cache
OUString aTargetUrl = m_xIdentifier->getContentIdentifier();
try
{
......@@ -3258,8 +3250,6 @@ void Content::unlock(
xResAccess.reset( new DAVResourceAccess( *m_xResAccess.get() ) );
}
// update the URL
aTargetUrl = xResAccess->getURL();
// check if the target URL is a Class1 DAV
DAVOptions aDAVOptions;
getResourceOptions( Environment, aDAVOptions, xResAccess );
......@@ -3267,10 +3257,10 @@ void Content::unlock(
// at least class one is needed
if( aDAVOptions.isClass1() )
{
xResAccess->UNLOCK( Environment );
// remove options from cache, unlock may change it
// it will be refreshed when needed
aStaticDAVOptionsCache.removeDAVOptions( aTargetUrl );
aStaticDAVOptionsCache.removeDAVOptions( xResAccess->getURL() );
xResAccess->UNLOCK( Environment );
}
{
......@@ -3310,9 +3300,6 @@ void Content::unlock(
}
break;
default:
// remove options from cache,
// it will be refreshed when needed
aStaticDAVOptionsCache.removeDAVOptions( aTargetUrl );
//fallthrough
;
}
......
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