kit/ChildSession.cpp | 13 +++++++++++++ kit/ChildSession.hpp | 9 +++++++++ 2 files changed, 22 insertions(+)
New commits: commit 04bf59060d1459096e8543bf865f45a69c1a6ce2 Author: Jan Holesovsky <ke...@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/36960 Reviewed-by: Jan Holesovsky <ke...@collabora.com> Tested-by: Jan Holesovsky <ke...@collabora.com> 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(); } }; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits