[Libreoffice-commits] core.git: comphelper/source include/comphelper include/unotools unotools/source

Noel Grandin noel at peralex.com
Wed Dec 23 23:27:41 PST 2015


 comphelper/source/misc/componentmodule.cxx  |   13 ++++---------
 include/comphelper/componentmodule.hxx      |    5 -----
 include/unotools/componentresmodule.hxx     |    1 -
 unotools/source/misc/componentresmodule.cxx |    5 -----
 4 files changed, 4 insertions(+), 20 deletions(-)

New commits:
commit 3f47ffcf587938508ee4949ac668a76334448c71
Author: Noel Grandin <noel at peralex.com>
Date:   Wed Dec 23 16:52:18 2015 +0200

    OModule::onFirstClient is unused
    
    also move the MutexGuard in revokeClient. No need to hold it while doing
    an osl_atomic_increment. Save it until we actually need to call
    onLastClient.
    
    Change-Id: Ia87f24b66b0430604a2fe717c95223ff1f5ece6d
    Reviewed-on: https://gerrit.libreoffice.org/20919
    Reviewed-by: Noel Grandin <noelgrandin at gmail.com>
    Tested-by: Noel Grandin <noelgrandin at gmail.com>

diff --git a/comphelper/source/misc/componentmodule.cxx b/comphelper/source/misc/componentmodule.cxx
index 37d5ae0..24c9a72 100644
--- a/comphelper/source/misc/componentmodule.cxx
+++ b/comphelper/source/misc/componentmodule.cxx
@@ -75,22 +75,17 @@ namespace comphelper
 
     void OModule::registerClient( OModule::ClientAccess )
     {
-        ::osl::MutexGuard aGuard(m_aMutex);
-        if ( 1 == osl_atomic_increment( &m_nClients ) )
-            onFirstClient();
+        osl_atomic_increment( &m_nClients );
     }
 
 
     void OModule::revokeClient( OModule::ClientAccess )
     {
-        ::osl::MutexGuard aGuard(m_aMutex);
         if ( 0 == osl_atomic_decrement( &m_nClients ) )
+        {
+            ::osl::MutexGuard aGuard(m_aMutex);
             onLastClient();
-    }
-
-
-    void OModule::onFirstClient()
-    {
+        }
     }
 
 
diff --git a/include/comphelper/componentmodule.hxx b/include/comphelper/componentmodule.hxx
index 2f6bc68..9317916 100644
--- a/include/comphelper/componentmodule.hxx
+++ b/include/comphelper/componentmodule.hxx
@@ -142,11 +142,6 @@ namespace comphelper
         void revokeClient( ClientAccess );
 
     protected:
-        /** called when the first client has been registered
-            @precond
-                <member>m_aMutex</member> is locked
-        */
-        virtual void onFirstClient();
 
         /** called when the last client has been revoked
             @precond
diff --git a/include/unotools/componentresmodule.hxx b/include/unotools/componentresmodule.hxx
index bf271db..bc35a6c 100644
--- a/include/unotools/componentresmodule.hxx
+++ b/include/unotools/componentresmodule.hxx
@@ -57,7 +57,6 @@ namespace utl
 
     protected:
         // OModule overridables
-        virtual void onFirstClient() override;
         virtual void onLastClient() override;
     };
 
diff --git a/unotools/source/misc/componentresmodule.cxx b/unotools/source/misc/componentresmodule.cxx
index ed8a338..c0b23e1 100644
--- a/unotools/source/misc/componentresmodule.cxx
+++ b/unotools/source/misc/componentresmodule.cxx
@@ -105,11 +105,6 @@ namespace utl
         return m_pImpl->getResManager();
     }
 
-    void OComponentResourceModule::onFirstClient()
-    {
-        BaseClass::onFirstClient();
-    }
-
     void OComponentResourceModule::onLastClient()
     {
         m_pImpl->freeResManager();


More information about the Libreoffice-commits mailing list