[Libreoffice-commits] core.git: 4 commits - framework/inc framework/source

Stephan Bergmann sbergman at redhat.com
Thu Mar 20 09:30:36 PDT 2014


 framework/inc/classes/filtercachedata.hxx                          |    3 
 framework/inc/threadhelp/guard.hxx                                 |   71 ----
 framework/inc/threadhelp/lockhelper.hxx                            |   62 ---
 framework/source/fwe/classes/actiontriggerpropertyset.cxx          |    8 
 framework/source/fwe/classes/actiontriggerseparatorpropertyset.cxx |    8 
 framework/source/fwe/classes/rootactiontriggercontainer.cxx        |    1 
 framework/source/fwi/classes/propertysethelper.cxx                 |    1 
 framework/source/fwi/classes/protocolhandlercache.cxx              |   63 +--
 framework/source/fwi/threadhelp/lockhelper.cxx                     |  173 ----------
 framework/source/helper/statusindicator.cxx                        |    1 
 framework/source/helper/statusindicatorfactory.cxx                 |    8 
 framework/source/services/desktop.cxx                              |    4 
 framework/source/services/dispatchhelper.cxx                       |    1 
 framework/source/services/frame.cxx                                |   11 
 framework/source/uielement/addonstoolbarmanager.cxx                |    1 
 framework/source/uielement/addonstoolbarwrapper.cxx                |    1 
 framework/source/uielement/menubarwrapper.cxx                      |    1 
 framework/source/uielement/progressbarwrapper.cxx                  |    1 
 framework/source/uielement/statusbarwrapper.cxx                    |    1 
 framework/source/uielement/toolbarwrapper.cxx                      |    1 
 20 files changed, 60 insertions(+), 361 deletions(-)

New commits:
commit c8239a1dd46c78f89fa31599036300ecf60108b5
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Thu Mar 20 16:43:22 2014 +0100

    Remove newly unused framework::LockHelper class
    
    ...and make LockHelper::getGlobalLock() FWI_DLLPUBLIC again (so there's a single
    such lock, not one per library).
    
    Change-Id: I0aed77333dc93cdf1c7dd7b96620fb7a8eb3dd64

diff --git a/framework/inc/threadhelp/lockhelper.hxx b/framework/inc/threadhelp/lockhelper.hxx
index 248fcac..eb2260a 100644
--- a/framework/inc/threadhelp/lockhelper.hxx
+++ b/framework/inc/threadhelp/lockhelper.hxx
@@ -20,68 +20,20 @@
 #ifndef INCLUDED_FRAMEWORK_INC_THREADHELP_LOCKHELPER_HXX
 #define INCLUDED_FRAMEWORK_INC_THREADHELP_LOCKHELPER_HXX
 
-#include <boost/noncopyable.hpp>
-#include <osl/mutex.hxx>
-#include <rtl/instance.hxx>
+#include <sal/config.h>
 
-#include <comphelper/solarmutex.hxx>
 #include <fwidllapi.h>
 
-namespace framework{
+namespace osl { class Mutex; }
+
+namespace framework { namespace LockHelper {
 
 //TODO: This presumable should return the SolarMutex, though it actually returns
 // some independent mutex:
-struct GlobalLock: public rtl::Static<osl::Mutex, GlobalLock> {};
-
-/*-************************************************************************************************************
-    @short          helper to set right lock in right situation
-    @descr          This helper support different types of locking:
-                        a)  no locks - transparent for user!
-                            This could be useful for simluation or single threaded environments!
-                        b)  own mutex
-                            An object use his own osl-mutex to be threadsafe. Useful for easy and exclusiv locking.
-                        c)  solar mutex
-                            An object use our solar mutex and will be a part of a greater safed "threadsafe code block".
-                            Could be useful for simulation and testing of higher modules!
-                        d)  fair rw-lock
-                            An object use an implementation of a fair rw-lock. This increase granularity of t hreadsafe mechanism
-                            and should be used for high performance threadsafe code!
-
-    @devstatus      draft
-*//*-*************************************************************************************************************/
-class FWI_DLLPUBLIC LockHelper : private boost::noncopyable
-{
-
-    //  public methods
-
-    public:
-
-
-        //  ctor/dtor
-
-                 LockHelper( comphelper::SolarMutex* pSolarMutex = NULL );
-                ~LockHelper(                                   );
-
-        void acquire();
-        void release();
-
-        //  something else
-
-        ::osl::Mutex&       getShareableOslMutex(                                   );
-
-
-    //  private member
-    //  Make some member mutable for using in const functions!
-
-    private:
-
-        mutable comphelper::SolarMutex* m_pSolarMutex   ;
-        mutable ::osl::Mutex*   m_pShareableOslMutex    ;
-        mutable sal_Bool        m_bDummySolarMutex      ;
-};
+FWI_DLLPUBLIC osl::Mutex & getGlobalLock();
 
-}       //  namespace framework
+} }
 
-#endif // INCLUDED_FRAMEWORK_INC_THREADHELP_LOCKHELPER_HXX
+#endif
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/framework/source/fwe/classes/actiontriggerpropertyset.cxx b/framework/source/fwe/classes/actiontriggerpropertyset.cxx
index 8fdfed6..402d277 100644
--- a/framework/source/fwe/classes/actiontriggerpropertyset.cxx
+++ b/framework/source/fwe/classes/actiontriggerpropertyset.cxx
@@ -201,7 +201,7 @@ void SAL_CALL ActionTriggerPropertySet::setFastPropertyValue_NoBroadcast(
     sal_Int32 nHandle, const Any& aValue )
 throw( Exception, std::exception )
 {
-    ::osl::MutexGuard aGuard( GlobalLock::get() );
+    ::osl::MutexGuard aGuard( LockHelper::getGlobalLock() );
 
     // Search for right handle ... and try to set property value.
     switch( nHandle )
@@ -231,7 +231,7 @@ throw( Exception, std::exception )
 void SAL_CALL ActionTriggerPropertySet::getFastPropertyValue(
     Any& aValue, sal_Int32 nHandle ) const
 {
-    ::osl::MutexGuard aGuard( GlobalLock::get() );
+    ::osl::MutexGuard aGuard( LockHelper::getGlobalLock() );
 
     // Search for right handle ... and try to get property value.
     switch( nHandle )
@@ -268,7 +268,7 @@ void SAL_CALL ActionTriggerPropertySet::getFastPropertyValue(
     if( pInfoHelper == NULL )
     {
         // Ready for multithreading
-        ::osl::MutexGuard aGuard( GlobalLock::get() );
+        ::osl::MutexGuard aGuard( LockHelper::getGlobalLock() );
         // Control this pointer again, another instance can be faster then these!
         if( pInfoHelper == NULL )
         {
@@ -294,7 +294,7 @@ throw ( RuntimeException, std::exception )
     if( pInfo == NULL )
     {
         // Ready for multithreading
-        ::osl::MutexGuard aGuard( GlobalLock::get() );
+        ::osl::MutexGuard aGuard( LockHelper::getGlobalLock() );
         // Control this pointer again, another instance can be faster then these!
         if( pInfo == NULL )
         {
diff --git a/framework/source/fwe/classes/actiontriggerseparatorpropertyset.cxx b/framework/source/fwe/classes/actiontriggerseparatorpropertyset.cxx
index 6fc046f..d9e3a1a 100644
--- a/framework/source/fwe/classes/actiontriggerseparatorpropertyset.cxx
+++ b/framework/source/fwe/classes/actiontriggerseparatorpropertyset.cxx
@@ -178,7 +178,7 @@ void SAL_CALL ActionTriggerSeparatorPropertySet::setFastPropertyValue_NoBroadcas
     sal_Int32 nHandle, const Any& aValue )
 throw( Exception, std::exception )
 {
-    ::osl::MutexGuard aGuard( GlobalLock::get() );
+    ::osl::MutexGuard aGuard( LockHelper::getGlobalLock() );
 
     // Search for right handle ... and try to set property value.
     switch( nHandle )
@@ -192,7 +192,7 @@ throw( Exception, std::exception )
 void SAL_CALL ActionTriggerSeparatorPropertySet::getFastPropertyValue(
     Any& aValue, sal_Int32 nHandle ) const
 {
-    ::osl::MutexGuard aGuard( GlobalLock::get() );
+    ::osl::MutexGuard aGuard( LockHelper::getGlobalLock() );
 
     // Search for right handle ... and try to get property value.
     switch( nHandle )
@@ -213,7 +213,7 @@ void SAL_CALL ActionTriggerSeparatorPropertySet::getFastPropertyValue(
     if( pInfoHelper == NULL )
     {
         // Ready for multithreading
-        ::osl::MutexGuard aGuard( GlobalLock::get() );
+        ::osl::MutexGuard aGuard( LockHelper::getGlobalLock() );
         // Control this pointer again, another instance can be faster then these!
         if( pInfoHelper == NULL )
         {
@@ -239,7 +239,7 @@ throw ( RuntimeException, std::exception )
     if( pInfo == NULL )
     {
         // Ready for multithreading
-        ::osl::MutexGuard aGuard( GlobalLock::get() );
+        ::osl::MutexGuard aGuard( LockHelper::getGlobalLock() );
         // Control this pointer again, another instance can be faster then these!
         if( pInfo == NULL )
         {
diff --git a/framework/source/fwi/classes/protocolhandlercache.cxx b/framework/source/fwi/classes/protocolhandlercache.cxx
index c90a5c0..64ecf8b 100644
--- a/framework/source/fwi/classes/protocolhandlercache.cxx
+++ b/framework/source/fwi/classes/protocolhandlercache.cxx
@@ -80,7 +80,7 @@ HandlerCFGAccess* HandlerCache::m_pConfig = NULL;
  */
 HandlerCache::HandlerCache()
 {
-    osl::MutexGuard g(GlobalLock::get());
+    osl::MutexGuard g(LockHelper::getGlobalLock());
 
     if (m_nRefCount==0)
     {
@@ -101,7 +101,7 @@ HandlerCache::HandlerCache()
  */
 HandlerCache::~HandlerCache()
 {
-    osl::MutexGuard g(GlobalLock::get());
+    osl::MutexGuard g(LockHelper::getGlobalLock());
 
     if( m_nRefCount==1)
     {
@@ -129,7 +129,7 @@ sal_Bool HandlerCache::search( const OUString& sURL, ProtocolHandler* pReturn )
 {
     sal_Bool bFound = sal_False;
     /* SAFE */{
-        osl::MutexGuard g(GlobalLock::get());
+        osl::MutexGuard g(LockHelper::getGlobalLock());
         PatternHash::const_iterator pItem = m_pPattern->findPatternKey(sURL);
         if (pItem!=m_pPattern->end())
         {
@@ -153,7 +153,7 @@ sal_Bool HandlerCache::search( const css::util::URL& aURL, ProtocolHandler* pRet
 
 void HandlerCache::takeOver(HandlerHash* pHandler, PatternHash* pPattern)
 {
-    osl::MutexGuard g(GlobalLock::get());
+    osl::MutexGuard g(LockHelper::getGlobalLock());
 
     HandlerHash* pOldHandler = m_pHandler;
     PatternHash* pOldPattern = m_pPattern;
diff --git a/framework/source/fwi/threadhelp/lockhelper.cxx b/framework/source/fwi/threadhelp/lockhelper.cxx
index 8563443..89a4a75 100644
--- a/framework/source/fwi/threadhelp/lockhelper.cxx
+++ b/framework/source/fwi/threadhelp/lockhelper.cxx
@@ -17,138 +17,21 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#include <threadhelp/lockhelper.hxx>
-#include <general.h>
-
-#include <macros/generic.hxx>
-#include "vcl/solarmutex.hxx"
-
-#include <osl/process.h>
-
-namespace framework{
-
-/*-************************************************************************************************************
-    @short      use ctor to initialize instance
-
-    @seealso    class Guard
+#include <sal/config.h>
 
-    @param      "rSolarMutex", for some components we must be "vcl-free"! So we can't work with our solar mutex
-                                directly. User must set his reference at this instance - so we can work with it!
-    @return     -
+#include <osl/mutex.hxx>
+#include <rtl/instance.hxx>
 
-    @onerror    -
-*//*-*************************************************************************************************************/
-LockHelper::LockHelper( comphelper::SolarMutex* pSolarMutex )
-    :   m_pSolarMutex       ( NULL )
-    ,   m_pShareableOslMutex( NULL )
-    ,   m_bDummySolarMutex  ( sal_False )
-{
-    if( pSolarMutex == NULL )
-    {
-        m_pSolarMutex      = new ::vcl::SolarMutexObject;
-        m_bDummySolarMutex = sal_True;
-    }
-    else
-    {
-        m_pSolarMutex = pSolarMutex;
-    }
-}
-
-/*-************************************************************************************************************
-    @short      default dtor to release safed pointer
-    @descr      We have created dynamical mutex- or lock-member ... or we hold a pointer to external objects.
-                We must release it!
-
-    @seealso    ctor()
-
-    @param      -
-    @return     -
-
-    @onerror    -
-*//*-*************************************************************************************************************/
-LockHelper::~LockHelper()
-{
-    if( m_pShareableOslMutex != NULL )
-    {
-        delete m_pShareableOslMutex;
-        m_pShareableOslMutex = NULL;
-    }
-    if( m_pSolarMutex != NULL )
-    {
-        if (m_bDummySolarMutex)
-        {
-            delete static_cast<vcl::SolarMutexObject*>(m_pSolarMutex);
-            m_bDummySolarMutex = sal_False;
-        }
-        m_pSolarMutex = NULL;
-    }
-}
-
-/*-************************************************************************************************************
-    @short      set an exclusiv lock
-    @descr      We must match this lock call with current set lock type and used lock member.
-                If a mutex should be used - it will be easy ... but if a rw-lock should be used
-                we must simulate it as a write access!
-
-    @attention  If a shareable osl mutex exist, he must be used as twice!
-                It's necessary for some cppu-helper classes ...
-
-    @param      -
-    @return     -
-
-    @onerror    -
-*//*-*************************************************************************************************************/
-void LockHelper::acquire()
-{
-    m_pSolarMutex->acquire();
-}
-
-/*-************************************************************************************************************
-    @short      release exclusiv lock
-    @descr      We must match this unlock call with current set lock type and used lock member.
-                If a mutex should be used - it will be easy ... but if a rw-lock should be used
-                we must simulate it as a write access!
+#include <threadhelp/lockhelper.hxx>
 
-    @attention  If a shareable osl mutex exist, he must be used as twice!
-                It's necessary for some cppu-helper classes ...
+namespace {
 
-    @param      -
-    @return     -
+struct GlobalLock: public rtl::Static<osl::Mutex, GlobalLock> {};
 
-    @onerror    -
-*//*-*************************************************************************************************************/
-void LockHelper::release()
-{
-    m_pSolarMutex->release();
 }
 
-/*-************************************************************************************************************
-    @short      return a reference to shared mutex member
-    @descr      Sometimes we need a osl-mutex for sharing with our uno helper ...
-                What can we do?
-                We must use a different mutex member :-(
-                I HOPE IT WORKS!
-
-    @seealso    -
-
-    @param      -
-    @return     A reference to a shared mutex.
-
-    @onerror    No error should occur.
-*//*-*************************************************************************************************************/
-::osl::Mutex& LockHelper::getShareableOslMutex()
-{
-    if( m_pShareableOslMutex == NULL )
-    {
-        ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
-        if( m_pShareableOslMutex == NULL )
-        {
-            m_pShareableOslMutex = new ::osl::Mutex;
-        }
-    }
-    return *m_pShareableOslMutex;
+osl::Mutex & framework::LockHelper::getGlobalLock() {
+    return GlobalLock::get();
 }
 
-} //  namespace framework
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/framework/source/helper/statusindicatorfactory.cxx b/framework/source/helper/statusindicatorfactory.cxx
index 85a56b8..ef05159 100644
--- a/framework/source/helper/statusindicatorfactory.cxx
+++ b/framework/source/helper/statusindicatorfactory.cxx
@@ -531,7 +531,7 @@ void StatusIndicatorFactory::impl_reschedule(sal_Bool bForce)
         return;
 
     // SAFE ->
-    osl::ResettableMutexGuard aGlobalLock(GlobalLock::get());
+    osl::ResettableMutexGuard aGlobalLock(LockHelper::getGlobalLock());
 
     if (m_nInReschedule == 0)
     {
diff --git a/framework/source/services/desktop.cxx b/framework/source/services/desktop.cxx
index 44c24ab..4a8cec3 100644
--- a/framework/source/services/desktop.cxx
+++ b/framework/source/services/desktop.cxx
@@ -1533,7 +1533,7 @@ void SAL_CALL Desktop::getFastPropertyValue( css::uno::Any& aValue  ,
     if( pInfoHelper == NULL )
     {
         // Ready for multithreading
-        ::osl::MutexGuard aGuard( GlobalLock::get() );
+        ::osl::MutexGuard aGuard( LockHelper::getGlobalLock() );
         // Control this pointer again, another instance can be faster then these!
         if( pInfoHelper == NULL )
         {
@@ -1581,7 +1581,7 @@ css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL Desktop::getPropert
     if( pInfo == NULL )
     {
         // Ready for multithreading
-        ::osl::MutexGuard aGuard( GlobalLock::get() );
+        ::osl::MutexGuard aGuard( LockHelper::getGlobalLock() );
         // Control this pointer again, another instance can be faster then these!
         if( pInfo == NULL )
         {
diff --git a/framework/source/services/frame.cxx b/framework/source/services/frame.cxx
index 521e3e7..583e8d5 100644
--- a/framework/source/services/frame.cxx
+++ b/framework/source/services/frame.cxx
@@ -2700,7 +2700,7 @@ void SAL_CALL Frame::windowShown( const css::lang::EventObject& ) throw(css::uno
     if (xDesktopCheck.is())
     {
         /* STATIC SAFE { */
-        osl::ClearableMutexGuard aStaticWriteLock( GlobalLock::get() );
+        osl::ClearableMutexGuard aStaticWriteLock( LockHelper::getGlobalLock() );
         sal_Bool bMustBeTriggered  = bFirstVisibleTask;
                  bFirstVisibleTask = sal_False;
         aStaticWriteLock.clear();
@@ -3443,7 +3443,7 @@ void Frame::impl_checkMenuCloser()
     // Look for necessary actions ...
     // Only if the closer state must be moved from one frame to another one
     // or must be enabled/disabled at all.
-    osl::MutexGuard g(GlobalLock::get());
+    osl::MutexGuard g(LockHelper::getGlobalLock());
     css::uno::Reference< css::frame::XFrame2 > xCloserFrame (m_xCloserFrame.get(), css::uno::UNO_QUERY);
     if (xCloserFrame!=xNewCloserFrame)
     {
commit 250a4e8875d97a75683349415502a345f03138a0
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Thu Mar 20 16:15:38 2014 +0100

    Remove newly unused framework::Guard
    
    Change-Id: I49650bfd036c5df22f81c3e8cf30bc0795154a30

diff --git a/framework/inc/threadhelp/guard.hxx b/framework/inc/threadhelp/guard.hxx
deleted file mode 100644
index 9ba1f4a..0000000
--- a/framework/inc/threadhelp/guard.hxx
+++ /dev/null
@@ -1,71 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- *   Licensed to the Apache Software Foundation (ASF) under one or more
- *   contributor license agreements. See the NOTICE file distributed
- *   with this work for additional information regarding copyright
- *   ownership. The ASF licenses this file to you under the Apache
- *   License, Version 2.0 (the "License"); you may not use this file
- *   except in compliance with the License. You may obtain a copy of
- *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#ifndef INCLUDED_FRAMEWORK_INC_THREADHELP_GUARD_HXX
-#define INCLUDED_FRAMEWORK_INC_THREADHELP_GUARD_HXX
-
-#include <sal/config.h>
-
-#include <boost/noncopyable.hpp>
-
-#include <threadhelp/lockhelper.hxx>
-
-namespace framework{
-
-class Guard : private boost::noncopyable
-{
-public:
-    Guard( LockHelper& rLock )
-        :   m_pLock ( &rLock    )
-        ,   m_locked(false)
-    {
-        lock();
-    }
-
-    ~Guard()
-    {
-        unlock();
-    }
-
-    void lock()
-    {
-        if (!m_locked) {
-            m_pLock->acquire();
-            m_locked = true;
-        }
-    }
-
-    void unlock()
-    {
-        if (m_locked) {
-            m_pLock->release();
-            m_locked = false;
-        }
-    }
-
-private:
-        LockHelper* m_pLock;
-        bool m_locked;
-};
-
-}
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/framework/source/fwe/classes/rootactiontriggercontainer.cxx b/framework/source/fwe/classes/rootactiontriggercontainer.cxx
index 1cbc631..d6079fb 100644
--- a/framework/source/fwe/classes/rootactiontriggercontainer.cxx
+++ b/framework/source/fwe/classes/rootactiontriggercontainer.cxx
@@ -26,7 +26,6 @@
 #include <cppuhelper/typeprovider.hxx>
 #include <framework/actiontriggerhelper.hxx>
 #include <osl/mutex.hxx>
-#include <threadhelp/guard.hxx>
 #include <vcl/svapp.hxx>
 
 using namespace cppu;
diff --git a/framework/source/fwi/classes/propertysethelper.cxx b/framework/source/fwi/classes/propertysethelper.cxx
index 636b5df..338e003 100644
--- a/framework/source/fwi/classes/propertysethelper.cxx
+++ b/framework/source/fwi/classes/propertysethelper.cxx
@@ -23,7 +23,6 @@
 
 #include <classes/propertysethelper.hxx>
 #include <threadhelp/transactionguard.hxx>
-#include <threadhelp/guard.hxx>
 
 namespace framework{
 
diff --git a/framework/source/helper/statusindicator.cxx b/framework/source/helper/statusindicator.cxx
index ab9e4cc8..2889d58 100644
--- a/framework/source/helper/statusindicator.cxx
+++ b/framework/source/helper/statusindicator.cxx
@@ -21,7 +21,6 @@
 
 
 #include <helper/statusindicator.hxx>
-#include <threadhelp/guard.hxx>
 
 namespace framework{
 
diff --git a/framework/source/services/dispatchhelper.cxx b/framework/source/services/dispatchhelper.cxx
index 050885a..355ad53 100644
--- a/framework/source/services/dispatchhelper.cxx
+++ b/framework/source/services/dispatchhelper.cxx
@@ -18,7 +18,6 @@
  */
 
 #include <services/dispatchhelper.hxx>
-#include <threadhelp/guard.hxx>
 #include <services.h>
 
 #include <com/sun/star/util/URLTransformer.hpp>
diff --git a/framework/source/uielement/addonstoolbarmanager.cxx b/framework/source/uielement/addonstoolbarmanager.cxx
index 4137339..111b797 100644
--- a/framework/source/uielement/addonstoolbarmanager.cxx
+++ b/framework/source/uielement/addonstoolbarmanager.cxx
@@ -21,7 +21,6 @@
 #include <uielement/toolbarmerger.hxx>
 
 #include <uielement/generictoolbarcontroller.hxx>
-#include <threadhelp/guard.hxx>
 #include "services.h"
 #include <framework/imageproducer.hxx>
 #include <framework/sfxhelperfunctions.hxx>
diff --git a/framework/source/uielement/addonstoolbarwrapper.cxx b/framework/source/uielement/addonstoolbarwrapper.cxx
index 03698c1..dba446a 100644
--- a/framework/source/uielement/addonstoolbarwrapper.cxx
+++ b/framework/source/uielement/addonstoolbarwrapper.cxx
@@ -18,7 +18,6 @@
  */
 
 #include <uielement/addonstoolbarwrapper.hxx>
-#include <threadhelp/guard.hxx>
 #include <framework/actiontriggerhelper.hxx>
 #include <uielement/constitemcontainer.hxx>
 #include <uielement/rootitemcontainer.hxx>
diff --git a/framework/source/uielement/menubarwrapper.cxx b/framework/source/uielement/menubarwrapper.cxx
index 5dcb184..fe2f496 100644
--- a/framework/source/uielement/menubarwrapper.cxx
+++ b/framework/source/uielement/menubarwrapper.cxx
@@ -18,7 +18,6 @@
  */
 
 #include <uielement/menubarwrapper.hxx>
-#include <threadhelp/guard.hxx>
 #include <framework/actiontriggerhelper.hxx>
 #include <services.h>
 
diff --git a/framework/source/uielement/progressbarwrapper.cxx b/framework/source/uielement/progressbarwrapper.cxx
index b7e22a8..10b67a4 100644
--- a/framework/source/uielement/progressbarwrapper.cxx
+++ b/framework/source/uielement/progressbarwrapper.cxx
@@ -20,7 +20,6 @@
 #include <uielement/progressbarwrapper.hxx>
 
 #include <helper/statusindicator.hxx>
-#include <threadhelp/guard.hxx>
 #include <uielement/statusindicatorinterfacewrapper.hxx>
 
 #include <com/sun/star/ui/UIElementType.hpp>
diff --git a/framework/source/uielement/statusbarwrapper.cxx b/framework/source/uielement/statusbarwrapper.cxx
index 528bed4..2ebf4cd 100644
--- a/framework/source/uielement/statusbarwrapper.cxx
+++ b/framework/source/uielement/statusbarwrapper.cxx
@@ -20,7 +20,6 @@
 
 #include <uielement/statusbarwrapper.hxx>
 
-#include <threadhelp/guard.hxx>
 #include <framework/actiontriggerhelper.hxx>
 #include <uielement/constitemcontainer.hxx>
 #include <uielement/rootitemcontainer.hxx>
diff --git a/framework/source/uielement/toolbarwrapper.cxx b/framework/source/uielement/toolbarwrapper.cxx
index f9295f9..aa9e5ec 100644
--- a/framework/source/uielement/toolbarwrapper.cxx
+++ b/framework/source/uielement/toolbarwrapper.cxx
@@ -18,7 +18,6 @@
  */
 
 #include <uielement/toolbarwrapper.hxx>
-#include <threadhelp/guard.hxx>
 #include <framework/actiontriggerhelper.hxx>
 #include <uielement/constitemcontainer.hxx>
 #include <uielement/rootitemcontainer.hxx>
commit 8b2c7983330aed62fb80cf4ca05375e9ccf7ad13
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Thu Mar 20 15:56:25 2014 +0100

    Remove unused function declaration
    
    Change-Id: I82ac945e5d1fba82047a7902782893d01eda34e3

diff --git a/framework/inc/classes/filtercachedata.hxx b/framework/inc/classes/filtercachedata.hxx
index 00b541a..da7bf36 100644
--- a/framework/inc/classes/filtercachedata.hxx
+++ b/framework/inc/classes/filtercachedata.hxx
@@ -47,8 +47,6 @@
 
 namespace framework{
 
-class LockHelper;
-
 #define DEFAULT_FILTERCACHE_VERSION                 6                                                                   /// these implmentation of FilterCache support different version of TypeDetection.xml! This define the current set default one.
 
 #define DEFAULT_FILTERCACHE_MODE                    CONFIG_MODE_DELAYED_UPDATE | CONFIG_MODE_ALL_LOCALES                                          /// ConfigItems could run in different modes: supported values are ... { CONFIG_MODE_IMMEDIATE_UPDATE, CONFIG_MODE_DELAYED_UPDATE, CONFIG_MODE_ALL_LOCALES }
@@ -490,7 +488,6 @@ class DataContainer
 
         sal_Bool    isModified();
 
-        LockHelper& getSyncronizer();
         void        free();
 
         sal_Bool isValidOrRepairable       () const;
commit 4ddb43bcf159f8cff4bb090da218c4f150dceab8
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Thu Mar 20 15:49:27 2014 +0100

    Turn odd framework::LockHelper::getGlobalLock() into an osl::Mutex
    
    ...and extract it to framework::GlobalLock::get().
    
    The old lock was actually effectively two different locks,
    LockHelper::getGloblaLock() and
    LockHelper::getGlobalLock().getShareableOslMutex(), and both were used in
    different places.  These places all use the same single osl::Mutex instance now,
    but hopefully that does not lead to problems (which it shouldn't, given the
    documentation of LockHelper::getShareableOslMutex: "Sometimes we need a osl-
    mutex for sharing with our uno helper ... What can we do? We must use a
    different mutex member :-( I HOPE IT WORKS!").
    
    Of course, the "TODO: This presumable should return the SolarMutex" still
    applies.
    
    Change-Id: I7caea3241d1b70a00272fe1f2214c071ef22cf2c

diff --git a/framework/inc/threadhelp/lockhelper.hxx b/framework/inc/threadhelp/lockhelper.hxx
index 777c457..248fcac 100644
--- a/framework/inc/threadhelp/lockhelper.hxx
+++ b/framework/inc/threadhelp/lockhelper.hxx
@@ -21,14 +21,18 @@
 #define INCLUDED_FRAMEWORK_INC_THREADHELP_LOCKHELPER_HXX
 
 #include <boost/noncopyable.hpp>
+#include <osl/mutex.hxx>
+#include <rtl/instance.hxx>
 
 #include <comphelper/solarmutex.hxx>
 #include <fwidllapi.h>
 
-namespace osl { class Mutex; }
-
 namespace framework{
 
+//TODO: This presumable should return the SolarMutex, though it actually returns
+// some independent mutex:
+struct GlobalLock: public rtl::Static<osl::Mutex, GlobalLock> {};
+
 /*-************************************************************************************************************
     @short          helper to set right lock in right situation
     @descr          This helper support different types of locking:
@@ -63,10 +67,6 @@ class FWI_DLLPUBLIC LockHelper : private boost::noncopyable
 
         //  something else
 
-        static LockHelper&  getGlobalLock();
-            //TODO: this presumable should return the SolarMutex, though it
-            // actually returns some independent mutex
-
         ::osl::Mutex&       getShareableOslMutex(                                   );
 
 
diff --git a/framework/source/fwe/classes/actiontriggerpropertyset.cxx b/framework/source/fwe/classes/actiontriggerpropertyset.cxx
index 6617aeb..8fdfed6 100644
--- a/framework/source/fwe/classes/actiontriggerpropertyset.cxx
+++ b/framework/source/fwe/classes/actiontriggerpropertyset.cxx
@@ -201,7 +201,7 @@ void SAL_CALL ActionTriggerPropertySet::setFastPropertyValue_NoBroadcast(
     sal_Int32 nHandle, const Any& aValue )
 throw( Exception, std::exception )
 {
-    ::osl::MutexGuard aGuard( LockHelper::getGlobalLock().getShareableOslMutex() );
+    ::osl::MutexGuard aGuard( GlobalLock::get() );
 
     // Search for right handle ... and try to set property value.
     switch( nHandle )
@@ -231,7 +231,7 @@ throw( Exception, std::exception )
 void SAL_CALL ActionTriggerPropertySet::getFastPropertyValue(
     Any& aValue, sal_Int32 nHandle ) const
 {
-    ::osl::MutexGuard aGuard( LockHelper::getGlobalLock().getShareableOslMutex() );
+    ::osl::MutexGuard aGuard( GlobalLock::get() );
 
     // Search for right handle ... and try to get property value.
     switch( nHandle )
@@ -268,7 +268,7 @@ void SAL_CALL ActionTriggerPropertySet::getFastPropertyValue(
     if( pInfoHelper == NULL )
     {
         // Ready for multithreading
-        ::osl::MutexGuard aGuard( LockHelper::getGlobalLock().getShareableOslMutex() );
+        ::osl::MutexGuard aGuard( GlobalLock::get() );
         // Control this pointer again, another instance can be faster then these!
         if( pInfoHelper == NULL )
         {
@@ -294,7 +294,7 @@ throw ( RuntimeException, std::exception )
     if( pInfo == NULL )
     {
         // Ready for multithreading
-        ::osl::MutexGuard aGuard( LockHelper::getGlobalLock().getShareableOslMutex() );
+        ::osl::MutexGuard aGuard( GlobalLock::get() );
         // Control this pointer again, another instance can be faster then these!
         if( pInfo == NULL )
         {
diff --git a/framework/source/fwe/classes/actiontriggerseparatorpropertyset.cxx b/framework/source/fwe/classes/actiontriggerseparatorpropertyset.cxx
index 6f413c0..6fc046f 100644
--- a/framework/source/fwe/classes/actiontriggerseparatorpropertyset.cxx
+++ b/framework/source/fwe/classes/actiontriggerseparatorpropertyset.cxx
@@ -178,7 +178,7 @@ void SAL_CALL ActionTriggerSeparatorPropertySet::setFastPropertyValue_NoBroadcas
     sal_Int32 nHandle, const Any& aValue )
 throw( Exception, std::exception )
 {
-    ::osl::MutexGuard aGuard( LockHelper::getGlobalLock().getShareableOslMutex() );
+    ::osl::MutexGuard aGuard( GlobalLock::get() );
 
     // Search for right handle ... and try to set property value.
     switch( nHandle )
@@ -192,7 +192,7 @@ throw( Exception, std::exception )
 void SAL_CALL ActionTriggerSeparatorPropertySet::getFastPropertyValue(
     Any& aValue, sal_Int32 nHandle ) const
 {
-    ::osl::MutexGuard aGuard( LockHelper::getGlobalLock().getShareableOslMutex() );
+    ::osl::MutexGuard aGuard( GlobalLock::get() );
 
     // Search for right handle ... and try to get property value.
     switch( nHandle )
@@ -213,7 +213,7 @@ void SAL_CALL ActionTriggerSeparatorPropertySet::getFastPropertyValue(
     if( pInfoHelper == NULL )
     {
         // Ready for multithreading
-        ::osl::MutexGuard aGuard( LockHelper::getGlobalLock().getShareableOslMutex() );
+        ::osl::MutexGuard aGuard( GlobalLock::get() );
         // Control this pointer again, another instance can be faster then these!
         if( pInfoHelper == NULL )
         {
@@ -239,7 +239,7 @@ throw ( RuntimeException, std::exception )
     if( pInfo == NULL )
     {
         // Ready for multithreading
-        ::osl::MutexGuard aGuard( LockHelper::getGlobalLock().getShareableOslMutex() );
+        ::osl::MutexGuard aGuard( GlobalLock::get() );
         // Control this pointer again, another instance can be faster then these!
         if( pInfo == NULL )
         {
diff --git a/framework/source/fwi/classes/protocolhandlercache.cxx b/framework/source/fwi/classes/protocolhandlercache.cxx
index eaad82c..c90a5c0 100644
--- a/framework/source/fwi/classes/protocolhandlercache.cxx
+++ b/framework/source/fwi/classes/protocolhandlercache.cxx
@@ -25,7 +25,6 @@
 
 #include <classes/protocolhandlercache.hxx>
 #include <classes/converter.hxx>
-#include <threadhelp/guard.hxx>
 #include <threadhelp/lockhelper.hxx>
 
 #include <tools/wldcrd.hxx>
@@ -81,20 +80,18 @@ HandlerCFGAccess* HandlerCache::m_pConfig = NULL;
  */
 HandlerCache::HandlerCache()
 {
-    /* SAFE */{
-        Guard aGlobalLock( LockHelper::getGlobalLock() );
+    osl::MutexGuard g(GlobalLock::get());
 
-        if (m_nRefCount==0)
-        {
-            m_pHandler = new HandlerHash();
-            m_pPattern = new PatternHash();
-            m_pConfig  = new HandlerCFGAccess(PACKAGENAME_PROTOCOLHANDLER);
-            m_pConfig->read(&m_pHandler,&m_pPattern);
-            m_pConfig->setCache(this);
-        }
+    if (m_nRefCount==0)
+    {
+        m_pHandler = new HandlerHash();
+        m_pPattern = new PatternHash();
+        m_pConfig  = new HandlerCFGAccess(PACKAGENAME_PROTOCOLHANDLER);
+        m_pConfig->read(&m_pHandler,&m_pPattern);
+        m_pConfig->setCache(this);
+    }
 
-        ++m_nRefCount;
-    /* SAFE */}
+    ++m_nRefCount;
 }
 
 /**
@@ -104,25 +101,23 @@ HandlerCache::HandlerCache()
  */
 HandlerCache::~HandlerCache()
 {
-    /* SAFE */{
-        Guard aGlobalLock( LockHelper::getGlobalLock() );
+    osl::MutexGuard g(GlobalLock::get());
 
-        if( m_nRefCount==1)
-        {
-            m_pConfig->setCache(NULL);
-            m_pHandler->free();
-            m_pPattern->free();
-
-            delete m_pConfig;
-            delete m_pHandler;
-            delete m_pPattern;
-            m_pConfig = NULL;
-            m_pHandler= NULL;
-            m_pPattern= NULL;
-        }
+    if( m_nRefCount==1)
+    {
+        m_pConfig->setCache(NULL);
+        m_pHandler->free();
+        m_pPattern->free();
+
+        delete m_pConfig;
+        delete m_pHandler;
+        delete m_pPattern;
+        m_pConfig = NULL;
+        m_pHandler= NULL;
+        m_pPattern= NULL;
+    }
 
-        --m_nRefCount;
-    /* SAFE */}
+    --m_nRefCount;
 }
 
 /**
@@ -134,7 +129,7 @@ sal_Bool HandlerCache::search( const OUString& sURL, ProtocolHandler* pReturn )
 {
     sal_Bool bFound = sal_False;
     /* SAFE */{
-        Guard aReadLock( LockHelper::getGlobalLock() );
+        osl::MutexGuard g(GlobalLock::get());
         PatternHash::const_iterator pItem = m_pPattern->findPatternKey(sURL);
         if (pItem!=m_pPattern->end())
         {
@@ -158,8 +153,7 @@ sal_Bool HandlerCache::search( const css::util::URL& aURL, ProtocolHandler* pRet
 
 void HandlerCache::takeOver(HandlerHash* pHandler, PatternHash* pPattern)
 {
-    // SAFE ->
-    Guard aWriteLock( LockHelper::getGlobalLock() );
+    osl::MutexGuard g(GlobalLock::get());
 
     HandlerHash* pOldHandler = m_pHandler;
     PatternHash* pOldPattern = m_pPattern;
@@ -171,9 +165,6 @@ void HandlerCache::takeOver(HandlerHash* pHandler, PatternHash* pPattern)
     pOldPattern->free();
     delete pOldHandler;
     delete pOldPattern;
-
-    aWriteLock.unlock();
-    // <- SAFE
 }
 
 /**
diff --git a/framework/source/fwi/threadhelp/lockhelper.cxx b/framework/source/fwi/threadhelp/lockhelper.cxx
index d341fe6..8563443 100644
--- a/framework/source/fwi/threadhelp/lockhelper.cxx
+++ b/framework/source/fwi/threadhelp/lockhelper.cxx
@@ -123,46 +123,6 @@ void LockHelper::release()
 }
 
 /*-************************************************************************************************************
-    @short      return a reference to a static lock helper
-    @descr      Sometimes we need the global mutex or rw-lock! (e.g. in our own static methods)
-                But it's not a good idea to use these global one very often ...
-                Thats why we use this little helper method.
-                We create our own "class global static" lock.
-                It will be created at first call only!
-                All other requests use these created one then directly.
-
-    @seealso    -
-
-    @param      -
-    @return     A reference to a static mutex/lock member.
-
-    @onerror    No error should occur.
-*//*-*************************************************************************************************************/
-LockHelper& LockHelper::getGlobalLock()
-{
-    // Initialize static "member" only for one time!
-    // Algorithm:
-    // a) Start with an invalid lock (NULL pointer)
-    // b) If these method first called (lock not already exist!) ...
-    // c) ... we must create a new one. Protect follow code with the global mutex -
-    //    (It must be - we create a static variable!)
-    // d) Check pointer again - because ... another instance of our class could be faster then these one!
-    // e) Create the new lock and set it for return on static variable.
-    // f) Return new created or already existing lock object.
-    static LockHelper* pLock = NULL;
-    if( pLock == NULL )
-    {
-        ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
-        if( pLock == NULL )
-        {
-            static LockHelper aLock;
-            pLock = &aLock;
-        }
-    }
-    return *pLock;
-}
-
-/*-************************************************************************************************************
     @short      return a reference to shared mutex member
     @descr      Sometimes we need a osl-mutex for sharing with our uno helper ...
                 What can we do?
diff --git a/framework/source/helper/statusindicatorfactory.cxx b/framework/source/helper/statusindicatorfactory.cxx
index 944a528..85a56b8 100644
--- a/framework/source/helper/statusindicatorfactory.cxx
+++ b/framework/source/helper/statusindicatorfactory.cxx
@@ -21,7 +21,7 @@
 #include <helper/statusindicatorfactory.hxx>
 #include <helper/statusindicator.hxx>
 #include <helper/vclstatusindicator.hxx>
-#include <threadhelp/guard.hxx>
+#include <threadhelp/lockhelper.hxx>
 #include <services.h>
 #include <properties.h>
 
@@ -531,12 +531,12 @@ void StatusIndicatorFactory::impl_reschedule(sal_Bool bForce)
         return;
 
     // SAFE ->
-    Guard aGlobalLock(LockHelper::getGlobalLock());
+    osl::ResettableMutexGuard aGlobalLock(GlobalLock::get());
 
     if (m_nInReschedule == 0)
     {
         ++m_nInReschedule;
-        aGlobalLock.unlock();
+        aGlobalLock.clear();
         // <- SAFE
 
         {
@@ -545,7 +545,7 @@ void StatusIndicatorFactory::impl_reschedule(sal_Bool bForce)
         }
 
         // SAFE ->
-        aGlobalLock.lock();
+        aGlobalLock.reset();
         --m_nInReschedule;
     }
 }
diff --git a/framework/source/services/desktop.cxx b/framework/source/services/desktop.cxx
index 028397d..44c24ab 100644
--- a/framework/source/services/desktop.cxx
+++ b/framework/source/services/desktop.cxx
@@ -1533,7 +1533,7 @@ void SAL_CALL Desktop::getFastPropertyValue( css::uno::Any& aValue  ,
     if( pInfoHelper == NULL )
     {
         // Ready for multithreading
-        ::osl::MutexGuard aGuard( LockHelper::getGlobalLock().getShareableOslMutex() );
+        ::osl::MutexGuard aGuard( GlobalLock::get() );
         // Control this pointer again, another instance can be faster then these!
         if( pInfoHelper == NULL )
         {
@@ -1581,7 +1581,7 @@ css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL Desktop::getPropert
     if( pInfo == NULL )
     {
         // Ready for multithreading
-        ::osl::MutexGuard aGuard( LockHelper::getGlobalLock().getShareableOslMutex() );
+        ::osl::MutexGuard aGuard( GlobalLock::get() );
         // Control this pointer again, another instance can be faster then these!
         if( pInfo == NULL )
         {
diff --git a/framework/source/services/frame.cxx b/framework/source/services/frame.cxx
index 6a5090b..521e3e7 100644
--- a/framework/source/services/frame.cxx
+++ b/framework/source/services/frame.cxx
@@ -32,7 +32,7 @@
 #include <dispatch/dispatchinformationprovider.hxx>
 #include <classes/framecontainer.hxx>
 #include <classes/propertysethelper.hxx>
-#include <threadhelp/guard.hxx>
+#include <threadhelp/lockhelper.hxx>
 #include <threadhelp/transactionguard.hxx>
 #include <threadhelp/transactionbase.hxx>
 #include <general.h>
@@ -2700,10 +2700,10 @@ void SAL_CALL Frame::windowShown( const css::lang::EventObject& ) throw(css::uno
     if (xDesktopCheck.is())
     {
         /* STATIC SAFE { */
-        Guard aStaticWriteLock( LockHelper::getGlobalLock() );
+        osl::ClearableMutexGuard aStaticWriteLock( GlobalLock::get() );
         sal_Bool bMustBeTriggered  = bFirstVisibleTask;
                  bFirstVisibleTask = sal_False;
-        aStaticWriteLock.unlock();
+        aStaticWriteLock.clear();
         /* } STATIC SAFE */
 
         if (bMustBeTriggered)
@@ -3443,8 +3443,7 @@ void Frame::impl_checkMenuCloser()
     // Look for necessary actions ...
     // Only if the closer state must be moved from one frame to another one
     // or must be enabled/disabled at all.
-    /* STATIC SAFE { */
-    Guard aStaticWriteLock(LockHelper::getGlobalLock());
+    osl::MutexGuard g(GlobalLock::get());
     css::uno::Reference< css::frame::XFrame2 > xCloserFrame (m_xCloserFrame.get(), css::uno::UNO_QUERY);
     if (xCloserFrame!=xNewCloserFrame)
     {
@@ -3454,8 +3453,6 @@ void Frame::impl_checkMenuCloser()
             impl_setCloser(xNewCloserFrame, sal_True);
         m_xCloserFrame = xNewCloserFrame;
     }
-    aStaticWriteLock.unlock();
-    /* } STATIC SAFE */
 }
 
 


More information about the Libreoffice-commits mailing list