[Libreoffice-commits] online.git: loolwsd/ChildProcessSession.cpp loolwsd/ChildProcessSession.hpp loolwsd/LOOLKit.cpp

Ashod Nakashian ashod.nakashian at collabora.co.uk
Mon Jan 11 20:34:00 PST 2016


 loolwsd/ChildProcessSession.cpp |   42 ++++++++++++++++++++--------------------
 loolwsd/ChildProcessSession.hpp |    2 -
 loolwsd/LOOLKit.cpp             |    2 -
 3 files changed, 23 insertions(+), 23 deletions(-)

New commits:
commit 37a4d8ec10aa1f315070be78fab89274532e2602
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date:   Mon Jan 11 22:31:25 2016 -0500

    loolwsd: uniqueLock -> lock, lock() -> getLock()
    
    Change-Id: I3ea58a1ee0f8c0d7a153b78a2a03104d07416760
    Reviewed-on: https://gerrit.libreoffice.org/21377
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
    Tested-by: Ashod Nakashian <ashnakash at gmail.com>

diff --git a/loolwsd/ChildProcessSession.cpp b/loolwsd/ChildProcessSession.cpp
index fdea822..ac2ed50 100644
--- a/loolwsd/ChildProcessSession.cpp
+++ b/loolwsd/ChildProcessSession.cpp
@@ -63,7 +63,7 @@ ChildProcessSession::~ChildProcessSession()
 {
     Log::info("~ChildProcessSession dtor [" + getName() + "].");
 
-    std::unique_lock<std::mutex> uniqueLock(_mutex);
+    std::unique_lock<std::mutex> lock(_mutex);
 
     if (_multiView)
         _loKitDocument->pClass->setView(_loKitDocument, _viewId);
@@ -145,7 +145,7 @@ bool ChildProcessSession::_handleInput(const char *buffer, int length)
                tokens[0] == "saveas");
 
         {
-            std::unique_lock<std::mutex> uniqueLock(_mutex);
+            std::unique_lock<std::mutex> lock(_mutex);
 
             if (_multiView)
                 _loKitDocument->pClass->setView(_loKitDocument, _viewId);
@@ -233,7 +233,7 @@ bool ChildProcessSession::loadDocument(const char * /*buffer*/, int /*length*/,
 
     _loKitDocument = _onLoad(getId(), _jailedFilePath);
 
-    std::unique_lock<std::mutex> uniqueLock(_mutex);
+    std::unique_lock<std::mutex> lock(_mutex);
 
     if (_multiView)
         _viewId = _loKitDocument->pClass->getView(_loKitDocument);
@@ -274,7 +274,7 @@ void ChildProcessSession::sendFontRendering(const char* /*buffer*/, int /*length
         return;
     }
 
-    std::unique_lock<std::mutex> uniqueLock(_mutex);
+    std::unique_lock<std::mutex> lock(_mutex);
 
     if (_multiView)
        _loKitDocument->pClass->setView(_loKitDocument, _viewId);
@@ -307,7 +307,7 @@ void ChildProcessSession::sendFontRendering(const char* /*buffer*/, int /*length
 
 bool ChildProcessSession::getStatus(const char* buffer, int length)
 {
-    std::unique_lock<std::mutex> uniqueLock(_mutex);
+    std::unique_lock<std::mutex> lock(_mutex);
 
     if (_multiView)
         _loKitDocument->pClass->setView(_loKitDocument, _viewId);
@@ -339,7 +339,7 @@ bool ChildProcessSession::getCommandValues(const char* /*buffer*/, int /*length*
         return false;
     }
 
-    std::unique_lock<std::mutex> uniqueLock(_mutex);
+    std::unique_lock<std::mutex> lock(_mutex);
 
     if (_multiView)
         _loKitDocument->pClass->setView(_loKitDocument, _viewId);
@@ -350,7 +350,7 @@ bool ChildProcessSession::getCommandValues(const char* /*buffer*/, int /*length*
 
 bool ChildProcessSession::getPartPageRectangles(const char* /*buffer*/, int /*length*/)
 {
-    std::unique_lock<std::mutex> uniqueLock(_mutex);
+    std::unique_lock<std::mutex> lock(_mutex);
 
     if (_multiView)
         _loKitDocument->pClass->setView(_loKitDocument, _viewId);
@@ -388,7 +388,7 @@ void ChildProcessSession::sendTile(const char* /*buffer*/, int /*length*/, Strin
         return;
     }
 
-    std::unique_lock<std::mutex> uniqueLock(_mutex);
+    std::unique_lock<std::mutex> lock(_mutex);
 
     if (_multiView)
         _loKitDocument->pClass->setView(_loKitDocument, _viewId);
@@ -437,7 +437,7 @@ bool ChildProcessSession::clientZoom(const char* /*buffer*/, int /*length*/, Str
         return false;
     }
 
-    std::unique_lock<std::mutex> uniqueLock(_mutex);
+    std::unique_lock<std::mutex> lock(_mutex);
 
     if (_multiView)
         _loKitDocument->pClass->setView(_loKitDocument, _viewId);
@@ -471,7 +471,7 @@ bool ChildProcessSession::downloadAs(const char* /*buffer*/, int /*length*/, Str
     const auto tmpDir = Util::createRandomDir(JailedDocumentRoot);
     const auto url = JailedDocumentRoot + tmpDir + "/" + name;
 
-    std::unique_lock<std::mutex> uniqueLock(_mutex);
+    std::unique_lock<std::mutex> lock(_mutex);
 
     //TODO: Cleanup the file after downloading.
     _loKitDocument->pClass->saveAs(_loKitDocument, url.c_str(),
@@ -500,7 +500,7 @@ bool ChildProcessSession::getTextSelection(const char* /*buffer*/, int /*length*
         return false;
     }
 
-    std::unique_lock<std::mutex> uniqueLock(_mutex);
+    std::unique_lock<std::mutex> lock(_mutex);
 
     if (_multiView)
         _loKitDocument->pClass->setView(_loKitDocument, _viewId);
@@ -524,7 +524,7 @@ bool ChildProcessSession::paste(const char* /*buffer*/, int /*length*/, StringTo
 
     data = Poco::cat(std::string(" "), tokens.begin() + 2, tokens.end()).substr(strlen("data="));
 
-    std::unique_lock<std::mutex> uniqueLock(_mutex);
+    std::unique_lock<std::mutex> lock(_mutex);
 
     if (_multiView)
         _loKitDocument->pClass->setView(_loKitDocument, _viewId);
@@ -546,7 +546,7 @@ bool ChildProcessSession::insertFile(const char* /*buffer*/, int /*length*/, Str
         return false;
     }
 
-    std::unique_lock<std::mutex> uniqueLock(_mutex);
+    std::unique_lock<std::mutex> lock(_mutex);
 
     if (type == "graphic")
     {
@@ -587,7 +587,7 @@ bool ChildProcessSession::keyEvent(const char* /*buffer*/, int /*length*/, Strin
     if (keycode == (KEY_CTRL | KEY_W))
         return true;
 
-    std::unique_lock<std::mutex> uniqueLock(_mutex);
+    std::unique_lock<std::mutex> lock(_mutex);
 
     if (_multiView)
         _loKitDocument->pClass->setView(_loKitDocument, _viewId);
@@ -617,7 +617,7 @@ bool ChildProcessSession::mouseEvent(const char* /*buffer*/, int /*length*/, Str
         return false;
     }
 
-    std::unique_lock<std::mutex> uniqueLock(_mutex);
+    std::unique_lock<std::mutex> lock(_mutex);
 
     if (_multiView)
         _loKitDocument->pClass->setView(_loKitDocument, _viewId);
@@ -635,7 +635,7 @@ bool ChildProcessSession::unoCommand(const char* /*buffer*/, int /*length*/, Str
         return false;
     }
 
-    std::unique_lock<std::mutex> uniqueLock(_mutex);
+    std::unique_lock<std::mutex> lock(_mutex);
 
     if (_multiView)
         _loKitDocument->pClass->setView(_loKitDocument, _viewId);
@@ -672,7 +672,7 @@ bool ChildProcessSession::selectText(const char* /*buffer*/, int /*length*/, Str
         return false;
     }
 
-    std::unique_lock<std::mutex> uniqueLock(_mutex);
+    std::unique_lock<std::mutex> lock(_mutex);
 
     if (_multiView)
         _loKitDocument->pClass->setView(_loKitDocument, _viewId);
@@ -698,7 +698,7 @@ bool ChildProcessSession::selectGraphic(const char* /*buffer*/, int /*length*/,
         return false;
     }
 
-    std::unique_lock<std::mutex> uniqueLock(_mutex);
+    std::unique_lock<std::mutex> lock(_mutex);
 
     if (_multiView)
         _loKitDocument->pClass->setView(_loKitDocument, _viewId);
@@ -716,7 +716,7 @@ bool ChildProcessSession::resetSelection(const char* /*buffer*/, int /*length*/,
         return false;
     }
 
-    std::unique_lock<std::mutex> uniqueLock(_mutex);
+    std::unique_lock<std::mutex> lock(_mutex);
 
     if (_multiView)
         _loKitDocument->pClass->setView(_loKitDocument, _viewId);
@@ -747,7 +747,7 @@ bool ChildProcessSession::saveAs(const char* /*buffer*/, int /*length*/, StringT
         }
     }
 
-    std::unique_lock<std::mutex> uniqueLock(_mutex);
+    std::unique_lock<std::mutex> lock(_mutex);
 
     if (_multiView)
         _loKitDocument->pClass->setView(_loKitDocument, _viewId);
@@ -785,7 +785,7 @@ bool ChildProcessSession::setPage(const char* /*buffer*/, int /*length*/, String
         return false;
     }
 
-    std::unique_lock<std::mutex> uniqueLock(_mutex);
+    std::unique_lock<std::mutex> lock(_mutex);
 
     if (_multiView)
         _loKitDocument->pClass->setView(_loKitDocument, _viewId);
diff --git a/loolwsd/ChildProcessSession.hpp b/loolwsd/ChildProcessSession.hpp
index 7642399..58eb49e 100644
--- a/loolwsd/ChildProcessSession.hpp
+++ b/loolwsd/ChildProcessSession.hpp
@@ -52,7 +52,7 @@ public:
 
     LibreOfficeKitDocument *getLoKitDocument() const { return _loKitDocument; }
 
-    std::unique_lock<std::mutex> lock() { return std::unique_lock<std::mutex>(_mutex); }
+    std::unique_lock<std::mutex> getLock() { return std::unique_lock<std::mutex>(_mutex); }
 
  protected:
     virtual bool loadDocument(const char *buffer, int length, Poco::StringTokenizer& tokens) override;
diff --git a/loolwsd/LOOLKit.cpp b/loolwsd/LOOLKit.cpp
index 6f4d2e1..7565556 100644
--- a/loolwsd/LOOLKit.cpp
+++ b/loolwsd/LOOLKit.cpp
@@ -139,7 +139,7 @@ public:
 
     void callback(const int nType, const std::string& rPayload, std::shared_ptr<ChildProcessSession> pSession)
     {
-        auto lock = pSession->lock();
+        auto lock = pSession->getLock();
 
         Log::trace() << "Callback [" << pSession->getViewId() << "] "
                      << callbackTypeToString(nType)


More information about the Libreoffice-commits mailing list