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

Ashod Nakashian ashod.nakashian at collabora.co.uk
Tue Apr 4 04:31:03 UTC 2017


 wsd/DocumentBroker.cpp |   11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

New commits:
commit d11b3a76d9284c23b0262abd2c48a2dc89bed571
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date:   Tue Apr 4 00:11:06 2017 -0400

    wsd: move correct-thread assertions
    
    Change-Id: Iba5d58d74720aaf02a372f25148047e79c89c1bd
    Reviewed-on: https://gerrit.libreoffice.org/36060
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
    Tested-by: Ashod Nakashian <ashnakash at gmail.com>

diff --git a/wsd/DocumentBroker.cpp b/wsd/DocumentBroker.cpp
index 483e7c5e..97626af9 100644
--- a/wsd/DocumentBroker.cpp
+++ b/wsd/DocumentBroker.cpp
@@ -277,6 +277,8 @@ bool DocumentBroker::isAlive() const
 
 DocumentBroker::~DocumentBroker()
 {
+    assert(isCorrectThread());
+
     Admin::instance().rmDoc(_docKey);
 
     LOG_INF("~DocumentBroker [" << _uriPublic.toString() <<
@@ -630,6 +632,8 @@ void DocumentBroker::setLoaded()
 
 bool DocumentBroker::autoSave(const bool force)
 {
+    assert(isCorrectThread());
+
     if (_sessions.empty() || _storage == nullptr || !_isLoaded ||
         !_childProcess->isAlive() || (!_isModified && !force))
     {
@@ -669,6 +673,8 @@ bool DocumentBroker::autoSave(const bool force)
 
 bool DocumentBroker::sendUnoSave(const bool dontSaveIfUnmodified)
 {
+    assert(isCorrectThread());
+
     LOG_INF("Autosave triggered for doc [" << _docKey << "].");
 
     std::shared_ptr<ClientSession> savingSession;
@@ -1168,6 +1174,8 @@ void DocumentBroker::setModified(const bool value)
 
 bool DocumentBroker::forwardToChild(const std::string& viewId, const std::string& message)
 {
+    assert(isCorrectThread());
+
     LOG_TRC("Forwarding payload to child [" << viewId << "]: " << message);
 
     std::string msg = "child-" + viewId + ' ' + message;
@@ -1242,7 +1250,7 @@ bool DocumentBroker::forwardToClient(const std::shared_ptr<Message>& payload)
 
 void DocumentBroker::childSocketTerminated()
 {
-    std::lock_guard<std::mutex> lock(_mutex);
+    assert(isCorrectThread());
 
     if (!_childProcess->isAlive())
     {
@@ -1338,6 +1346,7 @@ void DocumentBroker::dumpState(std::ostream& os)
     os << "\n  public uri: " << _uriPublic.toString();
     os << "\n  jailed uri: " << _uriJailed.toString();
     os << "\n  doc key: " << _docKey;
+    os << "\n  doc id: " << _docId;
     os << "\n  num sessions: " << getSessionsCount();
     os << "\n  last editable?: " << _lastEditableSession;
     std::time_t t = std::chrono::system_clock::to_time_t(


More information about the Libreoffice-commits mailing list