[Libreoffice-commits] online.git: kit/Kit.cpp wsd/DocumentBroker.cpp

Ashod Nakashian ashod.nakashian at collabora.co.uk
Mon Jan 16 01:36:18 UTC 2017


 kit/Kit.cpp            |    2 --
 wsd/DocumentBroker.cpp |    9 +++++++--
 2 files changed, 7 insertions(+), 4 deletions(-)

New commits:
commit dea8c03912a10da4b80e12fd71b98e8c5619fee5
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date:   Mon Jan 9 13:54:37 2017 -0500

    wsd: no need to have the lock when notifying
    
    Change-Id: If19aac3d52b45b0b0efc143885b933669d8a1198
    Reviewed-on: https://gerrit.libreoffice.org/33113
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
    Tested-by: Ashod Nakashian <ashnakash at gmail.com>

diff --git a/kit/Kit.cpp b/kit/Kit.cpp
index 4aa58ed..526aaa2 100644
--- a/kit/Kit.cpp
+++ b/kit/Kit.cpp
@@ -917,8 +917,6 @@ private:
             return false;
         }
 
-        // Retake the lock (technically, not needed).
-        lock.lock();
         --_isLoading;
         _cvLoading.notify_one();
 
diff --git a/wsd/DocumentBroker.cpp b/wsd/DocumentBroker.cpp
index 35448fb..e8c08a7 100644
--- a/wsd/DocumentBroker.cpp
+++ b/wsd/DocumentBroker.cpp
@@ -373,6 +373,7 @@ bool DocumentBroker::save(const std::string& sessionId, bool success, const std:
     {
         LOG_DBG("Save skipped as document [" << _docKey << "] was not modified.");
         _lastSaveTime = std::chrono::steady_clock::now();
+        lock.unlock();
         _saveCV.notify_all();
         return true;
     }
@@ -381,6 +382,7 @@ bool DocumentBroker::save(const std::string& sessionId, bool success, const std:
     if (it == _sessions.end())
     {
         LOG_ERR("Session with sessionId [" << sessionId << "] not found while saving docKey [" << _docKey << "].");
+        lock.unlock();
         _saveCV.notify_all();
         return false;
     }
@@ -388,8 +390,8 @@ bool DocumentBroker::save(const std::string& sessionId, bool success, const std:
     const Poco::URI& uriPublic = it->second->getPublicUri();
     const auto uri = uriPublic.toString();
 
-    // If we aren't destroying the last editable session just yet, and the file
-    // timestamp hasn't changed, skip saving.
+    // If we aren't destroying the last editable session just yet,
+    // and the file timestamp hasn't changed, skip saving.
     const auto newFileModifiedTime = Poco::File(_storage->getLocalRootPath()).getLastModified();
     if (!_lastEditableSession && newFileModifiedTime == _lastFileModifiedTime)
     {
@@ -397,6 +399,7 @@ bool DocumentBroker::save(const std::string& sessionId, bool success, const std:
         LOG_DBG("Skipping unnecessary saving to URI [" << uri << "] with docKey [" << _docKey <<
                 "]. File last modified " << _lastFileModifiedTime.elapsed() / 1000000 << " seconds ago.");
         _lastSaveTime = std::chrono::steady_clock::now();
+        lock.unlock();
         _saveCV.notify_all();
         return true;
     }
@@ -435,6 +438,7 @@ bool DocumentBroker::save(const std::string& sessionId, bool success, const std:
         LOG_DBG("Saved docKey [" << _docKey << "] to URI [" << uri << "] and updated tile cache. Document modified timestamp: " <<
                 Poco::DateTimeFormatter::format(Poco::DateTime(_documentLastModifiedTime),
                                                                Poco::DateTimeFormat::ISO8601_FORMAT));
+        lock.unlock();
         _saveCV.notify_all();
         return true;
     }
@@ -457,6 +461,7 @@ bool DocumentBroker::save(const std::string& sessionId, bool success, const std:
         it->second->sendTextFrame("error: cmd=storage kind=savefailed");
     }
 
+    lock.unlock();
     _saveCV.notify_all();
     return false;
 }


More information about the Libreoffice-commits mailing list