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

Ashod Nakashian (via logerrit) logerrit at kemper.freedesktop.org
Tue Jun 23 04:43:56 UTC 2020


 wsd/AdminModel.hpp |   72 +++++++++++++++++++++++++----------------------------
 1 file changed, 35 insertions(+), 37 deletions(-)

New commits:
commit fa749d0a355ec3b0a2437d8cfc663e4ab2a3e0e9
Author:     Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Wed Jun 3 10:46:23 2020 -0400
Commit:     Ashod Nakashian <ashnakash at gmail.com>
CommitDate: Tue Jun 23 06:43:38 2020 +0200

    wsd: std::move rather than copy
    
    Change-Id: Ie5e3f711d4cda686408624f849f3f7d7dfb549b8
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/96380
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Tested-by: Jenkins
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>

diff --git a/wsd/AdminModel.hpp b/wsd/AdminModel.hpp
index 0a038ad20..43da0cd1d 100644
--- a/wsd/AdminModel.hpp
+++ b/wsd/AdminModel.hpp
@@ -25,12 +25,12 @@ struct DocumentAggregateStats;
 class View
 {
 public:
-    View(const std::string& sessionId, const std::string& userName, const std::string& userId) :
-        _sessionId(sessionId),
-        _userName(userName),
-        _userId(userId),
-        _start(std::time(nullptr)),
-        _loadDuration(0)
+    View(std::string sessionId, std::string userName, std::string userId)
+        : _sessionId(std::move(sessionId))
+        , _userName(std::move(userName))
+        , _userId(std::move(userId))
+        , _start(std::time(nullptr))
+        , _loadDuration(0)
     {
     }
 
@@ -106,11 +106,11 @@ class DocBasicInfo
     bool _saved;
 
 public:
-    DocBasicInfo(const std::string& docKey, std::time_t idleTime, int mem, bool saved) :
-        _docKey(docKey),
-        _idleTime(idleTime),
-        _mem(mem),
-        _saved(saved)
+    DocBasicInfo(std::string docKey, std::time_t idleTime, int mem, bool saved)
+        : _docKey(std::move(docKey))
+        , _idleTime(idleTime)
+        , _mem(mem)
+        , _saved(saved)
     {
     }
 
@@ -131,29 +131,27 @@ class Document
     Document& operator = (const Document &) = delete;
 
 public:
-    Document(const std::string& docKey,
-             pid_t pid,
-             const std::string& filename)
-        : _docKey(docKey),
-          _pid(pid),
-          _activeViews(0),
-          _filename(filename),
-          _memoryDirty(0),
-          _lastJiffy(0),
-          _lastCpuPercentage(0),
-          _start(std::time(nullptr)),
-          _lastActivity(_start),
-          _end(0),
-          _sentBytes(0),
-          _recvBytes(0),
-          _wopiDownloadDuration(0),
-          _wopiUploadDuration(0),
-          _procSMaps(nullptr),
-          _lastTimeSMapsRead(0),
-          _isModified(false),
-          _hasMemDirtyChanged(true),
-          _badBehaviorDetectionTime(0),
-          _abortTime(0)
+    Document(std::string docKey, pid_t pid, std::string filename)
+        : _docKey(std::move(docKey))
+        , _pid(pid)
+        , _activeViews(0)
+        , _filename(std::move(filename))
+        , _memoryDirty(0)
+        , _lastJiffy(0)
+        , _lastCpuPercentage(0)
+        , _start(std::time(nullptr))
+        , _lastActivity(_start)
+        , _end(0)
+        , _sentBytes(0)
+        , _recvBytes(0)
+        , _wopiDownloadDuration(0)
+        , _wopiUploadDuration(0)
+        , _procSMaps(nullptr)
+        , _lastTimeSMapsRead(0)
+        , _isModified(false)
+        , _hasMemDirtyChanged(true)
+        , _badBehaviorDetectionTime(0)
+        , _abortTime(0)
     {
     }
 
@@ -264,9 +262,9 @@ private:
 class Subscriber
 {
 public:
-    Subscriber(const std::weak_ptr<WebSocketHandler>& ws)
-        : _ws(ws),
-          _start(std::time(nullptr))
+    explicit Subscriber(std::weak_ptr<WebSocketHandler> ws)
+        : _ws(std::move(ws))
+        , _start(std::time(nullptr))
     {
         LOG_INF("Subscriber ctor.");
     }


More information about the Libreoffice-commits mailing list