From d0bd1880f4edf6b5a1657e675aa10a6418003d99 Mon Sep 17 00:00:00 2001
From: Jan-Marek Glogowski <glogow@fbihome.de>
Date: Sun, 16 Sep 2018 19:17:31 +0000
Subject: Scheduler: add per-priority Task lists

This way we don't have to search the whole list for a higher
priority event, if an immediate Task is found. This probably
helps bugs like tdf#119724 and tdf#119428.

Change-Id: Ic5685193d1bedb6996cf46f0ee2cba42190ff7cc
Reviewed-on: https://gerrit.libreoffice.org/60572
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
---
 vcl/source/app/svapp.cxx | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)

(limited to 'vcl/source/app/svapp.cxx')

diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx
index ec151895815a..ca3848d58a22 100644
--- a/vcl/source/app/svapp.cxx
+++ b/vcl/source/app/svapp.cxx
@@ -503,21 +503,24 @@ void Scheduler::ProcessEventsToIdle()
     // events were processed at some point, but our check can't prevent further
     // processing in the main thread, which may add new events, so skip it.
     const ImplSVData* pSVData = ImplGetSVData();
-    if ( !pSVData->mpDefInst->IsMainThread() )
+    if (!pSVData->mpDefInst->IsMainThread())
         return;
-    const ImplSchedulerData* pSchedulerData = pSVData->maSchedCtx.mpFirstSchedulerData;
-    while ( pSchedulerData )
+    for (int nTaskPriority = 0; nTaskPriority < PRIO_COUNT; ++nTaskPriority)
     {
-        if ( pSchedulerData->mpTask && !pSchedulerData->mbInScheduler )
+        const ImplSchedulerData* pSchedulerData = pSVData->maSchedCtx.mpFirstSchedulerData[nTaskPriority];
+        while (pSchedulerData)
         {
-            Idle *pIdle = dynamic_cast<Idle*>( pSchedulerData->mpTask );
-            if ( pIdle && pIdle->IsActive() )
+            if (pSchedulerData->mpTask && !pSchedulerData->mbInScheduler)
             {
-                SAL_WARN( "vcl.schedule", "Unprocessed Idle: "
-                          << pIdle << " " << pIdle->GetDebugName() );
+                Idle *pIdle = dynamic_cast<Idle*>(pSchedulerData->mpTask);
+                if (pIdle && pIdle->IsActive())
+                {
+                    SAL_WARN("vcl.schedule", "Unprocessed Idle: "
+                             << pIdle << " " << pIdle->GetDebugName());
+                }
             }
+            pSchedulerData = pSchedulerData->mpNext;
         }
-        pSchedulerData = pSchedulerData->mpNext;
     }
 #endif
 }
-- 
cgit