summaryrefslogtreecommitdiff
path: root/framework
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2014-03-18 08:36:11 +0100
committerStephan Bergmann <sbergman@redhat.com>2014-03-18 09:43:16 +0100
commit32a082a7b315fe09c1a715441ad067caf27fa787 (patch)
tree8303af8f29507ba66883be00a811978b2b3d4b10 /framework
parentfd7479de09d0abdc06633b6610ad7a8e38dc7c6e (diff)
Use SolarMutexGuard directly
Change-Id: Ic133d616d730e332de7354d5de4a5ab21944378f
Diffstat (limited to 'framework')
-rw-r--r--framework/inc/classes/framecontainer.hxx7
-rw-r--r--framework/inc/services/desktop.hxx1
-rw-r--r--framework/source/classes/framecontainer.cxx65
3 files changed, 13 insertions, 60 deletions
diff --git a/framework/inc/classes/framecontainer.hxx b/framework/inc/classes/framecontainer.hxx
index 0866a5e986f6..bb300756df44 100644
--- a/framework/inc/classes/framecontainer.hxx
+++ b/framework/inc/classes/framecontainer.hxx
@@ -27,8 +27,6 @@
#include <stdexcept>
#include <algorithm>
-#include <threadhelp/threadhelpbase.hxx>
-
#include <threadhelp/transactionbase.hxx>
#include <general.h>
@@ -54,13 +52,10 @@ typedef TFrameContainer::const_iterator TConstFrameI
It's possible to set one of these frames as active or deactive. You could have full index-access to
container-items.
- @base ThreadHelpBase
- guarantee right initialized lock member during boostrap!
-
@devstatus ready to use
@threadsafe yes
*//*-*************************************************************************************************************/
-class FrameContainer : private ThreadHelpBase
+class FrameContainer
{
// member
diff --git a/framework/inc/services/desktop.hxx b/framework/inc/services/desktop.hxx
index 505f5fbddca2..863788a79b51 100644
--- a/framework/inc/services/desktop.hxx
+++ b/framework/inc/services/desktop.hxx
@@ -23,6 +23,7 @@
#include <sal/config.h>
#include <classes/framecontainer.hxx>
+#include <threadhelp/threadhelpbase.hxx>
#include <com/sun/star/frame/XUntitledNumbers.hpp>
#include <com/sun/star/frame/XController.hpp>
diff --git a/framework/source/classes/framecontainer.cxx b/framework/source/classes/framecontainer.cxx
index 63fa123c8982..32e52be8f386 100644
--- a/framework/source/classes/framecontainer.cxx
+++ b/framework/source/classes/framecontainer.cxx
@@ -18,7 +18,6 @@
*/
#include <classes/framecontainer.hxx>
-#include <threadhelp/guard.hxx>
#include <com/sun/star/frame/FrameSearchFlag.hpp>
@@ -33,9 +32,6 @@ namespace framework{
@threadsafe not necessary - its not a singleton
*****************************************************************************************************************/
FrameContainer::FrameContainer()
- // initialize base classes first.
- // Order is necessary for right initilization of his and OUR member ... m_aLock
- : ThreadHelpBase ( &Application::GetSolarMutex() )
/*DEPRECATEME
, m_bAsyncQuit ( sal_False ) // default must be "disabled"!
, m_aAsyncCall ( LINK( this, FrameContainer, implts_asyncQuit ) )
@@ -70,11 +66,8 @@ void FrameContainer::append( const css::uno::Reference< css::frame::XFrame >& xF
{
if (xFrame.is() && ! exist(xFrame))
{
- /* SAFE { */
- Guard aWriteLock( m_aLock );
+ SolarMutexGuard g;
m_aContainer.push_back( xFrame );
- aWriteLock.unlock();
- /* } SAFE */
}
}
@@ -91,9 +84,7 @@ void FrameContainer::append( const css::uno::Reference< css::frame::XFrame >& xF
*****************************************************************************************************************/
void FrameContainer::remove( const css::uno::Reference< css::frame::XFrame >& xFrame )
{
- /* SAFE { */
- // write lock necessary for follwing erase()!
- Guard aWriteLock( m_aLock );
+ SolarMutexGuard g;
TFrameIterator aSearchedItem = ::std::find( m_aContainer.begin(), m_aContainer.end(), xFrame );
if (aSearchedItem!=m_aContainer.end())
@@ -104,9 +95,6 @@ void FrameContainer::remove( const css::uno::Reference< css::frame::XFrame >& xF
if (m_xActiveFrame==xFrame)
m_xActiveFrame = css::uno::Reference< css::frame::XFrame >();
}
-
- aWriteLock.unlock();
- // } SAFE
}
/**-***************************************************************************************************************
@@ -123,10 +111,8 @@ void FrameContainer::remove( const css::uno::Reference< css::frame::XFrame >& xF
*****************************************************************************************************************/
sal_Bool FrameContainer::exist( const css::uno::Reference< css::frame::XFrame >& xFrame ) const
{
- /* SAFE { */
- Guard aReadLock( m_aLock );
+ SolarMutexGuard g;
return( ::std::find( m_aContainer.begin(), m_aContainer.end(), xFrame ) != m_aContainer.end() );
- /* } SAFE */
}
/**-***************************************************************************************************************
@@ -137,18 +123,13 @@ sal_Bool FrameContainer::exist( const css::uno::Reference< css::frame::XFrame >&
*****************************************************************************************************************/
void FrameContainer::clear()
{
- // SAFE {
- Guard aWriteLock( m_aLock );
-
+ SolarMutexGuard g;
// Clear the container ...
m_aContainer.clear();
// ... and don't forget to reset the active frame.
// Its an reference to a valid container-item.
// But no container item => no active frame!
m_xActiveFrame = css::uno::Reference< css::frame::XFrame >();
-
- aWriteLock.unlock();
- // } SAFE
}
/**-***************************************************************************************************************
@@ -164,10 +145,8 @@ void FrameContainer::clear()
*****************************************************************************************************************/
sal_uInt32 FrameContainer::getCount() const
{
- /* SAFE { */
- Guard aReadLock( m_aLock );
+ SolarMutexGuard g;
return( (sal_uInt32)m_aContainer.size() );
- /* } SAFE */
}
/**-***************************************************************************************************************
@@ -192,11 +171,8 @@ css::uno::Reference< css::frame::XFrame > FrameContainer::operator[]( sal_uInt32
{
// Get element form container WITH automatic test of ranges!
// If index not valid, a out_of_range exception is thrown.
- /* SAFE { */
- Guard aReadLock( m_aLock );
+ SolarMutexGuard g;
xFrame = m_aContainer.at( nIndex );
- aReadLock.unlock();
- /* } SAFE */
}
catch( const std::out_of_range& )
{
@@ -217,17 +193,11 @@ css::uno::Reference< css::frame::XFrame > FrameContainer::operator[]( sal_uInt32
*****************************************************************************************************************/
css::uno::Sequence< css::uno::Reference< css::frame::XFrame > > FrameContainer::getAllElements() const
{
- /* SAFE { */
- Guard aReadLock( m_aLock );
-
+ SolarMutexGuard g;
sal_Int32 nPosition = 0;
css::uno::Sequence< css::uno::Reference< css::frame::XFrame > > lElements ( (sal_uInt32)m_aContainer.size() );
for (TConstFrameIterator pItem=m_aContainer.begin(); pItem!=m_aContainer.end(); ++pItem)
lElements[nPosition++] = *pItem;
-
- aReadLock.unlock();
- /* } SAFE */
-
return lElements;
}
@@ -245,11 +215,8 @@ void FrameContainer::setActive( const css::uno::Reference< css::frame::XFrame >&
{
if ( !xFrame.is() || exist(xFrame) )
{
- /* SAFE { */
- Guard aWriteLock( m_aLock );
+ SolarMutexGuard g;
m_xActiveFrame = xFrame;
- aWriteLock.unlock();
- /* } SAFE */
}
}
@@ -265,10 +232,8 @@ void FrameContainer::setActive( const css::uno::Reference< css::frame::XFrame >&
*****************************************************************************************************************/
css::uno::Reference< css::frame::XFrame > FrameContainer::getActive() const
{
- /* SAFE { */
- Guard aReadLock( m_aLock );
+ SolarMutexGuard g;
return m_xActiveFrame;
- /* } SAFE */
}
/**-***************************************************************************************************************
@@ -284,9 +249,7 @@ css::uno::Reference< css::frame::XFrame > FrameContainer::getActive() const
*****************************************************************************************************************/
css::uno::Reference< css::frame::XFrame > FrameContainer::searchOnAllChildrens( const OUString& sName ) const
{
- /* SAFE { */
- Guard aReadLock( m_aLock );
-
+ SolarMutexGuard g;
// Step over all child frames. But if direct child isn't the right one search on his children first - before
// you go to next direct child of this container!
css::uno::Reference< css::frame::XFrame > xSearchedFrame;
@@ -304,8 +267,6 @@ css::uno::Reference< css::frame::XFrame > FrameContainer::searchOnAllChildrens(
break;
}
}
- aReadLock.unlock();
- /* } SAFE */
return xSearchedFrame;
}
@@ -322,9 +283,7 @@ css::uno::Reference< css::frame::XFrame > FrameContainer::searchOnAllChildrens(
*****************************************************************************************************************/
css::uno::Reference< css::frame::XFrame > FrameContainer::searchOnDirectChildrens( const OUString& sName ) const
{
- /* SAFE { */
- Guard aReadLock( m_aLock );
-
+ SolarMutexGuard g;
css::uno::Reference< css::frame::XFrame > xSearchedFrame;
for( TConstFrameIterator pIterator=m_aContainer.begin(); pIterator!=m_aContainer.end(); ++pIterator )
{
@@ -334,8 +293,6 @@ css::uno::Reference< css::frame::XFrame > FrameContainer::searchOnDirectChildren
break;
}
}
- aReadLock.unlock();
- /* } SAFE */
return xSearchedFrame;
}