[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.0' - include/vcl toolkit/source vcl/source

Michael Meeks michael.meeks at collabora.com
Sat May 7 19:54:52 UTC 2016


 include/vcl/scheduler.hxx          |    6 ++++--
 toolkit/source/awt/vclxtoolkit.cxx |    2 +-
 vcl/source/app/scheduler.cxx       |   21 +++++++++++++++++++--
 3 files changed, 24 insertions(+), 5 deletions(-)

New commits:
commit 6a7e4abb8a280a2db39475b58ac774031c22f0ba
Author: Michael Meeks <michael.meeks at collabora.com>
Date:   Thu Nov 26 10:42:10 2015 +0000

    vcl: fix event processing to idle - for JUnit tests.
    
    Reviewed-on: https://gerrit.libreoffice.org/20197
    Reviewed-by: Michael Meeks <michael.meeks at collabora.com>
    Tested-by: Michael Meeks <michael.meeks at collabora.com>
    (cherry picked from commit fbdeef6b7f74a3602792d178b1e750020b2cac89)
    
    Change-Id: Ibeb1f6627815fc34c6e166357c88e076b75f6abb
    Reviewed-on: https://gerrit.libreoffice.org/24723
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
    Tested-by: Ashod Nakashian <ashnakash at gmail.com>

diff --git a/include/vcl/scheduler.hxx b/include/vcl/scheduler.hxx
index 28072c1..b27e609 100644
--- a/include/vcl/scheduler.hxx
+++ b/include/vcl/scheduler.hxx
@@ -89,8 +89,10 @@ public:
 
     // Process one pending Timer with highhest priority
     static void CallbackTaskScheduling( bool ignore );
-    /// Process one pending task ahead of time with highhest priority.
-    static void ProcessTaskScheduling( bool bTimer );
+    /// Process one pending task ahead of time with highest priority.
+    static bool       ProcessTaskScheduling( bool bTimerOnly );
+    /// Process all events until we are idle
+    static void       ProcessEventsToIdle();
 };
 
 #endif // INCLUDED_VCL_SCHEDULER_HXX
diff --git a/toolkit/source/awt/vclxtoolkit.cxx b/toolkit/source/awt/vclxtoolkit.cxx
index ee1f9b8..f11e167 100644
--- a/toolkit/source/awt/vclxtoolkit.cxx
+++ b/toolkit/source/awt/vclxtoolkit.cxx
@@ -1892,7 +1892,7 @@ void SAL_CALL VCLXToolkit::processEventsToIdle()
     throw (::com::sun::star::uno::RuntimeException, std::exception)
 {
     SolarMutexGuard aSolarGuard;
-    Scheduler::ProcessTaskScheduling(false);
+    Scheduler::ProcessEventsToIdle();
 }
 
 }
diff --git a/vcl/source/app/scheduler.cxx b/vcl/source/app/scheduler.cxx
index c3cea78..1b7a9bb 100644
--- a/vcl/source/app/scheduler.cxx
+++ b/vcl/source/app/scheduler.cxx
@@ -109,7 +109,7 @@ void Scheduler::CallbackTaskScheduling(bool ignore)
     Scheduler::ProcessTaskScheduling( true );
 }
 
-void Scheduler::ProcessTaskScheduling( bool bTimer )
+bool Scheduler::ProcessTaskScheduling( bool bTimerOnly )
 {
     // process all pending Tasks
     // if bTimer True, only handle timer
@@ -119,12 +119,14 @@ void Scheduler::ProcessTaskScheduling( bool bTimer )
     sal_uInt64         nTime = tools::Time::GetSystemTicks();
     sal_uInt64         nMinPeriod = MAX_TIMER_PERIOD;
     pSVData->mnUpdateStack++;
+    bool bProcessed = false;
 
     // tdf#91727 - NB. bTimer is ultimately not used
-    if ((pSchedulerData = ImplSchedulerData::GetMostImportantTask(bTimer)))
+    if ((pSchedulerData = ImplSchedulerData::GetMostImportantTask(bTimerOnly)))
     {
         pSchedulerData->mnUpdateTime = nTime;
         pSchedulerData->Invoke();
+        bProcessed = true;
     }
 
     pSchedulerData = pSVData->mpFirstSchedulerData;
@@ -169,6 +171,21 @@ void Scheduler::ProcessTaskScheduling( bool bTimer )
         Timer::ImplStartTimer( pSVData, nMinPeriod );
     }
     pSVData->mnUpdateStack--;
+    return bProcessed;
+}
+
+void Scheduler::ProcessEventsToIdle()
+{
+    // FIXME: really we should process incoming OS events too ...
+    int nSanity = 1000;
+    while (Scheduler::ProcessTaskScheduling(false))
+    {
+        if (nSanity-- < 0)
+        {
+            SAL_WARN("vcl.schedule", "Unexpected volume of events to process");
+            break;
+        }
+    }
 }
 
 void Scheduler::SetPriority( SchedulerPriority ePriority )


More information about the Libreoffice-commits mailing list