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

Stephan Bergmann (via logerrit) logerrit at kemper.freedesktop.org
Thu May 23 14:50:31 UTC 2019


 framework/source/accelerators/acceleratorcache.cxx         |   23 -------------
 framework/source/accelerators/acceleratorconfiguration.cxx |   22 +++++++-----
 framework/source/inc/accelerators/acceleratorcache.hxx     |   20 -----------
 3 files changed, 13 insertions(+), 52 deletions(-)

New commits:
commit 3c815c9785047761eff7e2895764c81442279976
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Thu May 23 12:21:36 2019 +0200
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Thu May 23 16:49:15 2019 +0200

    No need for AcceleratorCache::takeOver...
    
    ...as it does the same as the copy assignment op.  And both of those are
    apparently already only called with SolarMutex locked, so no need to lock it
    again.  So the copy assignment op (as well as the other special memeber
    functions) can be left implicitly-declared.  (And some uses of the original
    takeOver can be optimized to use move assignment.)
    
    Change-Id: I279a5e3ee85ff2342d6ef5f672108a0712fe116d
    Reviewed-on: https://gerrit.libreoffice.org/72831
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/framework/source/accelerators/acceleratorcache.cxx b/framework/source/accelerators/acceleratorcache.cxx
index 18512cc826cf..03de31befedc 100644
--- a/framework/source/accelerators/acceleratorcache.cxx
+++ b/framework/source/accelerators/acceleratorcache.cxx
@@ -30,29 +30,6 @@
 namespace framework
 {
 
-AcceleratorCache::AcceleratorCache()
-{
-}
-
-AcceleratorCache::AcceleratorCache(const AcceleratorCache& rCopy)
-{
-    m_lCommand2Keys = rCopy.m_lCommand2Keys;
-    m_lKey2Commands = rCopy.m_lKey2Commands;
-}
-
-void AcceleratorCache::takeOver(const AcceleratorCache& rCopy)
-{
-    SolarMutexGuard g;
-    m_lCommand2Keys = rCopy.m_lCommand2Keys;
-    m_lKey2Commands = rCopy.m_lKey2Commands;
-}
-
-AcceleratorCache& AcceleratorCache::operator=(const AcceleratorCache& rCopy)
-{
-    takeOver(rCopy);
-    return *this;
-}
-
 bool AcceleratorCache::hasKey(const css::awt::KeyEvent& aKey) const
 {
     SolarMutexGuard g;
diff --git a/framework/source/accelerators/acceleratorconfiguration.cxx b/framework/source/accelerators/acceleratorconfiguration.cxx
index 596e5e2937c6..f828aaa34dbb 100644
--- a/framework/source/accelerators/acceleratorconfiguration.cxx
+++ b/framework/source/accelerators/acceleratorconfiguration.cxx
@@ -17,6 +17,10 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include <sal/config.h>
+
+#include <utility>
+
 #include <accelerators/acceleratorconfiguration.hxx>
 #include <accelerators/keymapping.hxx>
 #include <accelerators/presethandler.hxx>
@@ -410,9 +414,9 @@ void XMLBasedAcceleratorConfiguration::impl_ts_save(const css::uno::Reference< c
         SolarMutexGuard g;
         bChanged = (m_pWriteCache != nullptr);
         if (bChanged)
-            aCache.takeOver(*m_pWriteCache);
+            aCache = *m_pWriteCache;
         else
-            aCache.takeOver(m_aReadCache);
+            aCache = m_aReadCache;
         xContext = m_xContext;
     }
 
@@ -438,7 +442,7 @@ void XMLBasedAcceleratorConfiguration::impl_ts_save(const css::uno::Reference< c
     // and forget the copy-on-write copied cache
     if (bChanged)
     {
-        m_aReadCache.takeOver(*m_pWriteCache);
+        m_aReadCache = *m_pWriteCache;
         m_pWriteCache.reset();
     }
 }
@@ -800,9 +804,9 @@ void SAL_CALL XCUBasedAcceleratorConfiguration::storeToStorage(const css::uno::R
         SolarMutexGuard g;
 
         if (m_pPrimaryWriteCache != nullptr)
-            aCache.takeOver(*m_pPrimaryWriteCache);
+            aCache = *m_pPrimaryWriteCache;
         else
-            aCache.takeOver(m_aPrimaryReadCache);
+            aCache = m_aPrimaryReadCache;
 
         AcceleratorCache::TKeyList lKeys;
         if (m_pSecondaryWriteCache!=nullptr)
@@ -1055,9 +1059,9 @@ void XCUBasedAcceleratorConfiguration::impl_ts_load( bool bPreferred, const css:
     }
 
     if (bPreferred)
-        m_aPrimaryReadCache.takeOver(aReadCache);
+        m_aPrimaryReadCache = std::move(aReadCache);
     else
-        m_aSecondaryReadCache.takeOver(aReadCache);
+        m_aSecondaryReadCache = std::move(aReadCache);
 }
 
 void XCUBasedAcceleratorConfiguration::impl_ts_save(bool bPreferred)
@@ -1093,7 +1097,7 @@ void XCUBasedAcceleratorConfiguration::impl_ts_save(bool bPreferred)
         // coverity[check_after_deref] - confusing but correct
         if (m_pPrimaryWriteCache)
         {
-            m_aPrimaryReadCache.takeOver(*m_pPrimaryWriteCache);
+            m_aPrimaryReadCache = *m_pPrimaryWriteCache;
             m_pPrimaryWriteCache.reset();
         }
     }
@@ -1129,7 +1133,7 @@ void XCUBasedAcceleratorConfiguration::impl_ts_save(bool bPreferred)
         // coverity[check_after_deref] - confusing but correct
         if (m_pSecondaryWriteCache)
         {
-            m_aSecondaryReadCache.takeOver(*m_pSecondaryWriteCache);
+            m_aSecondaryReadCache = *m_pSecondaryWriteCache;
             m_pSecondaryWriteCache.reset();
         }
     }
diff --git a/framework/source/inc/accelerators/acceleratorcache.hxx b/framework/source/inc/accelerators/acceleratorcache.hxx
index fc295ae004dc..83ba071fd5db 100644
--- a/framework/source/inc/accelerators/acceleratorcache.hxx
+++ b/framework/source/inc/accelerators/acceleratorcache.hxx
@@ -76,26 +76,6 @@ class AcceleratorCache
     // interface
 
     public:
-
-        /** @short  creates a new - but empty - cache instance. */
-        AcceleratorCache();
-
-        /** @short  make a copy of this cache.
-            @descr  Used for the copy-on-write feature.
-        */
-        AcceleratorCache(const AcceleratorCache& rCopy);
-
-        /** @short  write changes back to the original container.
-
-            @param  rCopy
-                    the (changed!) copy, which should be written
-                    back to this original container.
-          */
-        void takeOver(const AcceleratorCache& rCopy);
-
-        /** TODO document me */
-        AcceleratorCache& operator=(const AcceleratorCache& rCopy);
-
         /** @short  checks if the specified key exists.
 
             @param  aKey


More information about the Libreoffice-commits mailing list