diff options
Diffstat (limited to 'desktop/inc/lib/init.hxx')
-rw-r--r-- | desktop/inc/lib/init.hxx | 39 |
1 files changed, 25 insertions, 14 deletions
diff --git a/desktop/inc/lib/init.hxx b/desktop/inc/lib/init.hxx index 1a927280e24b..ef8494ed7b0d 100644 --- a/desktop/inc/lib/init.hxx +++ b/desktop/inc/lib/init.hxx @@ -46,11 +46,10 @@ namespace desktop { OString toString() const { - std::stringstream ss; - ss << m_aRectangle.toString(); if (m_nPart >= -1) - ss << ", " << m_nPart; - return ss.str().c_str(); + return m_aRectangle.toString() + ", " + OString::number(m_nPart); + else + return m_aRectangle.toString(); } /// Infinite Rectangle is both sides are @@ -93,9 +92,8 @@ namespace desktop { struct CallbackData { - CallbackData(int type, const std::string& payload) - : Type(type) - , PayloadString(payload) + CallbackData(const std::string& payload) + : PayloadString(payload) { } @@ -118,7 +116,6 @@ namespace desktop { /// Returns true iff there is cached data. bool isCached() const { return PayloadObject.which() != 0; } - int Type; std::string PayloadString; private: @@ -126,14 +123,19 @@ namespace desktop { boost::variant<boost::blank, RectangleAndPart, boost::property_tree::ptree> PayloadObject; }; - typedef std::vector<CallbackData> queue_type; + typedef std::vector<int> queue_type1; + typedef std::vector<CallbackData> queue_type2; private: - bool removeAll(const std::function<bool (const queue_type::value_type&)>& rTestFunc); - bool processInvalidateTilesEvent(CallbackData& aCallbackData); - bool processWindowEvent(CallbackData& aCallbackData); - - queue_type m_queue; + bool removeAll(const std::function<bool (int, const CallbackData&)>& rTestFunc); + bool processInvalidateTilesEvent(int type, CallbackData& aCallbackData); + bool processWindowEvent(int type, CallbackData& aCallbackData); + queue_type2::reverse_iterator toQueue2(queue_type1::reverse_iterator); + + /** we frequently want to scan the queue, and mostly when we do so, we only care about the element type + so we split the queue in 2 to make the scanning cache friendly. */ + queue_type1 m_queue1; + queue_type2 m_queue2; std::map<int, std::string> m_states; std::unordered_map<int, std::unordered_map<int, std::string>> m_viewStates; LibreOfficeKitDocument* m_pDocument; @@ -142,6 +144,15 @@ namespace desktop { int m_nDisableCallbacks; bool m_bEventLatch; std::mutex m_mutex; + class TimeoutIdle : public Timer + { + public: + TimeoutIdle( CallbackFlushHandler* handler ); + virtual void Invoke() override; + private: + CallbackFlushHandler* mHandler; + }; + TimeoutIdle m_TimeoutIdle; }; struct DESKTOP_DLLPUBLIC LibLODocument_Impl : public _LibreOfficeKitDocument |