[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-2-1' - kit/ChildSession.cpp kit/ChildSession.hpp

Jan Holesovsky kendy at collabora.com
Wed Apr 26 15:15:28 UTC 2017


 kit/ChildSession.cpp |   13 +++++++++++++
 kit/ChildSession.hpp |    9 +++++++++
 2 files changed, 22 insertions(+)

New commits:
commit bdbeb37dbd8d4bad5a77b2eaee33c4bbb241abbd
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Tue Apr 25 18:17:50 2017 +0200

    inactive: Record also the change tracking and comments.
    
    Unfortunately we need to record the entire sequences of what was happening.
    
    Change-Id: I6c52f187e881dd3eadaea6958c0d49ed8f6942cb
    Reviewed-on: https://gerrit.libreoffice.org/36959
    Reviewed-by: pranavk <pranavk at collabora.co.uk>
    Tested-by: pranavk <pranavk at collabora.co.uk>

diff --git a/kit/ChildSession.cpp b/kit/ChildSession.cpp
index 8b01a517..295f261f 100644
--- a/kit/ChildSession.cpp
+++ b/kit/ChildSession.cpp
@@ -150,6 +150,12 @@ bool ChildSession::_handleInput(const char *buffer, int length)
             loKitCallback(LOK_CALLBACK_STATE_CHANGED, pair.second);
         }
 
+        for (const auto& event : _stateRecorder._recordedEventsVector)
+        {
+            LOG_TRC("Replaying missed event (part of sequence): " << LOKitHelper::kitCallbackTypeToString(event._type) << ": " << event._payload);
+            loKitCallback(event._type, event._payload);
+        }
+
         _stateRecorder.clear();
 
         LOG_TRC("Finished replaying messages.");
@@ -1023,6 +1029,13 @@ void ChildSession::rememberEventsForInactiveUser(const int type, const std::stri
             _stateRecorder.recordState(name, payload);
         }
     }
+    else if (type == LOK_CALLBACK_REDLINE_TABLE_SIZE_CHANGED ||
+             type == LOK_CALLBACK_REDLINE_TABLE_ENTRY_MODIFIED ||
+             type == LOK_CALLBACK_COMMENT)
+    {
+        auto lock(getLock());
+        _stateRecorder.recordEventSequence(type, payload);
+    }
 }
 
 void ChildSession::loKitCallback(const int type, const std::string& payload)
diff --git a/kit/ChildSession.hpp b/kit/ChildSession.hpp
index c0279488..b1fad059 100644
--- a/kit/ChildSession.hpp
+++ b/kit/ChildSession.hpp
@@ -74,6 +74,7 @@ public:
     std::unordered_map<std::string, std::string> _recordedStates;
     std::unordered_map<int, std::unordered_map<int, RecordedEvent>> _recordedViewEvents;
     std::unordered_map<int, RecordedEvent> _recordedEvents;
+    std::vector<RecordedEvent> _recordedEventsVector;
 
     StateRecorder() : _invalidate(false) {}
 
@@ -98,12 +99,20 @@ public:
         _recordedStates[name] = value;
     }
 
+    /// In the case we need to rememeber all the events that come, not just
+    /// the final state.
+    void recordEventSequence(const int type, const std::string& payload)
+    {
+        _recordedEventsVector.push_back({type, payload});
+    }
+
     void clear()
     {
         _invalidate = false;
         _recordedEvents.clear();
         _recordedViewEvents.clear();
         _recordedStates.clear();
+        _recordedEventsVector.clear();
     }
 };
 


More information about the Libreoffice-commits mailing list