summaryrefslogtreecommitdiff
path: root/desktop/source/lib/init.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'desktop/source/lib/init.cxx')
-rw-r--r--desktop/source/lib/init.cxx23
1 files changed, 21 insertions, 2 deletions
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 71098de551cb..9edc10d013e4 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -1405,13 +1405,29 @@ static OUString getGenerator()
extern "C" {
+CallbackFlushHandler::TimeoutIdle::TimeoutIdle( CallbackFlushHandler* handler )
+ : Timer( "lokit timer callback" )
+ , mHandler( handler )
+{
+ // A second timer with higher priority, it'll ensure we flush in reasonable time if we get too busy
+ // to get POST_PAINT priority processing. Otherwise it could take a long time to flush.
+ SetPriority(TaskPriority::DEFAULT);
+ SetTimeout( 100 ); // 100 ms
+}
+
+void CallbackFlushHandler::TimeoutIdle::Invoke()
+{
+ mHandler->Invoke();
+}
+
CallbackFlushHandler::CallbackFlushHandler(LibreOfficeKitDocument* pDocument, LibreOfficeKitCallback pCallback, void* pData)
- : Idle( "lokit timer callback" ),
+ : Idle( "lokit idle callback" ),
m_pDocument(pDocument),
m_pCallback(pCallback),
m_pData(pData),
m_nDisableCallbacks(0),
- m_bEventLatch(false)
+ m_bEventLatch(false),
+ m_TimeoutIdle( this )
{
SetPriority(TaskPriority::POST_PAINT);
@@ -1708,6 +1724,8 @@ void CallbackFlushHandler::queue(const int type, const char* data)
{
Start();
}
+ if (!m_TimeoutIdle.IsActive())
+ m_TimeoutIdle.Start();
}
bool CallbackFlushHandler::processInvalidateTilesEvent(int type, CallbackData& aCallbackData)
@@ -2094,6 +2112,7 @@ void CallbackFlushHandler::Invoke()
m_queue1.clear();
m_queue2.clear();
+ m_TimeoutIdle.Stop();
}
}