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

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Thu Aug 5 20:29:40 UTC 2021


 ucb/source/ucp/tdoc/tdoc_docmgr.cxx |   26 +++++++++++++-------------
 ucb/source/ucp/tdoc/tdoc_docmgr.hxx |    8 ++++----
 2 files changed, 17 insertions(+), 17 deletions(-)

New commits:
commit dfed833ff3ef1532b18745df5ac0909d4e09028e
Author:     Noel Grandin <noelgrandin at gmail.com>
AuthorDate: Thu Aug 5 20:28:45 2021 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Thu Aug 5 22:29:06 2021 +0200

    osl::Mutex->std::mutex in OfficeDocumentsManager
    
    Change-Id: I4de3e5ea25614bb032d68476c76f32d03d6e40b7
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120084
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/ucb/source/ucp/tdoc/tdoc_docmgr.cxx b/ucb/source/ucp/tdoc/tdoc_docmgr.cxx
index af66cb8a4b25..2f0602d23dc4 100644
--- a/ucb/source/ucp/tdoc/tdoc_docmgr.cxx
+++ b/ucb/source/ucp/tdoc/tdoc_docmgr.cxx
@@ -178,7 +178,7 @@ void SAL_CALL OfficeDocumentsManager::documentEventOccured(
             bool found(false);
 
             {
-                osl::MutexGuard aGuard( m_aMtx );
+                std::scoped_lock aGuard( m_aMtx );
 
                 found = std::any_of(m_aDocs.begin(), m_aDocs.end(),
                     [&xModel](const DocumentList::value_type& rEntry) { return rEntry.second.xModel == xModel; });
@@ -204,7 +204,7 @@ void SAL_CALL OfficeDocumentsManager::documentEventOccured(
                     uno::Reference< frame::XModel >( Event.Source, uno::UNO_QUERY ) );
 
                 {
-                    osl::MutexGuard g(m_aMtx);
+                    std::scoped_lock g(m_aMtx);
                     m_aDocs[ aDocId ] = StorageInfo( aTitle, xStorage, xModel );
                 }
 
@@ -245,7 +245,7 @@ void SAL_CALL OfficeDocumentsManager::documentEventOccured(
             OUString aDocId;
 
             {
-                osl::MutexGuard aGuard( m_aMtx );
+                std::scoped_lock aGuard( m_aMtx );
 
                 auto it = std::find_if(m_aDocs.begin(), m_aDocs.end(),
                     [&xModel](const DocumentList::value_type& rEntry) { return rEntry.second.xModel == xModel; });
@@ -295,7 +295,7 @@ void SAL_CALL OfficeDocumentsManager::documentEventOccured(
                  xModel( Event.Source, uno::UNO_QUERY );
             OSL_ENSURE( xModel.is(), "Got no frame::XModel!" );
 
-            osl::MutexGuard aGuard( m_aMtx );
+            std::scoped_lock aGuard( m_aMtx );
 
             DocumentList::iterator it = std::find_if(m_aDocs.begin(), m_aDocs.end(),
                 [&xModel](const DocumentList::value_type& rEntry) { return rEntry.second.xModel == xModel; });
@@ -327,7 +327,7 @@ void SAL_CALL OfficeDocumentsManager::documentEventOccured(
 
             OUString const title(comphelper::DocumentInfo::getDocumentTitle(xModel));
 
-            osl::MutexGuard aGuard( m_aMtx );
+            std::scoped_lock aGuard( m_aMtx );
 
             DocumentList::iterator it = std::find_if(m_aDocs.begin(), m_aDocs.end(),
                 [&xModel](const DocumentList::value_type& rEntry) { return rEntry.second.xModel == xModel; });
@@ -365,7 +365,7 @@ void SAL_CALL OfficeDocumentsManager::documentEventOccured(
 
             OUString const aDocId(getDocumentId(Event.Source));
 
-            osl::MutexGuard aGuard( m_aMtx );
+            std::scoped_lock aGuard( m_aMtx );
 
             DocumentList::iterator it = std::find_if(m_aDocs.begin(), m_aDocs.end(),
                 [&xModel](const DocumentList::value_type& rEntry) { return rEntry.second.xModel == xModel; });
@@ -424,7 +424,7 @@ void OfficeDocumentsManager::buildDocumentsList()
                     bool found(false);
 
                     {
-                        osl::MutexGuard aGuard( m_aMtx );
+                        std::scoped_lock aGuard( m_aMtx );
 
                         found = std::any_of(m_aDocs.begin(), m_aDocs.end(),
                             [&xModel](const DocumentList::value_type& rEntry) { return rEntry.second.xModel == xModel; });
@@ -446,7 +446,7 @@ void OfficeDocumentsManager::buildDocumentsList()
                         OSL_ENSURE( xStorage.is(), "Got no document storage!" );
 
                         {
-                            osl::MutexGuard aGuard( m_aMtx );
+                            std::scoped_lock aGuard( m_aMtx );
                             m_aDocs[ aDocId ]
                                 = StorageInfo( aTitle, xStorage, xModel );
                         }
@@ -478,7 +478,7 @@ void OfficeDocumentsManager::buildDocumentsList()
 uno::Reference< embed::XStorage >
 OfficeDocumentsManager::queryStorage( const OUString & rDocId )
 {
-    osl::MutexGuard aGuard( m_aMtx );
+    std::scoped_lock aGuard( m_aMtx );
 
     DocumentList::const_iterator it = m_aDocs.find( rDocId );
     if ( it == m_aDocs.end() )
@@ -498,7 +498,7 @@ OUString OfficeDocumentsManager::queryDocumentId(
 uno::Reference< frame::XModel >
 OfficeDocumentsManager::queryDocumentModel( const OUString & rDocId )
 {
-    osl::MutexGuard aGuard( m_aMtx );
+    std::scoped_lock aGuard( m_aMtx );
 
     DocumentList::const_iterator it = m_aDocs.find( rDocId );
     if ( it == m_aDocs.end() )
@@ -510,7 +510,7 @@ OfficeDocumentsManager::queryDocumentModel( const OUString & rDocId )
 
 uno::Sequence< OUString > OfficeDocumentsManager::queryDocuments()
 {
-    osl::MutexGuard aGuard( m_aMtx );
+    std::scoped_lock aGuard( m_aMtx );
 
     return comphelper::mapKeysToSequence( m_aDocs );
 }
@@ -519,7 +519,7 @@ uno::Sequence< OUString > OfficeDocumentsManager::queryDocuments()
 OUString
 OfficeDocumentsManager::queryStorageTitle( const OUString & rDocId )
 {
-    osl::MutexGuard aGuard( m_aMtx );
+    std::scoped_lock aGuard( m_aMtx );
 
     DocumentList::const_iterator it = m_aDocs.find( rDocId );
     if ( it == m_aDocs.end() )
@@ -585,7 +585,7 @@ bool OfficeDocumentsManager::isBasicIDE(
 {
     if ( !m_xModuleMgr.is() )
     {
-        osl::MutexGuard aGuard( m_aMtx );
+        std::scoped_lock aGuard( m_aMtx );
         if ( !m_xModuleMgr.is() )
         {
             try
diff --git a/ucb/source/ucp/tdoc/tdoc_docmgr.hxx b/ucb/source/ucp/tdoc/tdoc_docmgr.hxx
index 2304a9bef853..37839f985971 100644
--- a/ucb/source/ucp/tdoc/tdoc_docmgr.hxx
+++ b/ucb/source/ucp/tdoc/tdoc_docmgr.hxx
@@ -19,10 +19,7 @@
 
 #pragma once
 
-#include <map>
-
 #include <rtl/ref.hxx>
-#include <osl/mutex.hxx>
 
 #include <cppuhelper/implbase.hxx>
 
@@ -34,6 +31,9 @@
 #include <com/sun/star/uno/XComponentContext.hpp>
 #include <com/sun/star/util/XCloseListener.hpp>
 
+#include <map>
+#include <mutex>
+
 namespace tdoc_ucp {
 
     class ContentProvider;
@@ -137,7 +137,7 @@ namespace tdoc_ucp {
         static bool isHelpDocument(
             const css::uno::Reference< css::frame::XModel > & xModel );
 
-        osl::Mutex                                          m_aMtx;
+        std::mutex                                          m_aMtx;
         css::uno::Reference< css::uno::XComponentContext >         m_xContext;
         css::uno::Reference< css::frame::XGlobalEventBroadcaster > m_xDocEvtNotifier;
         css::uno::Reference< css::frame::XModuleManager2 >         m_xModuleMgr;


More information about the Libreoffice-commits mailing list