kit/ChildSession.cpp | 10 +++++----- kit/ChildSession.hpp | 28 +++++++++++++++++++++++++++- 2 files changed, 32 insertions(+), 6 deletions(-)
New commits: commit 83bd75476e53f98e75691c8ad07d8d2a5f488fbf Author: Miklos Vajna <vmik...@collabora.co.uk> AuthorDate: Fri Nov 9 08:41:28 2018 +0100 Commit: Miklos Vajna <vmik...@collabora.co.uk> CommitDate: Fri Nov 9 08:41:35 2018 +0100 StateRecorder: make members private diff --git a/kit/ChildSession.cpp b/kit/ChildSession.cpp index af56584d5..3e6a904ce 100644 --- a/kit/ChildSession.cpp +++ b/kit/ChildSession.cpp @@ -119,13 +119,13 @@ bool ChildSession::_handleInput(const char *buffer, int length) // Invalidate if we have to // TODO instead just a "_invalidate" flag, we should remember / grow // the rectangle to invalidate; invalidating everything is sub-optimal - if (_stateRecorder._invalidate) + if (_stateRecorder.isInvalidate()) { std::string payload = "0, 0, " + std::to_string(INT_MAX) + ", " + std::to_string(INT_MAX) + ", " + std::to_string(curPart); loKitCallback(LOK_CALLBACK_INVALIDATE_TILES, payload); } - for (const auto& viewPair : _stateRecorder._recordedViewEvents) + for (const auto& viewPair : _stateRecorder.getRecordedViewEvents()) { for (const auto& eventPair : viewPair.second) { @@ -136,20 +136,20 @@ bool ChildSession::_handleInput(const char *buffer, int length) } } - for (const auto& eventPair : _stateRecorder._recordedEvents) + for (const auto& eventPair : _stateRecorder.getRecordedEvents()) { const RecordedEvent& event = eventPair.second; LOG_TRC("Replaying missed event: " << LOKitHelper::kitCallbackTypeToString(event._type) << ": " << event._payload); loKitCallback(event._type, event._payload); } - for (const auto& pair : _stateRecorder._recordedStates) + for (const auto& pair : _stateRecorder.getRecordedStates()) { LOG_TRC("Replaying missed state-change: " << pair.second); loKitCallback(LOK_CALLBACK_STATE_CHANGED, pair.second); } - for (const auto& event : _stateRecorder._recordedEventsVector) + for (const auto& event : _stateRecorder.getRecordedEventsVector()) { LOG_TRC("Replaying missed event (part of sequence): " << LOKitHelper::kitCallbackTypeToString(event._type) << ": " << event._payload); loKitCallback(event._type, event._payload); diff --git a/kit/ChildSession.hpp b/kit/ChildSession.hpp index b23edd8c4..b67a18980 100644 --- a/kit/ChildSession.hpp +++ b/kit/ChildSession.hpp @@ -85,13 +85,14 @@ struct RecordedEvent /// When the session is inactive, we need to record its state for a replay. class StateRecorder { -public: +private: bool _invalidate; 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; +public: StateRecorder() : _invalidate(false) {} // TODO Remember the maximal area we need to invalidate - grow it step by step. @@ -100,6 +101,31 @@ public: _invalidate = true; } + bool isInvalidate() const + { + return _invalidate; + } + + const std::unordered_map<std::string, std::string>& getRecordedStates() const + { + return _recordedStates; + } + + const std::unordered_map<int, std::unordered_map<int, RecordedEvent>>& getRecordedViewEvents() const + { + return _recordedViewEvents; + } + + const std::unordered_map<int, RecordedEvent>& getRecordedEvents() const + { + return _recordedEvents; + } + + const std::vector<RecordedEvent>& getRecordedEventsVector() const + { + return _recordedEventsVector; + } + void recordEvent(const int type, const std::string& payload) { _recordedEvents[type] = {type, payload}; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits