summaryrefslogtreecommitdiff
path: root/framework
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2012-10-25 09:03:20 +0100
committerCaolán McNamara <caolanm@redhat.com>2012-10-25 09:09:26 +0100
commit73fc75bf805eb7660598f2862746f3cfac75aa79 (patch)
tree0714531cb1fc5824084681d45b2f31de0d19b50c /framework
parent9e44e1a819cb919015a8e268029b7e979300ed5c (diff)
ditch SYNCHRONIZED_START/END
Change-Id: I1c0c015f371346efc5712ead7abe9e7f2ec0f9d0
Diffstat (limited to 'framework')
-rw-r--r--framework/inc/general.h19
-rw-r--r--framework/source/dispatch/dispatchprovider.cxx3
-rw-r--r--framework/source/services/desktop.cxx69
3 files changed, 33 insertions, 58 deletions
diff --git a/framework/inc/general.h b/framework/inc/general.h
index f131eacbb15b..3ab1556ed864 100644
--- a/framework/inc/general.h
+++ b/framework/inc/general.h
@@ -48,25 +48,6 @@
*/
namespace css = ::com::sun::star;
-namespace framework {
-
-//-----------------------------------------------------------------------------
-/** Those macro is used to make it more clear where a synchronized block will start.
- Because normal documentation code wont be recognized by some developers to be real
- I need something where they are thinking about.
-
- At least this macro will do nothing ... it's empty.
- But it should make the code more clear .-))
-*/
-#define SYNCHRONIZED_START
-
-//-----------------------------------------------------------------------------
-/** Same then SYNCHRONIZED_START ... but instead it mark the end of such code block.
-*/
-#define SYNCHRONIZED_END
-
-} // namespace framework
-
#endif // #ifndef __FRAMEWORK_GENERAL_H_
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/framework/source/dispatch/dispatchprovider.cxx b/framework/source/dispatch/dispatchprovider.cxx
index 1fb60194ef59..ebb0099f79c1 100644
--- a/framework/source/dispatch/dispatchprovider.cxx
+++ b/framework/source/dispatch/dispatchprovider.cxx
@@ -230,8 +230,7 @@ css::uno::Reference< css::frame::XDispatch > DispatchProvider::implts_queryDeskt
// I.II) "_default"
// This is a combination of search an empty task for recycling - or create a new one.
//-----------------------------------------------------------------------------------------------------
- else
- if (sTargetFrameName==SPECIALTARGET_DEFAULT)
+ else if (sTargetFrameName==SPECIALTARGET_DEFAULT)
{
if (implts_isLoadableContent(aURL))
xDispatcher = implts_getOrCreateDispatchHelper( E_DEFAULTDISPATCHER, xDesktop );
diff --git a/framework/source/services/desktop.cxx b/framework/source/services/desktop.cxx
index 5f0629dc32be..bd281a361e7b 100644
--- a/framework/source/services/desktop.cxx
+++ b/framework/source/services/desktop.cxx
@@ -271,19 +271,17 @@ sal_Bool SAL_CALL Desktop::terminate()
{
TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS );
- SYNCHRONIZED_START
- ReadGuard aReadLock( m_aLock );
+ ReadGuard aReadLock( m_aLock ); // start synchronize
- css::uno::Reference< css::frame::XTerminateListener > xPipeTerminator = m_xPipeTerminator;
- css::uno::Reference< css::frame::XTerminateListener > xQuickLauncher = m_xQuickLauncher;
- css::uno::Reference< css::frame::XTerminateListener > xSWThreadManager = m_xSWThreadManager;
- css::uno::Reference< css::frame::XTerminateListener > xSfxTerminator = m_xSfxTerminator;
+ css::uno::Reference< css::frame::XTerminateListener > xPipeTerminator = m_xPipeTerminator;
+ css::uno::Reference< css::frame::XTerminateListener > xQuickLauncher = m_xQuickLauncher;
+ css::uno::Reference< css::frame::XTerminateListener > xSWThreadManager = m_xSWThreadManager;
+ css::uno::Reference< css::frame::XTerminateListener > xSfxTerminator = m_xSfxTerminator;
- css::lang::EventObject aEvent ( static_cast< ::cppu::OWeakObject* >(this) );
- ::sal_Bool bAskQuickStart = !m_bSuspendQuickstartVeto ;
+ css::lang::EventObject aEvent ( static_cast< ::cppu::OWeakObject* >(this) );
+ ::sal_Bool bAskQuickStart = !m_bSuspendQuickstartVeto ;
- aReadLock.unlock();
- SYNCHRONIZED_END
+ aReadLock.unlock(); // end synchronize
//-------------------------------------------------------------------------------------------------------------
// Ask normal terminate listener. They could stop terminate without closing any open document.
@@ -1179,30 +1177,29 @@ void SAL_CALL Desktop::dispose()
fprintf( stderr, "This used to be an assertion failure: Desktop disposed before terminating it,\n"
"but nothing bad seems to happen anyway?\n" );
#endif
- SYNCHRONIZED_START
- WriteGuard aWriteLock( m_aLock );
- // Look for multiple calls of this method!
- // If somewhere call dispose() twice - he will be stopped here realy!!!
- TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS );
-
- // Now - we are alone and its the first call of this method ...
- // otherwise call before had thrown a DisposedException / hopefully .-)
- // But we dont use the transaction object created before ... we reset it immediatly ...
- // two lines of code ... for what ?
- // The answer: We wished to synchronize concurrent dispose() calls -> OK
- // But next line will wait for all currently running transaction (even if they
- // are running within the same thread!) So we would block ourself there if aTransaction
- // will stay registered .-)
- aTransaction.stop();
-
- // Disable this instance for further work.
- // This will wait for all current running transactions ...
- // and reject all new incoming requests!
- m_aTransactionManager.setWorkingMode( E_BEFORECLOSE );
+ WriteGuard aWriteLock( m_aLock ); // start synchronize
- aWriteLock.unlock();
- SYNCHRONIZED_END
+ // Look for multiple calls of this method!
+ // If somewhere call dispose() twice - he will be stopped here realy!!!
+ TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS );
+
+ // Now - we are alone and its the first call of this method ...
+ // otherwise call before had thrown a DisposedException / hopefully .-)
+ // But we dont use the transaction object created before ... we reset it immediatly ...
+ // two lines of code ... for what ?
+ // The answer: We wished to synchronize concurrent dispose() calls -> OK
+ // But next line will wait for all currently running transaction (even if they
+ // are running within the same thread!) So we would block ourself there if aTransaction
+ // will stay registered .-)
+ aTransaction.stop();
+
+ // Disable this instance for further work.
+ // This will wait for all current running transactions ...
+ // and reject all new incoming requests!
+ m_aTransactionManager.setWorkingMode( E_BEFORECLOSE );
+
+ aWriteLock.unlock(); // end synchronize
// Following lines of code can be called outside a synchronized block ...
// Because our transaction manager will block all new requests to this object.
@@ -1898,11 +1895,9 @@ void Desktop::impl_sendNotifyTerminationEvent()
//=============================================================================
::sal_Bool Desktop::impl_closeFrames(::sal_Bool bAllowUI)
{
- SYNCHRONIZED_START
- ReadGuard aReadLock( m_aLock );
- css::uno::Sequence< css::uno::Reference< css::frame::XFrame > > lFrames = m_aChildTaskContainer.getAllElements();
- aReadLock.unlock();
- SYNCHRONIZED_END
+ ReadGuard aReadLock( m_aLock ); // start synchronize
+ css::uno::Sequence< css::uno::Reference< css::frame::XFrame > > lFrames = m_aChildTaskContainer.getAllElements();
+ aReadLock.unlock(); // end synchronize
::sal_Int32 c = lFrames.getLength();
::sal_Int32 i = 0;