[Libreoffice-commits] online.git: loolwsd/LOOLWSD.cpp loolwsd/LOOLWSD.hpp loolwsd/MasterProcessSession.cpp

Ashod Nakashian ashod.nakashian at collabora.co.uk
Thu Jan 14 05:40:01 PST 2016


 loolwsd/LOOLWSD.cpp              |    4 ++--
 loolwsd/LOOLWSD.hpp              |   28 ++++++++++++++--------------
 loolwsd/MasterProcessSession.cpp |    2 +-
 3 files changed, 17 insertions(+), 17 deletions(-)

New commits:
commit 3d803dd9b03b7858f69e2bd2e6cb4d3a4722e83d
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date:   Tue Jan 12 18:11:04 2016 -0500

    loolwsd: Document -> DocumentURI
    
    Change-Id: I7e5989dbee368314a4db7c723439060f1064e844
    Reviewed-on: https://gerrit.libreoffice.org/21469
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
    Tested-by: Ashod Nakashian <ashnakash at gmail.com>

diff --git a/loolwsd/LOOLWSD.cpp b/loolwsd/LOOLWSD.cpp
index 6435958..3e7ee14 100644
--- a/loolwsd/LOOLWSD.cpp
+++ b/loolwsd/LOOLWSD.cpp
@@ -152,8 +152,8 @@ using Poco::ProcessHandle;
 using Poco::URI;
 
 // Document management mutex.
-std::mutex Document::DocumentsMutex;
-std::map<std::string, std::shared_ptr<Document>> Document::UriToDocumentMap;
+std::mutex DocumentURI::DocumentURIMutex;
+std::map<std::string, std::shared_ptr<DocumentURI>> DocumentURI::UriToDocumentURIMap;
 
 /// Handles the filename part of the convert-to POST request payload.
 class ConvertToPartHandler : public Poco::Net::PartHandler
diff --git a/loolwsd/LOOLWSD.hpp b/loolwsd/LOOLWSD.hpp
index 50bde75..c520e1d 100644
--- a/loolwsd/LOOLWSD.hpp
+++ b/loolwsd/LOOLWSD.hpp
@@ -26,14 +26,14 @@
 #include "Common.hpp"
 #include "Util.hpp"
 
-// A Document as mananged by us.
+// A DocumentURI as mananged by us.
 // Contains URI, physical path, etc.
-class Document
+class DocumentURI
 {
 public:
 
     static
-    std::shared_ptr<Document> create(const std::string& url,
+    std::shared_ptr<DocumentURI> create(const std::string& url,
                                      const std::string& jailRoot,
                                      const std::string& childId)
     {
@@ -48,13 +48,13 @@ public:
 
         // This lock could become a bottleneck.
         // In that case, we can use a pool and index by publicPath.
-        std::unique_lock<std::mutex> lock(DocumentsMutex);
+        std::unique_lock<std::mutex> lock(DocumentURIMutex);
 
         // Find the document if already open.
-        auto it = UriToDocumentMap.lower_bound(publicFilePath);
-        if (it != UriToDocumentMap.end() && it->first == publicFilePath)
+        auto it = UriToDocumentURIMap.lower_bound(publicFilePath);
+        if (it != UriToDocumentURIMap.end() && it->first == publicFilePath)
         {
-            Log::info("Document [" + it->first + "] found.");
+            Log::info("DocumentURI [" + it->first + "] found.");
             return it->second;
         }
 
@@ -111,10 +111,10 @@ public:
                       "] is not a file.");
         }
 
-        auto document = std::shared_ptr<Document>(new Document(uriPublic, uriJailed, childId));
+        auto document = std::shared_ptr<DocumentURI>(new DocumentURI(uriPublic, uriJailed, childId));
 
-        Log::info("Document [" + publicFilePath + "] created.");
-        it = UriToDocumentMap.emplace_hint(it, publicFilePath, document);
+        Log::info("DocumentURI [" + publicFilePath + "] created.");
+        it = UriToDocumentURIMap.emplace_hint(it, publicFilePath, document);
         return it->second;
     }
 
@@ -123,7 +123,7 @@ public:
     std::string getChildId() const { return _childId; }
 
 private:
-    Document(const Poco::URI& uriPublic,
+    DocumentURI(const Poco::URI& uriPublic,
              const Poco::URI& uriJailed,
              const std::string& childId) :
        _uriPublic(uriPublic),
@@ -134,9 +134,9 @@ private:
 
 private:
 
-    // Document management mutex.
-    static std::mutex DocumentsMutex;
-    static std::map<std::string, std::shared_ptr<Document>> UriToDocumentMap;
+    // DocumentURI management mutex.
+    static std::mutex DocumentURIMutex;
+    static std::map<std::string, std::shared_ptr<DocumentURI>> UriToDocumentURIMap;
 
 private:
     const Poco::URI _uriPublic;
diff --git a/loolwsd/MasterProcessSession.cpp b/loolwsd/MasterProcessSession.cpp
index 32a3098..1c2ca83 100644
--- a/loolwsd/MasterProcessSession.cpp
+++ b/loolwsd/MasterProcessSession.cpp
@@ -634,7 +634,7 @@ void MasterProcessSession::dispatchChild()
     const auto jailRoot = Poco::Path(LOOLWSD::childRoot, LOOLWSD::jailId);
     const auto childId = std::to_string(childSession->_pidChild);
 
-    auto document = Document::create(_docURL, jailRoot.toString(), childId);
+    auto document = DocumentURI::create(_docURL, jailRoot.toString(), childId);
 
     _peer = childSession;
     childSession->_peer = shared_from_this();


More information about the Libreoffice-commits mailing list