[Libreoffice-commits] online.git: wsd/TraceFile.hpp
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Thu Dec 20 07:55:00 UTC 2018
wsd/TraceFile.hpp | 33 ++++++++++++++++++++-------------
1 file changed, 20 insertions(+), 13 deletions(-)
New commits:
commit bf9a8edcb9c8ed2cb6f267f1425634a43f7604fe
Author: Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Thu Dec 20 08:54:24 2018 +0100
Commit: Miklos Vajna <vmiklos at collabora.com>
CommitDate: Thu Dec 20 08:54:42 2018 +0100
SnapshotData: make members private
Change-Id: Id3ee800cb27f0d536ec1e34a8790aeffa74986af
diff --git a/wsd/TraceFile.hpp b/wsd/TraceFile.hpp
index f6c27eff7..3afd4be5a 100644
--- a/wsd/TraceFile.hpp
+++ b/wsd/TraceFile.hpp
@@ -128,8 +128,8 @@ public:
const auto it = _urlToSnapshot.find(url);
if (it != _urlToSnapshot.end())
{
- snapshot = it->second.Snapshot;
- it->second.SessionCount++;
+ snapshot = it->second.getSnapshot();
+ it->second.getSessionCount()++;
}
else
{
@@ -164,15 +164,15 @@ public:
const auto it = _urlToSnapshot.find(url);
if (it != _urlToSnapshot.end())
{
- snapshot = it->second.Snapshot;
- if (it->second.SessionCount == 1)
+ snapshot = it->second.getSnapshot();
+ if (it->second.getSessionCount() == 1)
{
// Last session, remove the mapping.
_urlToSnapshot.erase(it);
}
else
{
- it->second.SessionCount--;
+ it->second.getSessionCount()--;
}
}
@@ -216,8 +216,8 @@ public:
const auto it = _urlToSnapshot.find(url);
if (it != _urlToSnapshot.end())
{
- LOG_TRC("TraceFile: Mapped URL: " << url << " to " << it->second.Snapshot);
- tokens[1] = "url=" + it->second.Snapshot;
+ LOG_TRC("TraceFile: Mapped URL: " << url << " to " << it->second.getSnapshot());
+ tokens[1] = "url=" + it->second.getSnapshot();
std::string newData;
for (const auto& token : tokens)
{
@@ -304,19 +304,26 @@ private:
struct SnapshotData
{
SnapshotData(const std::string& snapshot) :
- Snapshot(snapshot)
+ _snapshot(snapshot)
{
- SessionCount = 1;
+ _sessionCount = 1;
}
SnapshotData(const SnapshotData& other) :
- Snapshot(other.Snapshot)
+ _snapshot(other.getSnapshot())
{
- SessionCount = other.SessionCount.load();
+ _sessionCount = other.getSessionCount().load();
}
- std::string Snapshot;
- std::atomic<size_t> SessionCount;
+ const std::string& getSnapshot() const { return _snapshot; }
+
+ std::atomic<size_t>& getSessionCount() { return _sessionCount; }
+
+ const std::atomic<size_t>& getSessionCount() const { return _sessionCount; }
+
+ private:
+ std::string _snapshot;
+ std::atomic<size_t> _sessionCount;
};
private:
More information about the Libreoffice-commits
mailing list