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

Miklos Vajna vmiklos at collabora.co.uk
Tue Apr 11 06:54:47 UTC 2017


 wsd/DocumentBroker.cpp |    8 ++++----
 wsd/DocumentBroker.hpp |    8 ++++----
 2 files changed, 8 insertions(+), 8 deletions(-)

New commits:
commit 8a1f321c8492d6c2824317c7e4be1a3bdfa81665
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Tue Apr 11 08:54:09 2017 +0200

    DocumentBroker: avoid unnecessary copying
    
    Change-Id: Iaa555ed8e347d0e1712c617839f007d0b4f3204b

diff --git a/wsd/DocumentBroker.cpp b/wsd/DocumentBroker.cpp
index 33f88ef7..e041db70 100644
--- a/wsd/DocumentBroker.cpp
+++ b/wsd/DocumentBroker.cpp
@@ -522,7 +522,7 @@ bool DocumentBroker::load(const std::shared_ptr<ClientSession>& session, const s
     return true;
 }
 
-bool DocumentBroker::saveToStorage(const std::string sessionId,
+bool DocumentBroker::saveToStorage(const std::string& sessionId,
                                    bool success, const std::string& result)
 {
     assertCorrectThread();
@@ -823,7 +823,7 @@ size_t DocumentBroker::addSession(const std::shared_ptr<ClientSession>& session)
     return count;
 }
 
-size_t DocumentBroker::removeSession(const std::string id, bool destroyIfLast)
+size_t DocumentBroker::removeSession(const std::string& id, bool destroyIfLast)
 {
     assertCorrectThread();
 
@@ -846,7 +846,7 @@ size_t DocumentBroker::removeSession(const std::string id, bool destroyIfLast)
     return _sessions.size();
 }
 
-size_t DocumentBroker::removeSessionInternal(const std::string id)
+size_t DocumentBroker::removeSessionInternal(const std::string& id)
 {
     assertCorrectThread();
     try
@@ -894,7 +894,7 @@ size_t DocumentBroker::removeSessionInternal(const std::string id)
     return _sessions.size();
 }
 
-void DocumentBroker::addCallback(SocketPoll::CallbackFn fn)
+void DocumentBroker::addCallback(const SocketPoll::CallbackFn& fn)
 {
     _poll->addCallback(fn);
 }
diff --git a/wsd/DocumentBroker.hpp b/wsd/DocumentBroker.hpp
index 20bdc496..62cb6a95 100644
--- a/wsd/DocumentBroker.hpp
+++ b/wsd/DocumentBroker.hpp
@@ -233,7 +233,7 @@ public:
     void setLoaded();
 
     /// Save the document to Storage if it needs persisting.
-    bool saveToStorage(const std::string sesionId, bool success, const std::string& result = "");
+    bool saveToStorage(const std::string& sesionId, bool success, const std::string& result = "");
     bool isModified() const { return _isModified; }
     void setModified(const bool value);
 
@@ -265,10 +265,10 @@ public:
     size_t addSession(const std::shared_ptr<ClientSession>& session);
 
     /// Removes a session by ID. Returns the new number of sessions.
-    size_t removeSession(const std::string id, bool destroyIfLast = false);
+    size_t removeSession(const std::string& id, bool destroyIfLast = false);
 
     /// Add a callback to be invoked in our polling thread.
-    void addCallback(SocketPoll::CallbackFn fn);
+    void addCallback(const SocketPoll::CallbackFn& fn);
 
     /// Transfer this socket into our polling thread / loop.
     void addSocketToPoll(const std::shared_ptr<Socket>& socket);
@@ -342,7 +342,7 @@ private:
     bool saveToStorageInternal(const std::string& sesionId, bool success, const std::string& result = "");
 
     /// Removes a session by ID. Returns the new number of sessions.
-    size_t removeSessionInternal(const std::string id);
+    size_t removeSessionInternal(const std::string& id);
 
     /// Forward a message from child session to its respective client session.
     bool forwardToClient(const std::shared_ptr<Message>& payload);


More information about the Libreoffice-commits mailing list