[Libreoffice-commits] online.git: 4 commits - loolwsd/ChildProcessSession.cpp loolwsd/ChildProcessSession.hpp loolwsd/LOOLKit.cpp loolwsd/LOOLWSD.cpp loolwsd/MasterProcessSession.cpp loolwsd/MasterProcessSession.hpp loolwsd/Util.hpp
Miklos Vajna
vmiklos at collabora.co.uk
Mon Jan 18 00:44:07 PST 2016
loolwsd/ChildProcessSession.cpp | 44 +++++++++++++++++++--------------------
loolwsd/ChildProcessSession.hpp | 4 +--
loolwsd/LOOLKit.cpp | 8 +++----
loolwsd/LOOLWSD.cpp | 12 +++++-----
loolwsd/MasterProcessSession.cpp | 26 +++++++++++------------
loolwsd/MasterProcessSession.hpp | 8 +++----
loolwsd/Util.hpp | 10 ++++----
7 files changed, 56 insertions(+), 56 deletions(-)
New commits:
commit 3eeecacfb9d8134599e8fba2d984dd951e78a737
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Mon Jan 18 09:43:07 2016 +0100
Document::_callbackQueue -> CallbackQueue
AFAICS this was the last member named not following the coding style.
diff --git a/loolwsd/LOOLKit.cpp b/loolwsd/LOOLKit.cpp
index b0b98bd..c4a5d10 100644
--- a/loolwsd/LOOLKit.cpp
+++ b/loolwsd/LOOLKit.cpp
@@ -455,7 +455,7 @@ public:
_url(url),
_loKitDocument(nullptr),
_clientViews(0),
- _callbackWorker(_callbackQueue)
+ _callbackWorker(CallbackQueue)
{
Log::info("Document ctor for url [" + _url + "] on child [" + _jailId +
"] LOK_VIEW_CALLBACK=" + std::to_string(_multiView) + ".");
@@ -624,7 +624,7 @@ private:
if (session)
{
auto pNotif = new CallBackNotification(nType, pPayload ? pPayload : "(nil)", session);
- _callbackQueue.enqueueNotification(pNotif);
+ CallbackQueue.enqueueNotification(pNotif);
}
}
}
@@ -727,10 +727,10 @@ private:
CallBackWorker _callbackWorker;
Thread _callbackThread;
- static Poco::NotificationQueue _callbackQueue;
+ static Poco::NotificationQueue CallbackQueue;
};
-Poco::NotificationQueue Document::_callbackQueue;
+Poco::NotificationQueue Document::CallbackQueue;
void lokit_main(const std::string &loSubPath, const std::string& jailId, const std::string& pipe)
{
commit 3cbdd9e3bdfa441e23f780e72b6489b89a79491f
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Mon Jan 18 09:42:07 2016 +0100
MasterProcessSession: capitalize static members
diff --git a/loolwsd/LOOLWSD.cpp b/loolwsd/LOOLWSD.cpp
index d69d951..d71e39c 100644
--- a/loolwsd/LOOLWSD.cpp
+++ b/loolwsd/LOOLWSD.cpp
@@ -802,7 +802,7 @@ bool LOOLWSD::createBroker(const std::string& rJailId)
const std::string brokerPath = Path(Application::instance().commandPath()).parent().toString() + "loolbroker";
- const auto childIndex = MasterProcessSession::_childProcesses.size() + 1;
+ const auto childIndex = MasterProcessSession::ChildProcesses.size() + 1;
Log::info("Launching Broker #" + std::to_string(childIndex) +
": " + brokerPath + " " +
Poco::cat(std::string(" "), args.begin(), args.end()));
@@ -810,7 +810,7 @@ bool LOOLWSD::createBroker(const std::string& rJailId)
ProcessHandle child = Process::launch(brokerPath, args);
Log::info() << "Adding Broker #" << childIndex << " PID " << child.id() << Log::end;
- MasterProcessSession::_childProcesses[child.id()] = child.id();
+ MasterProcessSession::ChildProcesses[child.id()] = child.id();
return true;
}
@@ -920,17 +920,17 @@ int LOOLWSD::main(const std::vector<std::string>& /*args*/)
int status = 0;
unsigned timeoutCounter = 0;
- while (!TerminationFlag && !LOOLWSD::DoTest && MasterProcessSession::_childProcesses.size() > 0)
+ while (!TerminationFlag && !LOOLWSD::DoTest && MasterProcessSession::ChildProcesses.size() > 0)
{
pid_t pid = waitpid(-1, &status, WUNTRACED | WNOHANG);
if (pid > 0)
{
- if ( MasterProcessSession::_childProcesses.find(pid) != MasterProcessSession::_childProcesses.end() )
+ if ( MasterProcessSession::ChildProcesses.find(pid) != MasterProcessSession::ChildProcesses.end() )
{
if ((WIFEXITED(status) || WIFSIGNALED(status) || WTERMSIG(status) ) )
{
Log::error("Child [" + std::to_string(pid) + "] processes died.");
- MasterProcessSession::_childProcesses.erase(pid);
+ MasterProcessSession::ChildProcesses.erase(pid);
}
if ( WCOREDUMP(status) )
@@ -974,7 +974,7 @@ int LOOLWSD::main(const std::vector<std::string>& /*args*/)
threadPool2.joinAll();
// Terminate child processes
- for (auto i : MasterProcessSession::_childProcesses)
+ for (auto i : MasterProcessSession::ChildProcesses)
{
Log::info("Requesting child process " + std::to_string(i.first) + " to terminate");
Process::requestTermination(i.first);
diff --git a/loolwsd/MasterProcessSession.cpp b/loolwsd/MasterProcessSession.cpp
index bead9e1..0799d9a 100644
--- a/loolwsd/MasterProcessSession.cpp
+++ b/loolwsd/MasterProcessSession.cpp
@@ -30,11 +30,11 @@ using Poco::Process;
using Poco::StringTokenizer;
using Poco::UInt64;
-std::map<Process::PID, UInt64> MasterProcessSession::_childProcesses;
+std::map<Process::PID, UInt64> MasterProcessSession::ChildProcesses;
-std::map<std::string, std::shared_ptr<MasterProcessSession>> MasterProcessSession::_availableChildSessions;
-std::mutex MasterProcessSession::_availableChildSessionMutex;
-std::condition_variable MasterProcessSession::_availableChildSessionCV;
+std::map<std::string, std::shared_ptr<MasterProcessSession>> MasterProcessSession::AvailableChildSessions;
+std::mutex MasterProcessSession::AvailableChildSessionMutex;
+std::condition_variable MasterProcessSession::AvailableChildSessionCV;
MasterProcessSession::MasterProcessSession(const std::string& id,
const Kind kind,
@@ -231,16 +231,16 @@ bool MasterProcessSession::_handleInput(const char *buffer, int length)
setId(tokens[2]);
const Process::PID pidChild = std::stoull(tokens[3]);
- std::unique_lock<std::mutex> lock(_availableChildSessionMutex);
- _availableChildSessions.emplace(getId(), shared_from_this());
+ std::unique_lock<std::mutex> lock(AvailableChildSessionMutex);
+ AvailableChildSessions.emplace(getId(), shared_from_this());
Log::info() << getName() << " mapped " << this << " childId=" << childId << ", id=" << getId()
- << " into _availableChildSessions, size=" << _availableChildSessions.size() << Log::end;
+ << " into _availableChildSessions, size=" << AvailableChildSessions.size() << Log::end;
_childId = childId;
_pidChild = pidChild;
lock.unlock();
- _availableChildSessionCV.notify_one();
+ AvailableChildSessionCV.notify_one();
// log first lokit child pid information
if ( LOOLWSD::DoTest )
@@ -593,17 +593,17 @@ void MasterProcessSession::dispatchChild()
// Wait until the child has connected with Master.
std::shared_ptr<MasterProcessSession> childSession;
- std::unique_lock<std::mutex> lock(_availableChildSessionMutex);
+ std::unique_lock<std::mutex> lock(AvailableChildSessionMutex);
Log::debug() << "Waiting for a child session permission for thread [" << getId() << "]." << Log::end;
while (nRequest-- && !bFound)
{
- _availableChildSessionCV.wait_for(
+ AvailableChildSessionCV.wait_for(
lock,
std::chrono::milliseconds(2000),
[&bFound, this]
{
- return (bFound = _availableChildSessions.find(getId()) != _availableChildSessions.end());
+ return (bFound = AvailableChildSessions.find(getId()) != AvailableChildSessions.end());
});
if (!bFound)
@@ -618,8 +618,8 @@ void MasterProcessSession::dispatchChild()
if (bFound)
{
Log::debug("Waiting child session permission, done!");
- childSession = _availableChildSessions[getId()];
- _availableChildSessions.erase(getId());
+ childSession = AvailableChildSessions[getId()];
+ AvailableChildSessions.erase(getId());
}
lock.unlock();
diff --git a/loolwsd/MasterProcessSession.hpp b/loolwsd/MasterProcessSession.hpp
index 42ed9e9..54f51cc 100644
--- a/loolwsd/MasterProcessSession.hpp
+++ b/loolwsd/MasterProcessSession.hpp
@@ -26,7 +26,7 @@ public:
bool haveSeparateProcess();
- static std::map<Poco::Process::PID, Poco::UInt64> _childProcesses;
+ static std::map<Poco::Process::PID, Poco::UInt64> ChildProcesses;
virtual bool getStatus(const char *buffer, int length) override;
@@ -65,9 +65,9 @@ public:
// Sessions to pre-spawned child processes that have connected but are not yet assigned a
// document to work on.
- static std::map<std::string, std::shared_ptr<MasterProcessSession>> _availableChildSessions;
- static std::mutex _availableChildSessionMutex;
- static std::condition_variable _availableChildSessionCV;
+ static std::map<std::string, std::shared_ptr<MasterProcessSession>> AvailableChildSessions;
+ static std::mutex AvailableChildSessionMutex;
+ static std::condition_variable AvailableChildSessionCV;
std::unique_ptr<TileCache> _tileCache;
commit 93eccfad987e1bfc98c176278263d503e05ce1ac
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Mon Jan 18 09:41:04 2016 +0100
ChildProcessSession::_mutex -> Mutex
As it's a static member.
diff --git a/loolwsd/ChildProcessSession.cpp b/loolwsd/ChildProcessSession.cpp
index 6f5f030..c8ccc79 100644
--- a/loolwsd/ChildProcessSession.cpp
+++ b/loolwsd/ChildProcessSession.cpp
@@ -39,7 +39,7 @@ using Poco::ProcessHandle;
using Poco::StringTokenizer;
using Poco::URI;
-std::recursive_mutex ChildProcessSession::_mutex;
+std::recursive_mutex ChildProcessSession::Mutex;
ChildProcessSession::ChildProcessSession(const std::string& id,
std::shared_ptr<Poco::Net::WebSocket> ws,
@@ -64,7 +64,7 @@ ChildProcessSession::~ChildProcessSession()
{
Log::info("~ChildProcessSession dtor [" + getName() + "].");
- std::unique_lock<std::recursive_mutex> lock(_mutex);
+ std::unique_lock<std::recursive_mutex> lock(Mutex);
if (_multiView)
_loKitDocument->pClass->setView(_loKitDocument, _viewId);
@@ -150,7 +150,7 @@ bool ChildProcessSession::_handleInput(const char *buffer, int length)
tokens[0] == "saveas");
{
- std::unique_lock<std::recursive_mutex> lock(_mutex);
+ std::unique_lock<std::recursive_mutex> lock(Mutex);
if (_multiView)
_loKitDocument->pClass->setView(_loKitDocument, _viewId);
@@ -238,7 +238,7 @@ bool ChildProcessSession::loadDocument(const char * /*buffer*/, int /*length*/,
_loKitDocument = _onLoad(getId(), _jailedFilePath);
- std::unique_lock<std::recursive_mutex> lock(_mutex);
+ std::unique_lock<std::recursive_mutex> lock(Mutex);
if (_multiView)
_viewId = _loKitDocument->pClass->getView(_loKitDocument);
@@ -279,7 +279,7 @@ void ChildProcessSession::sendFontRendering(const char* /*buffer*/, int /*length
return;
}
- std::unique_lock<std::recursive_mutex> lock(_mutex);
+ std::unique_lock<std::recursive_mutex> lock(Mutex);
if (_multiView)
_loKitDocument->pClass->setView(_loKitDocument, _viewId);
@@ -312,7 +312,7 @@ void ChildProcessSession::sendFontRendering(const char* /*buffer*/, int /*length
bool ChildProcessSession::getStatus(const char* /*buffer*/, int /*length*/)
{
- std::unique_lock<std::recursive_mutex> lock(_mutex);
+ std::unique_lock<std::recursive_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::recursive_mutex> lock(_mutex);
+ std::unique_lock<std::recursive_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::recursive_mutex> lock(_mutex);
+ std::unique_lock<std::recursive_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::recursive_mutex> lock(_mutex);
+ std::unique_lock<std::recursive_mutex> lock(Mutex);
if (_multiView)
_loKitDocument->pClass->setView(_loKitDocument, _viewId);
@@ -563,7 +563,7 @@ bool ChildProcessSession::clientZoom(const char* /*buffer*/, int /*length*/, Str
return false;
}
- std::unique_lock<std::recursive_mutex> lock(_mutex);
+ std::unique_lock<std::recursive_mutex> lock(Mutex);
if (_multiView)
_loKitDocument->pClass->setView(_loKitDocument, _viewId);
@@ -597,7 +597,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::recursive_mutex> lock(_mutex);
+ std::unique_lock<std::recursive_mutex> lock(Mutex);
//TODO: Cleanup the file after downloading.
_loKitDocument->pClass->saveAs(_loKitDocument, url.c_str(),
@@ -626,7 +626,7 @@ bool ChildProcessSession::getTextSelection(const char* /*buffer*/, int /*length*
return false;
}
- std::unique_lock<std::recursive_mutex> lock(_mutex);
+ std::unique_lock<std::recursive_mutex> lock(Mutex);
if (_multiView)
_loKitDocument->pClass->setView(_loKitDocument, _viewId);
@@ -651,7 +651,7 @@ bool ChildProcessSession::paste(const char* buffer, int length, StringTokenizer&
const char* data = buffer + firstLine.size() + 1;
size_t size = length - firstLine.size() - 1;
- std::unique_lock<std::recursive_mutex> lock(_mutex);
+ std::unique_lock<std::recursive_mutex> lock(Mutex);
if (_multiView)
_loKitDocument->pClass->setView(_loKitDocument, _viewId);
@@ -673,7 +673,7 @@ bool ChildProcessSession::insertFile(const char* /*buffer*/, int /*length*/, Str
return false;
}
- std::unique_lock<std::recursive_mutex> lock(_mutex);
+ std::unique_lock<std::recursive_mutex> lock(Mutex);
if (type == "graphic")
{
@@ -714,7 +714,7 @@ bool ChildProcessSession::keyEvent(const char* /*buffer*/, int /*length*/, Strin
if (keycode == (KEY_CTRL | KEY_W))
return true;
- std::unique_lock<std::recursive_mutex> lock(_mutex);
+ std::unique_lock<std::recursive_mutex> lock(Mutex);
if (_multiView)
_loKitDocument->pClass->setView(_loKitDocument, _viewId);
@@ -744,7 +744,7 @@ bool ChildProcessSession::mouseEvent(const char* /*buffer*/, int /*length*/, Str
return false;
}
- std::unique_lock<std::recursive_mutex> lock(_mutex);
+ std::unique_lock<std::recursive_mutex> lock(Mutex);
if (_multiView)
_loKitDocument->pClass->setView(_loKitDocument, _viewId);
@@ -762,7 +762,7 @@ bool ChildProcessSession::unoCommand(const char* /*buffer*/, int /*length*/, Str
return false;
}
- std::unique_lock<std::recursive_mutex> lock(_mutex);
+ std::unique_lock<std::recursive_mutex> lock(Mutex);
if (_multiView)
_loKitDocument->pClass->setView(_loKitDocument, _viewId);
@@ -801,7 +801,7 @@ bool ChildProcessSession::selectText(const char* /*buffer*/, int /*length*/, Str
return false;
}
- std::unique_lock<std::recursive_mutex> lock(_mutex);
+ std::unique_lock<std::recursive_mutex> lock(Mutex);
if (_multiView)
_loKitDocument->pClass->setView(_loKitDocument, _viewId);
@@ -827,7 +827,7 @@ bool ChildProcessSession::selectGraphic(const char* /*buffer*/, int /*length*/,
return false;
}
- std::unique_lock<std::recursive_mutex> lock(_mutex);
+ std::unique_lock<std::recursive_mutex> lock(Mutex);
if (_multiView)
_loKitDocument->pClass->setView(_loKitDocument, _viewId);
@@ -845,7 +845,7 @@ bool ChildProcessSession::resetSelection(const char* /*buffer*/, int /*length*/,
return false;
}
- std::unique_lock<std::recursive_mutex> lock(_mutex);
+ std::unique_lock<std::recursive_mutex> lock(Mutex);
if (_multiView)
_loKitDocument->pClass->setView(_loKitDocument, _viewId);
@@ -876,7 +876,7 @@ bool ChildProcessSession::saveAs(const char* /*buffer*/, int /*length*/, StringT
}
}
- std::unique_lock<std::recursive_mutex> lock(_mutex);
+ std::unique_lock<std::recursive_mutex> lock(Mutex);
if (_multiView)
_loKitDocument->pClass->setView(_loKitDocument, _viewId);
@@ -914,7 +914,7 @@ bool ChildProcessSession::setPage(const char* /*buffer*/, int /*length*/, String
return false;
}
- std::unique_lock<std::recursive_mutex> lock(_mutex);
+ std::unique_lock<std::recursive_mutex> lock(Mutex);
if (_multiView)
_loKitDocument->pClass->setView(_loKitDocument, _viewId);
diff --git a/loolwsd/ChildProcessSession.hpp b/loolwsd/ChildProcessSession.hpp
index 849457d..5c7754c 100644
--- a/loolwsd/ChildProcessSession.hpp
+++ b/loolwsd/ChildProcessSession.hpp
@@ -52,7 +52,7 @@ public:
LibreOfficeKitDocument *getLoKitDocument() const { return _loKitDocument; }
- std::unique_lock<std::recursive_mutex> getLock() { return std::unique_lock<std::recursive_mutex>(_mutex); }
+ std::unique_lock<std::recursive_mutex> getLock() { return std::unique_lock<std::recursive_mutex>(Mutex); }
protected:
virtual bool loadDocument(const char *buffer, int length, Poco::StringTokenizer& tokens) override;
@@ -96,7 +96,7 @@ private:
/// Synchronize _loKitDocument acess.
/// This should be inside LoKit.
- static std::recursive_mutex _mutex;
+ static std::recursive_mutex Mutex;
};
#endif
commit 918501270406cfa7cabec39b15de3b1dd25dacbd
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Mon Jan 18 09:40:30 2016 +0100
Log::StreamLogger: Stream -> _stream
As it's not a static member.
diff --git a/loolwsd/Util.hpp b/loolwsd/Util.hpp
index 9dac84c..a38541b 100644
--- a/loolwsd/Util.hpp
+++ b/loolwsd/Util.hpp
@@ -127,17 +127,17 @@ namespace Log
}
StreamLogger(StreamLogger&& sl)
- : Stream(std::move(sl.Stream.str()))
+ : _stream(std::move(sl._stream.str()))
, _func(std::move(sl._func))
{
}
void flush() const
{
- _func(Stream.str());
+ _func(_stream.str());
}
- std::ostringstream Stream;
+ std::ostringstream _stream;
private:
std::function<void(const std::string&)> _func;
@@ -176,14 +176,14 @@ namespace Log
template <typename U>
StreamLogger& operator <<(StreamLogger& lhs, const U& rhs)
{
- lhs.Stream << rhs;
+ lhs._stream << rhs;
return lhs;
}
template <typename U>
StreamLogger& operator <<(StreamLogger&& lhs, U&& rhs)
{
- lhs.Stream << rhs;
+ lhs._stream << rhs;
return lhs;
}
More information about the Libreoffice-commits
mailing list