Rebased ref, commits from common ancestor: commit ae6c0a15df7a2b0ef24f06e5e316ff3e24eafd9c Author: Jan-Marek Glogowski <glo...@fbihome.de> Date: Tue Sep 13 11:03:08 2016 +0200
Round-robin invoked / started tasks And some simple round-robin to the task processing, so equal priority (auto) tasks won't always be scheduled, if there are multiple with the same priority. Currently breaks LO, which indicates dependencies in the same priority class, which must not exist! Change-Id: If84496bff68aec42d0fa63c2b7e05c3202f67b2c diff --git a/vcl/source/app/scheduler.cxx b/vcl/source/app/scheduler.cxx index 647dbb4..202211a 100644 --- a/vcl/source/app/scheduler.cxx +++ b/vcl/source/app/scheduler.cxx @@ -30,9 +30,6 @@ void ImplSchedulerData::Invoke() if ( !mpScheduler || mbInScheduler ) return; - // tdf#92036 Reset the period to avoid re-firing immediately. - mpScheduler->mpSchedulerData->mnUpdateTime = tools::Time::GetSystemTicks(); - Scheduler *sched = mpScheduler; // prepare Scheduler Object for deletion after handling @@ -173,6 +170,7 @@ bool Scheduler::ProcessTaskScheduling( IdleRunPolicy eIdleRunPolicy ) ImplSchedulerData* pSchedulerData = pSVData->mpFirstSchedulerData; ImplSchedulerData* pPrevSchedulerData = nullptr; + ImplSchedulerData *pPrevMostUrgent = nullptr; ImplSchedulerData *pMostUrgent = nullptr; sal_uInt64 nMinPeriod = InfiniteTimeoutMs; @@ -203,12 +201,15 @@ bool Scheduler::ProcessTaskScheduling( IdleRunPolicy eIdleRunPolicy ) // if the priority of the current task is higher (numerical value is lower) than // the priority of the most urgent, the current task becomes the new most urgent if ( !pMostUrgent ) + { + pPrevMostUrgent = pPrevSchedulerData; pMostUrgent = pSchedulerData; goto next_entry; } else if ( pSchedulerData->mpScheduler->GetPriority() < pMostUrgent->mpScheduler->GetPriority() ) { UpdateMinPeriod( pMostUrgent, nTime, nMinPeriod ); + pPrevMostUrgent = pPrevSchedulerData; pMostUrgent = pSchedulerData; goto next_entry; } @@ -225,6 +226,9 @@ next_entry: if ( pMostUrgent ) { + assert( pPrevMostUrgent != pMostUrgent ); + assert( !pPrevMostUrgent || (pPrevMostUrgent->mpNext == pMostUrgent) ); + pMostUrgent->mnUpdateTime = nTime; UpdateMinPeriod( pMostUrgent, nTime, nMinPeriod ); @@ -234,6 +238,21 @@ next_entry: pMostUrgent->Invoke(); SAL_INFO_IF( !pMostUrgent->mpScheduler, "vcl.schedule", tools::Time::GetSystemTicks() << " " << pMostUrgent << " tag-rm " ); + + // do some simple round-robin scheduling + // nothing to do, if we're already the last element + if ( pMostUrgent->mpScheduler && pMostUrgent->mpNext ) + { + if ( pPrevMostUrgent ) + pPrevMostUrgent->mpNext = pMostUrgent->mpNext; + else + pSVData->mpFirstSchedulerData = pMostUrgent->mpNext; + // Invoke might have added tasks to the end of the list + while ( pPrevSchedulerData->mpNext ) + pPrevSchedulerData = pPrevSchedulerData->mpNext; + pPrevSchedulerData->mpNext = pMostUrgent; + pMostUrgent->mpNext = nullptr; + } } if ( nMinPeriod != InfiniteTimeoutMs @@ -272,26 +291,49 @@ void Scheduler::Start() mpSchedulerData = new ImplSchedulerData; mpSchedulerData->mpScheduler = this; mpSchedulerData->mbInScheduler = false; + mpSchedulerData->mpNext = nullptr; // insert last due to SFX! - ImplSchedulerData* pPrev = nullptr; ImplSchedulerData* pData = pSVData->mpFirstSchedulerData; - while ( pData ) + if ( pData ) { - pPrev = pData; - pData = pData->mpNext; + while ( pData->mpNext ) + pData = pData->mpNext; + pData->mpNext = mpSchedulerData; } - mpSchedulerData->mpNext = nullptr; - if ( pPrev ) - pPrev->mpNext = mpSchedulerData; else pSVData->mpFirstSchedulerData = mpSchedulerData; SAL_INFO( "vcl.schedule", tools::Time::GetSystemTicks() << " " << mpSchedulerData << " added " << (int) mePriority << " " << mpDebugName ); } else - SAL_INFO( "vcl.schedule", tools::Time::GetSystemTicks() << " " << mpSchedulerData - << " restarted " << (int) mePriority << " " << mpDebugName ); + { + if ( mpSchedulerData->mpNext ) + { + ImplSchedulerData* pData = pSVData->mpFirstSchedulerData; + if ( pData == mpSchedulerData ) + { + pSVData->mpFirstSchedulerData = pData->mpNext; + pData = pData->mpNext; + } + else + { + while ( pData->mpNext && pData->mpNext != mpSchedulerData ) + pData = pData->mpNext; + assert( pData->mpNext ); + pData->mpNext = mpSchedulerData->mpNext; + } + mpSchedulerData->mpNext = nullptr; + while ( pData->mpNext ) + pData = pData->mpNext; + pData->mpNext = mpSchedulerData; + SAL_INFO( "vcl.schedule", tools::Time::GetSystemTicks() << " " << mpSchedulerData + << " restarted " << (int) mePriority << " " << mpDebugName ); + } + else + SAL_INFO( "vcl.schedule", tools::Time::GetSystemTicks() << " " << mpSchedulerData + << " kept " << (int) mePriority << " " << mpDebugName ); + } assert( mpSchedulerData->mpScheduler == this ); mpSchedulerData->mnUpdateTime = tools::Time::GetSystemTicks(); diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx index 374eaa5..0280a65 100644 --- a/vcl/source/app/svapp.cxx +++ b/vcl/source/app/svapp.cxx @@ -479,7 +479,7 @@ inline bool ImplYield(bool i_bWait, bool i_bAllEvents, sal_uLong const nReleased ImplSVData* pSVData = ImplGetSVData(); SAL_INFO("vcl.schedule", "Enter ImplYield: " << (i_bWait ? "wait" : "no wait") << - ": " << (i_bAllEvents ? "all events" : "one event") << ": " << nReleased); + " / " << (i_bAllEvents ? "all events" : "one event") << " / " << nReleased); if ( i_bWait && Scheduler::HasPendingEvents() ) i_bWait = false; commit bfc04af5cee659f01feb3cd457e12c22f79b447d Author: Jan-Marek Glogowski <glo...@fbihome.de> Date: Wed Aug 10 12:33:21 2016 +0200 Readd SAL_INFOs to dump the Scheduler handling Debug area name is "vcl.schedule". Conflicts: include/sal/log-areas.dox vcl/source/app/scheduler.cxx Change-Id: Ia1eab69e76671bd33ce3324c5eb058e4e00dfdd2 diff --git a/vcl/source/app/scheduler.cxx b/vcl/source/app/scheduler.cxx index c9f1333..647dbb4 100644 --- a/vcl/source/app/scheduler.cxx +++ b/vcl/source/app/scheduler.cxx @@ -228,13 +228,19 @@ next_entry: pMostUrgent->mnUpdateTime = nTime; UpdateMinPeriod( pMostUrgent, nTime, nMinPeriod ); + Scheduler *pTempScheduler = pMostUrgent->mpScheduler; + SAL_INFO( "vcl.schedule", tools::Time::GetSystemTicks() << " " << pMostUrgent << " invoke " + << (int) pTempScheduler->mePriority << " " << pTempScheduler->mpDebugName ); pMostUrgent->Invoke(); + SAL_INFO_IF( !pMostUrgent->mpScheduler, "vcl.schedule", tools::Time::GetSystemTicks() + << " " << pMostUrgent << " tag-rm " ); } if ( nMinPeriod != InfiniteTimeoutMs && ((eIdleRunPolicy == IdleRunPolicy::IDLE_VIA_TIMER) || (nMinPeriod > ImmediateTimeoutMs)) ) { + SAL_INFO( "vcl.schedule", "Scheduler sleep timeout: " << nMinPeriod ); ImplStartTimer( nMinPeriod, true ); } else if ( pSVData->mpSalTimer ) @@ -280,7 +286,12 @@ void Scheduler::Start() pPrev->mpNext = mpSchedulerData; else pSVData->mpFirstSchedulerData = mpSchedulerData; + SAL_INFO( "vcl.schedule", tools::Time::GetSystemTicks() << " " << mpSchedulerData + << " added " << (int) mePriority << " " << mpDebugName ); } + else + SAL_INFO( "vcl.schedule", tools::Time::GetSystemTicks() << " " << mpSchedulerData + << " restarted " << (int) mePriority << " " << mpDebugName ); assert( mpSchedulerData->mpScheduler == this ); mpSchedulerData->mnUpdateTime = tools::Time::GetSystemTicks(); @@ -291,7 +302,10 @@ void Scheduler::Stop() { if ( !mpSchedulerData ) return; + ImplSchedulerData *pData = mpSchedulerData; Scheduler::SetDeletionFlags(); + SAL_INFO( "vcl.schedule", tools::Time::GetSystemTicks() << " " << pData + << " stopped " << (int) mePriority << " " << mpDebugName ); assert( !mpSchedulerData ); } commit d9bb1b7eeef541ac3e973ec2324f7d8bb8a62e2d Author: Jan-Marek Glogowski <glo...@fbihome.de> Date: Wed Sep 14 18:17:18 2016 +0200 Don't poll busy documents via idle task Creates a very busy idle-loop, for non-task work like mail merge. Change-Id: If7be82e4675008f23e6f4f6be5c40df40a231a8b diff --git a/sw/source/core/doc/DocumentTimerManager.cxx b/sw/source/core/doc/DocumentTimerManager.cxx index 3c1369d..cb96054 100644 --- a/sw/source/core/doc/DocumentTimerManager.cxx +++ b/sw/source/core/doc/DocumentTimerManager.cxx @@ -40,47 +40,50 @@ namespace sw DocumentTimerManager::DocumentTimerManager( SwDoc& i_rSwdoc ) : m_rDoc( i_rSwdoc ), mbStartIdleTimer( false ), mIdleBlockCount( 0 ), - maIdle("DocumentTimerManagerIdleTimer") + maDocIdleTimer("DocumentTimerManagerIdleTimer") { - maIdle.SetPriority( SchedulerPriority::LOWEST ); - maIdle.SetIdleHdl( LINK( this, DocumentTimerManager, DoIdleJobs) ); - maIdle.SetDebugName( "sw::DocumentTimerManager maIdle" ); + maDocIdleTimer.SetPriority( SchedulerPriority::LOWEST ); + maDocIdleTimer.SetTimeoutHdl( LINK( this, DocumentTimerManager, DoIdleJobs) ); + maDocIdleTimer.SetDebugName( "sw::DocumentTimerManager maDocIdleTimer" ); } void DocumentTimerManager::StartIdling() { mbStartIdleTimer = true; if( !mIdleBlockCount ) - maIdle.Start(); + { + maDocIdleTimer.SetTimeout( 0 ); + maDocIdleTimer.Start(); + } } void DocumentTimerManager::StopIdling() { mbStartIdleTimer = false; - maIdle.Stop(); + maDocIdleTimer.Stop(); } void DocumentTimerManager::BlockIdling() { - maIdle.Stop(); + maDocIdleTimer.Stop(); ++mIdleBlockCount; } void DocumentTimerManager::UnblockIdling() { --mIdleBlockCount; - if( !mIdleBlockCount && mbStartIdleTimer && !maIdle.IsActive() ) - maIdle.Start(); + if( !mIdleBlockCount && mbStartIdleTimer && !maDocIdleTimer.IsActive() ) + maDocIdleTimer.Start(); } void DocumentTimerManager::StartBackgroundJobs() { // Trigger DoIdleJobs(), asynchronously. - if (!maIdle.IsActive()) //fdo#73165 if the timer is already running don't restart from 0 - maIdle.Start(); + if (!maDocIdleTimer.IsActive()) //fdo#73165 if the timer is already running don't restart from 0 + maDocIdleTimer.Start(); } -IMPL_LINK_TYPED( DocumentTimerManager, DoIdleJobs, Idle*, pIdle, void ) +IMPL_LINK_TYPED( DocumentTimerManager, DoIdleJobs, Timer*, pTimer, void ) { #ifdef TIMELOG static ::rtl::Logfile* pModLogFile = 0; @@ -97,7 +100,8 @@ IMPL_LINK_TYPED( DocumentTimerManager, DoIdleJobs, Idle*, pIdle, void ) { if( rSh.ActionPend() ) { - pIdle->Start(); + pTimer->SetTimeout( 2000 ); + pTimer->Start(); return; } } @@ -121,7 +125,8 @@ IMPL_LINK_TYPED( DocumentTimerManager, DoIdleJobs, Idle*, pIdle, void ) (*pLayIter)->GetCurrShell()->LayoutIdle(); // Defer the remaining work. - pIdle->Start(); + pTimer->SetTimeout( 2000 ); + pTimer->Start(); return; } } @@ -137,7 +142,8 @@ IMPL_LINK_TYPED( DocumentTimerManager, DoIdleJobs, Idle*, pIdle, void ) if ( m_rDoc.getIDocumentFieldsAccess().GetUpdateFields().IsInUpdateFields() || m_rDoc.getIDocumentFieldsAccess().IsExpFieldsLocked() ) { - pIdle->Start(); + pTimer->SetTimeout( 2000 ); + pTimer->Start(); return; } diff --git a/sw/source/core/inc/DocumentTimerManager.hxx b/sw/source/core/inc/DocumentTimerManager.hxx index cf6b580..2644e45 100644 --- a/sw/source/core/inc/DocumentTimerManager.hxx +++ b/sw/source/core/inc/DocumentTimerManager.hxx @@ -48,7 +48,7 @@ public: void StartBackgroundJobs() override; // Our own 'IdleTimer' calls the following method - DECL_LINK_TYPED( DoIdleJobs, Idle *, void ); + DECL_LINK_TYPED( DoIdleJobs, Timer *, void ); virtual ~DocumentTimerManager() override; @@ -61,7 +61,7 @@ private: bool mbStartIdleTimer; //< idle timer mode start/stop sal_Int32 mIdleBlockCount; - Idle maIdle; + Timer maDocIdleTimer; }; } commit 0c7546e61c79c3f9944e884eadbd8d230329e9d3 Author: Jan-Marek Glogowski <glo...@fbihome.de> Date: Wed Sep 14 15:33:54 2016 +0200 Run Idle tasks immediatly There is really no reason to wait a millisecond for an idle. Change-Id: I7665d5f2e7d6ba3e01290a692bbc8e42c36b9986 diff --git a/include/vcl/scheduler.hxx b/include/vcl/scheduler.hxx index 31ef8f2..308078b 100644 --- a/include/vcl/scheduler.hxx +++ b/include/vcl/scheduler.hxx @@ -36,6 +36,11 @@ enum class SchedulerPriority { LOWEST ///< Low, very idle cleanup tasks }; +enum class IdleRunPolicy { + IDLE_VIA_TIMER, ///< Idles are scheduled via immediate timers (ImmediateTimeoutMs) + IDLE_VIA_LOOP ///< Return indicates processed events, so they are processed in a loop +}; + class VCL_DLLPUBLIC Scheduler { friend struct ImplSchedulerData; @@ -51,7 +56,7 @@ protected: const sal_Char *mpDebugName; /// Useful for debugging SchedulerPriority mePriority; /// Scheduler priority - static const SAL_CONSTEXPR sal_uInt64 ImmediateTimeoutMs = 1; + static const SAL_CONSTEXPR sal_uInt64 ImmediateTimeoutMs = 0; static const SAL_CONSTEXPR sal_uInt64 InfiniteTimeoutMs = SAL_MAX_UINT64; static void ImplStartTimer(sal_uInt64 nMS, bool bForce = false); @@ -81,12 +86,13 @@ public: inline bool IsActive() const; Scheduler& operator=( const Scheduler& rScheduler ); - static void ImplDeInitScheduler(); + static void ImplDeInitScheduler(); /// Process one pending Timer with highhest priority static void CallbackTaskScheduling(); /// Process one pending task ahead of time with highest priority. - static bool ProcessTaskScheduling(); + static bool ProcessTaskScheduling( IdleRunPolicy eIdleRunPolicy + = IdleRunPolicy::IDLE_VIA_TIMER ); /// Process all events until we are idle static void ProcessAllPendingEvents(); /// Are there any pending tasks in the LO task queue? diff --git a/vcl/source/app/scheduler.cxx b/vcl/source/app/scheduler.cxx index 37c0565..c9f1333 100644 --- a/vcl/source/app/scheduler.cxx +++ b/vcl/source/app/scheduler.cxx @@ -115,9 +115,6 @@ void Scheduler::ImplStartTimer( sal_uInt64 nMS, bool bForce ) pSVData->mpSalTimer->SetCallback(Scheduler::CallbackTaskScheduling); } - if ( !nMS ) - nMS = 1; - // Only if smaller timeout, to avoid skipping. if (nMS < pSVData->mnTimerPeriod || (bForce && nMS != pSVData->mnTimerPeriod) ) { @@ -164,10 +161,9 @@ inline void Scheduler::UpdateMinPeriod( ImplSchedulerData *pSchedulerData, { if ( nMinPeriod > ImmediateTimeoutMs ) pSchedulerData->mpScheduler->UpdateMinPeriod( nTime, nMinPeriod ); - assert( nMinPeriod >= ImmediateTimeoutMs ); } -bool Scheduler::ProcessTaskScheduling() +bool Scheduler::ProcessTaskScheduling( IdleRunPolicy eIdleRunPolicy ) { ImplSVData* pSVData = ImplGetSVData(); sal_uInt64 nTime = tools::Time::GetSystemTicks(); @@ -235,8 +231,12 @@ next_entry: pMostUrgent->Invoke(); } - if ( nMinPeriod != InfiniteTimeoutMs ) + if ( nMinPeriod != InfiniteTimeoutMs + && ((eIdleRunPolicy == IdleRunPolicy::IDLE_VIA_TIMER) + || (nMinPeriod > ImmediateTimeoutMs)) ) + { ImplStartTimer( nMinPeriod, true ); + } else if ( pSVData->mpSalTimer ) pSVData->mpSalTimer->Stop(); diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx index bd69e43..374eaa5 100644 --- a/vcl/source/app/svapp.cxx +++ b/vcl/source/app/svapp.cxx @@ -532,14 +532,14 @@ void Application::Reschedule( bool i_bAllEvents ) void Scheduler::ProcessAllPendingEvents() { - int nSanity = 1000; - while( Scheduler::ProcessTaskScheduling() || - ImplYield(false, true, 0) ) + int nSanity = 1; + // nReleased == 1, because we don't run the LO event loop via timer + while( ImplYield( false, true, 1 ) + || Scheduler::ProcessTaskScheduling(IdleRunPolicy::IDLE_VIA_LOOP) ) { - if (nSanity-- < 0) + if (0 == ++nSanity % 1000) { - SAL_WARN("vcl.schedule", "Unexpected volume of events to process"); - break; + SAL_WARN("vcl.schedule", "ProcessAllPendingEvents: " << nSanity); } } } commit 188bbc40ced6d2b2bd710a43e6a58ae31f7750a0 Author: Jan-Marek Glogowski <glo...@fbihome.de> Date: Wed Sep 14 13:48:02 2016 +0200 Change Idle to be a actually a Timer subclass Drops a lot of duplicated code and actually reflects the Scheduler handling of "Idle" in the source code. Change-Id: I847592e92e86d15ab1cab168bf0e667322e48048 diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx index f389ced..c2a2b00 100644 --- a/basctl/source/basicide/baside2b.cxx +++ b/basctl/source/basicide/baside2b.cxx @@ -1343,7 +1343,7 @@ void EditorWindow::DestroyProgress() void EditorWindow::ForceSyntaxTimeout() { aSyntaxIdle.Stop(); - aSyntaxIdle.GetIdleHdl().Call(&aSyntaxIdle); + aSyntaxIdle.Invoke(); } // BreakPointWindow diff --git a/editeng/source/editeng/impedit5.cxx b/editeng/source/editeng/impedit5.cxx index e360c0a..fb126b4 100644 --- a/editeng/source/editeng/impedit5.cxx +++ b/editeng/source/editeng/impedit5.cxx @@ -810,7 +810,7 @@ void IdleFormattter::ForceTimeout() if ( IsActive() ) { Stop(); - ((Link<Idle *, void>&)GetIdleHdl()).Call( this ); + Invoke(); } } diff --git a/framework/source/layoutmanager/layoutmanager.cxx b/framework/source/layoutmanager/layoutmanager.cxx index 17c106f..7b6e279 100644 --- a/framework/source/layoutmanager/layoutmanager.cxx +++ b/framework/source/layoutmanager/layoutmanager.cxx @@ -2683,8 +2683,7 @@ throw( uno::RuntimeException, std::exception ) m_bMustDoLayout = true; if ( !m_aAsyncLayoutTimer.IsActive() ) { - const Link<Timer *, void>& aLink = m_aAsyncLayoutTimer.GetTimeoutHdl(); - aLink.Call( &m_aAsyncLayoutTimer ); + m_aAsyncLayoutTimer.Invoke(); } if ( m_nLockCount == 0 ) m_aAsyncLayoutTimer.Start(); diff --git a/include/tools/link.hxx b/include/tools/link.hxx index f46e84e..ea8fe1a 100644 --- a/include/tools/link.hxx +++ b/include/tools/link.hxx @@ -102,6 +102,7 @@ public: { return function_ == other.function_ && instance_ == other.instance_; }; void *GetInstance() const { return instance_; } + Stub* GetFunction() const { return function_; } private: Stub * function_; diff --git a/include/vcl/idle.hxx b/include/vcl/idle.hxx index f50e329..b2834d4 100644 --- a/include/vcl/idle.hxx +++ b/include/vcl/idle.hxx @@ -20,34 +20,46 @@ #ifndef INCLUDED_VCL_IDLE_HXX #define INCLUDED_VCL_IDLE_HXX -#include <tools/link.hxx> -#include <vcl/scheduler.hxx> +#include <vcl/timer.hxx> -class VCL_DLLPUBLIC Idle : public Scheduler +/** + * An idle is a low priority timer to be scheduled immediately. + * + * Therefore the timeout is set to ImmediateTimeoutMs and the initial, + * priority is DEFAULT_IDLE. + * + * It's - more or less - just a convenience class. + */ +class VCL_DLLPUBLIC Idle : public Timer { -protected: - Link<Idle *, void> maIdleHdl; // Callback Link - bool mbAuto; - - virtual void SetDeletionFlags() override; +private: + // Delete all timeout specific functions, we don't want in an Idle + void SetTimeout( sal_uInt64 nTimeoutMs ) = delete; + sal_uInt64 GetTimeout() const = delete; +protected: virtual bool ReadyForSchedule( const sal_uInt64 nTime ) const override; virtual void UpdateMinPeriod( const sal_uInt64 nTime, sal_uInt64 &nMinPeriod ) const override; public: Idle( const sal_Char *pDebugName = nullptr ); - Idle( const Idle& rIdle ); - virtual void Start() override; + virtual void Start() override; - /// Make it possible to associate a callback with this idle handler - /// of course, you can also sub-class and override 'Invoke' - void SetIdleHdl( const Link<Idle *, void>& rLink ) { maIdleHdl = rLink; } - const Link<Idle *, void>& GetIdleHdl() const { return maIdleHdl; } - virtual void Invoke() override; - Idle& operator=( const Idle& rIdle ); + /** + * Convenience function for more readable code + * + * TODO: actually rename it and it's instances to SetInvokeHandler + */ + inline void SetIdleHdl( const Link<Idle *, void>& rLink ); }; +inline void Idle::SetIdleHdl( const Link<Idle*, void> &rLink ) +{ + SetInvokeHandler( Link<Timer*, void>( rLink.GetInstance(), + reinterpret_cast< Link<Timer*, void>::Stub* >( rLink.GetFunction()) ) ); +} + /** * An auto-idle is long running task processing small chunks of data, which * is re-scheduled multiple times. @@ -61,8 +73,6 @@ class VCL_DLLPUBLIC AutoIdle : public Idle { public: AutoIdle( const sal_Char *pDebugName = nullptr ); - AutoIdle( const AutoIdle& rIdle ); - AutoIdle& operator=( const AutoIdle& rIdle ); }; #endif // INCLUDED_VCL_IDLE_HXX diff --git a/include/vcl/timer.hxx b/include/vcl/timer.hxx index 4f7e3d8..2cfa96a 100644 --- a/include/vcl/timer.hxx +++ b/include/vcl/timer.hxx @@ -26,9 +26,9 @@ class VCL_DLLPUBLIC Timer : public Scheduler { protected: - Link<Timer *, void> maTimeoutHdl; // Callback Link - sal_uInt64 mnTimeout; - bool mbAuto; + Link<Timer *, void> maInvokeHandler; ///< Callback Link + sal_uInt64 mnTimeout; + bool mbAuto; virtual void SetDeletionFlags() override; @@ -37,29 +37,45 @@ protected: public: Timer( const sal_Char *pDebugName = nullptr ); - Timer( const Timer& rTimer ); - /// Make it possible to associate a callback with this timer handler - /// of course, you can also sub-class and override 'Invoke' - void SetTimeoutHdl( const Link<Timer *, void>& rLink ) { maTimeoutHdl = rLink; } - const Link<Timer *, void>& GetTimeoutHdl() const { return maTimeoutHdl; } + /** + * Calls the maInvokeHandler with the parameter this. + */ + virtual void Invoke() override; + /** + * Calls the maInvokeHandler with the parameter. + * + * Convenience Invoke function, mainly used to call with nullptr. + * + * @param arg parameter for the Link::Call function + */ + void Invoke( Timer *arg ); + void SetInvokeHandler( const Link<Timer *, void>& rLink ) { maInvokeHandler = rLink; } + bool HasInvokeHandler() const { return maInvokeHandler.IsSet(); }; + + /** + * Convenience function for more readable code + * + * TODO: actually use SetInvokeHandler and drop it + */ + inline void SetTimeoutHdl( const Link<Timer *, void>& rLink ); + void SetTimeout( sal_uInt64 nTimeoutMs ); sal_uInt64 GetTimeout() const { return mnTimeout; } - virtual void Invoke() override; - void Timeout() { Invoke(); } - Timer& operator=( const Timer& rTimer ); virtual void Start() override; }; +inline void Timer::SetTimeoutHdl( const Link<Timer *, void>& rLink ) +{ + SetInvokeHandler( rLink ); +} + /// An auto-timer is a multi-shot timer re-emitting itself at /// interval until destroyed. class VCL_DLLPUBLIC AutoTimer : public Timer { public: - AutoTimer(); - AutoTimer( const AutoTimer& rTimer ); - - AutoTimer& operator=( const AutoTimer& rTimer ); + AutoTimer( const sal_Char *pDebugName = nullptr ); }; #endif // INCLUDED_VCL_TIMER_HXX diff --git a/sc/source/core/tool/refreshtimer.cxx b/sc/source/core/tool/refreshtimer.cxx index cb83c4c..954c132 100644 --- a/sc/source/core/tool/refreshtimer.cxx +++ b/sc/source/core/tool/refreshtimer.cxx @@ -120,7 +120,7 @@ void ScRefreshTimer::Invoke() { // now we COULD make the call in another thread ... ::osl::MutexGuard aGuard( (*ppControl)->GetMutex() ); - maTimeoutHdl.Call( this ); + Timer::Invoke(); // restart from now on, don't execute immediately again if timed out // a second time during refresh if ( IsActive() ) diff --git a/solenv/gdb/libreoffice/vcl.py b/solenv/gdb/libreoffice/vcl.py index 76ca27c..c7b4bf3 100644 --- a/solenv/gdb/libreoffice/vcl.py +++ b/solenv/gdb/libreoffice/vcl.py @@ -27,10 +27,11 @@ class ImplSchedulerDataPrinter(object): def as_string(self, gdbobj): if gdbobj['mpScheduler']: sched = gdbobj['mpScheduler'].dereference() - if gdbobj['mpScheduler'].dynamic_cast( self.timer_type_ptr ): - sched_type = "Timer" - elif gdbobj['mpScheduler'].dynamic_cast( self.idle_type_ptr ): + timer = gdbobj['mpScheduler'].dynamic_cast( self.timer_type_ptr ) + if gdbobj['mpScheduler'].dynamic_cast( self.idle_type_ptr ): sched_type = "Idle" + elif timer: + sched_type = "Timer" else: assert sched_type, "Scheduler object neither Timer nor Idle" res = "{:7s}{:10s}".format( sched_type, str(sched['mePriority']) ) @@ -39,6 +40,12 @@ class ImplSchedulerDataPrinter(object): res = "{} (scheduler debug name not set) ({})".format(res, str(sched.dynamic_type)) else: res = "{} '{}' ({})".format(res, str(name.string()), str(sched.dynamic_type)) + val_type = gdb.lookup_type(str( sched.dynamic_type )).pointer() + timer = gdbobj['mpScheduler'].cast( val_type ) + if (sched_type == "Timer"): + res = "{}: {}ms".format(res, timer['mnTimeout']) + else: + assert 0 == timer['mnTimeout'], "Idle with timeout == {}".format( timer['mnTimeout'] ) return res else: return "(no scheduler - to be deleted)" diff --git a/vcl/source/app/idle.cxx b/vcl/source/app/idle.cxx index 5224c77..f2c6264 100644 --- a/vcl/source/app/idle.cxx +++ b/vcl/source/app/idle.cxx @@ -20,42 +20,15 @@ #include <vcl/idle.hxx> #include "saltimer.hxx" -void Idle::SetDeletionFlags() -{ - // If no AutoIdle, then stop. - if ( !mbAuto ) - Scheduler::SetDeletionFlags(); -} - -void Idle::Invoke() -{ - maIdleHdl.Call( this ); -} - -Idle& Idle::operator=( const Idle& rIdle ) -{ - Scheduler::operator=(rIdle); - maIdleHdl = rIdle.maIdleHdl; - mbAuto = rIdle.mbAuto; - return *this; -} - Idle::Idle( const sal_Char *pDebugName ) - : Scheduler( pDebugName ) - , mbAuto( false ) + : Timer( pDebugName ) { mePriority = SchedulerPriority::DEFAULT_IDLE; } -Idle::Idle( const Idle& rIdle ) : Scheduler(rIdle) -{ - maIdleHdl = rIdle.maIdleHdl; - mbAuto = rIdle.mbAuto; -} - void Idle::Start() { - Scheduler::Start(); + Timer::Start(); sal_uInt64 nPeriod = Scheduler::ImmediateTimeoutMs; if (Scheduler::GetDeterministicMode()) @@ -88,17 +61,7 @@ void Idle::UpdateMinPeriod( const sal_uInt64 /* nTime */, sal_uInt64 &nMinPeriod AutoIdle::AutoIdle( const sal_Char *pDebugName ) : Idle( pDebugName ) { -} - -AutoIdle::AutoIdle( const AutoIdle& rIdle ) : Idle( rIdle ) -{ mbAuto = true; } -AutoIdle& AutoIdle::operator=( const AutoIdle& rIdle ) -{ - Idle::operator=( rIdle ); - return *this; -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/app/timer.cxx b/vcl/source/app/timer.cxx index 8a30fe1..8e02235 100644 --- a/vcl/source/app/timer.cxx +++ b/vcl/source/app/timer.cxx @@ -46,25 +46,22 @@ void Timer::UpdateMinPeriod( const sal_uInt64 nTime, sal_uInt64 &nMinPeriod ) co } } -Timer::Timer(const sal_Char *pDebugName) : - Scheduler(pDebugName), - mnTimeout(ImmediateTimeoutMs), - mbAuto(false) +Timer::Timer(const sal_Char *pDebugName) + : Scheduler( pDebugName ) + , mnTimeout( ImmediateTimeoutMs ) + , mbAuto( false ) { mePriority = SchedulerPriority::DEFAULT; } -Timer::Timer( const Timer& rTimer ) : - Scheduler(rTimer), - mnTimeout(rTimer.mnTimeout), - mbAuto(rTimer.mbAuto) +void Timer::Invoke() { - maTimeoutHdl = rTimer.maTimeoutHdl; + maInvokeHandler.Call( this ); } -void Timer::Invoke() +void Timer::Invoke( Timer *arg ) { - maTimeoutHdl.Call( this ); + maInvokeHandler.Call( arg ); } void Timer::Start() @@ -83,28 +80,10 @@ void Timer::SetTimeout( sal_uInt64 nNewTimeout ) } } -Timer& Timer::operator=( const Timer& rTimer ) -{ - Scheduler::operator=(rTimer); - maTimeoutHdl = rTimer.maTimeoutHdl; - mnTimeout = rTimer.mnTimeout; - mbAuto = rTimer.mbAuto; - return *this; -} - -AutoTimer::AutoTimer() +AutoTimer::AutoTimer( const sal_Char *pDebugName ) + : Timer( pDebugName ) { mbAuto = true; } -AutoTimer::AutoTimer( const AutoTimer& rTimer ) : Timer( rTimer ) -{ - mbAuto = true; -} - -AutoTimer& AutoTimer::operator=( const AutoTimer& rTimer ) -{ - Timer::operator=( rTimer ); - return *this; -} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx index d1b4601..526e4ea 100644 --- a/vcl/source/control/edit.cxx +++ b/vcl/source/control/edit.cxx @@ -1923,7 +1923,7 @@ void Edit::LoseFocus() { //notify an update latest when the focus is lost mpUpdateDataTimer->Stop(); - mpUpdateDataTimer->Timeout(); + mpUpdateDataTimer->Invoke(); } if ( !mpSubEdit ) diff --git a/vcl/source/edit/textdata.cxx b/vcl/source/edit/textdata.cxx index 7974f52..cd4413c 100644 --- a/vcl/source/edit/textdata.cxx +++ b/vcl/source/edit/textdata.cxx @@ -293,7 +293,7 @@ void IdleFormatter::DoIdleFormat( TextView* pV, sal_uInt16 nMaxRestarts ) if ( mnRestarts > nMaxRestarts ) { mnRestarts = 0; - ((Link<Idle *, void>&)GetIdleHdl()).Call( this ); + Invoke(); } else { @@ -307,7 +307,7 @@ void IdleFormatter::ForceTimeout() { Stop(); mnRestarts = 0; - ((Link<Idle *, void>&)GetIdleHdl()).Call( this ); + Invoke(); } } diff --git a/vcl/source/window/paint.cxx b/vcl/source/window/paint.cxx index cc66017..6a5565e 100644 --- a/vcl/source/window/paint.cxx +++ b/vcl/source/window/paint.cxx @@ -674,7 +674,7 @@ IMPL_LINK_NOARG_TYPED(Window, ImplHandleResizeTimerHdl, Idle *, void) if( mpWindowImpl->mpFrameData->maPaintIdle.IsActive() ) { mpWindowImpl->mpFrameData->maPaintIdle.Stop(); - mpWindowImpl->mpFrameData->maPaintIdle.GetIdleHdl().Call( nullptr ); + mpWindowImpl->mpFrameData->maPaintIdle.Invoke( nullptr ); } } } diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index 2e1b9d5..5ee3763 100644 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -2395,7 +2395,7 @@ Size Window::GetSizePixel() const { VclPtr<vcl::Window> xWindow( const_cast<Window*>(this) ); mpWindowImpl->mpFrameData->maResizeIdle.Stop(); - mpWindowImpl->mpFrameData->maResizeIdle.GetIdleHdl().Call( nullptr ); + mpWindowImpl->mpFrameData->maResizeIdle.Invoke( nullptr ); if( xWindow->IsDisposed() ) return Size(0,0); } commit f5c8c97f7dbaaef2f213a251af6933a7759c68c9 Author: Jan-Marek Glogowski <glo...@fbihome.de> Date: Mon Sep 12 18:24:14 2016 +0200 Handle all main loop and task events Change-Id: I75ed5a38b0e24966dafcfdd2ea4cb8afc93a8a0c diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx index 852c090..bd69e43 100644 --- a/vcl/source/app/svapp.cxx +++ b/vcl/source/app/svapp.cxx @@ -506,7 +506,14 @@ inline bool ImplYield(bool i_bWait, bool i_bAllEvents, sal_uLong const nReleased if (nReleased == 0) // tdf#99383 don't run stuff from ReAcquireSolarMutex { // Process all Tasks - bProcessedEvent = Scheduler::ProcessTaskScheduling() || bProcessedEvent; + do + { + bool bScheduledEevent = Scheduler::ProcessTaskScheduling(); + bProcessedEvent |= bScheduledEevent; + if (!bScheduledEevent) + break; + } + while ( i_bAllEvents ); } // flush lazy deleted objects commit 3d42c85060b30d6fffbbb4882be8956f0f12e298 Author: Jan-Marek Glogowski <glo...@fbihome.de> Date: Wed Aug 10 12:00:53 2016 +0200 Reorganize Scheduler priority classes This is based on glibs classification of tasks, but while glib uses an int for more fine grained priority, we stay with our enum. 1. Timers start with DEFAULT priority, which directly corresponds with the previous HIGH priority 2. Idles start with DEFAULT_IDLE priority instead of the previous HIGH priority, so idle default becomes "really run when idle". As RESIZE and REPAINT are special, and the DEFAULTS are set, there is just one primary decision for the programmer: should my idle run before paint (AKA HIGH_IDLE)? If we really need a more fine-grained classification, we can add it later, or also switch to a real int. As a result, this drops many classifications from the code and drastically changes behaviour, AKA a mail merge from KDE is now as fast as Gtk+ again. Conflicts: cui/source/tabpages/macroass.cxx desktop/source/deployment/gui/dp_gui_dialog2.cxx include/vcl/scheduler.hxx sc/source/core/tool/dbdata.cxx sc/source/ui/formdlg/dwfunctr.cxx sc/source/ui/miscdlgs/anyrefdg.cxx sd/source/ui/dlg/dlgass.cxx sd/source/ui/slideshow/slideshowimpl.cxx svx/source/inc/eventhandler.hxx svx/source/sdr/overlay/overlaymanagerbuffered.cxx sw/source/uibase/docvw/srcedtw.cxx sw/source/uibase/utlui/unotools.cxx vcl/source/app/idle.cxx vcl/source/app/scheduler.cxx vcl/source/app/timer.cxx Change-Id: I498a73fd02d5fb6f5d7e9f742f3bce972de9b1f9 diff --git a/avmedia/source/framework/mediacontrol.cxx b/avmedia/source/framework/mediacontrol.cxx index b2c12c0..958e68e 100644 --- a/avmedia/source/framework/mediacontrol.cxx +++ b/avmedia/source/framework/mediacontrol.cxx @@ -114,7 +114,7 @@ MediaControl::MediaControl( vcl::Window* pParent, MediaControlStyle eControlStyl mpZoomToolBox->SetPaintTransparent( true ); } - maIdle.SetPriority( SchedulerPriority::LOW ); + maIdle.SetPriority( SchedulerPriority::HIGH_IDLE ); maIdle.SetIdleHdl( LINK( this, MediaControl, implTimeoutHdl ) ); maIdle.Start(); } diff --git a/avmedia/source/framework/soundhandler.cxx b/avmedia/source/framework/soundhandler.cxx index 785f6ce..d4a63ef 100644 --- a/avmedia/source/framework/soundhandler.cxx +++ b/avmedia/source/framework/soundhandler.cxx @@ -221,7 +221,7 @@ void SAL_CALL SoundHandler::dispatchWithNotification(const css::util::URL& // Count this request and initialize self-holder against dying by uno ref count ... m_xSelfHold.set(static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY); m_xPlayer->start(); - m_aUpdateIdle.SetPriority( SchedulerPriority::LOWER ); + m_aUpdateIdle.SetPriority( SchedulerPriority::HIGH_IDLE ); m_aUpdateIdle.Start(); } catch( css::uno::Exception& e ) diff --git a/avmedia/source/opengl/oglplayer.cxx b/avmedia/source/opengl/oglplayer.cxx index 4077e3b..358dac7 100644 --- a/avmedia/source/opengl/oglplayer.cxx +++ b/avmedia/source/opengl/oglplayer.cxx @@ -123,7 +123,7 @@ bool OGLPlayer::create( const OUString& rURL ) // Set timer m_aTimer.SetTimeout(8); // is 125fps enough for anyone ? - m_aTimer.SetPriority(SchedulerPriority::LOW); + m_aTimer.SetPriority(SchedulerPriority::HIGH_IDLE); m_aTimer.SetTimeoutHdl(LINK(this,OGLPlayer,TimerHandler)); return true; diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx index 1c31380..f389ced 100644 --- a/basctl/source/basicide/baside2b.cxx +++ b/basctl/source/basicide/baside2b.cxx @@ -961,7 +961,6 @@ void EditorWindow::CreateEditEngine() ImplSetFont(); - aSyntaxIdle.SetPriority( SchedulerPriority::LOWER ); aSyntaxIdle.SetIdleHdl( LINK( this, EditorWindow, SyntaxTimerHdl ) ); bool bWasDoSyntaxHighlight = bDoSyntaxHighlight; diff --git a/basctl/source/dlged/dlged.cxx b/basctl/source/dlged/dlged.cxx index 157a2eb..6d9a150 100644 --- a/basctl/source/dlged/dlged.cxx +++ b/basctl/source/dlged/dlged.cxx @@ -218,7 +218,6 @@ DlgEditor::DlgEditor ( m_ClipboardDataFlavorsResource[1].HumanPresentableName = "Dialog 8.0" ; m_ClipboardDataFlavorsResource[1].DataType = cppu::UnoType<Sequence< sal_Int8 >>::get(); - aMarkIdle.SetPriority(SchedulerPriority::LOW); aMarkIdle.SetIdleHdl( LINK( this, DlgEditor, MarkTimeout ) ); rWindow.SetMapMode( MapMode( MAP_100TH_MM ) ); diff --git a/cui/source/options/optjava.cxx b/cui/source/options/optjava.cxx index 70db945..83f70b9 100644 --- a/cui/source/options/optjava.cxx +++ b/cui/source/options/optjava.cxx @@ -186,7 +186,6 @@ SvxJavaOptionsPage::SvxJavaOptionsPage( vcl::Window* pParent, const SfxItemSet& m_pParameterBtn->SetClickHdl( LINK( this, SvxJavaOptionsPage, ParameterHdl_Impl ) ); m_pClassPathBtn->SetClickHdl( LINK( this, SvxJavaOptionsPage, ClassPathHdl_Impl ) ); m_aResetIdle.SetIdleHdl( LINK( this, SvxJavaOptionsPage, ResetHdl_Impl ) ); - m_aResetIdle.SetPriority(SchedulerPriority::LOWER); m_pExpertConfigBtn->SetClickHdl( LINK( this, SvxJavaOptionsPage, ExpertConfigHdl_Impl) ); if (!officecfg::Office::Common::Security::EnableExpertConfiguration::get()) diff --git a/cui/source/tabpages/macroass.cxx b/cui/source/tabpages/macroass.cxx index bb4ede3..97d293b 100644 --- a/cui/source/tabpages/macroass.cxx +++ b/cui/source/tabpages/macroass.cxx @@ -138,7 +138,7 @@ SfxMacroTabPage::SfxMacroTabPage(vcl::Window* pParent, const Reference< XFrame > mpImpl.reset(new SfxMacroTabPage_Impl); mpImpl->maFillGroupIdle.SetIdleHdl( LINK( this, SfxMacroTabPage, TimeOut_Impl ) ); - mpImpl->maFillGroupIdle.SetPriority( SchedulerPriority::HIGHEST ); + mpImpl->maFillGroupIdle.SetPriority( SchedulerPriority::HIGH_IDLE ); mpImpl->maFillGroupIdle.SetDebugName( "SfxMacroTabPage maFillGroupIdle" ); mpImpl->sStrEvent = get<FixedText>("eventft")->GetText(); diff --git a/dbaccess/source/ui/querydesign/JoinTableView.cxx b/dbaccess/source/ui/querydesign/JoinTableView.cxx index 657582f..ff429b7 100644 --- a/dbaccess/source/ui/querydesign/JoinTableView.cxx +++ b/dbaccess/source/ui/querydesign/JoinTableView.cxx @@ -1063,7 +1063,7 @@ void OJoinTableView::ScrollWhileDragging() // resetting timer, if still necessary if (bNeedScrollTimer) { - m_aDragScrollIdle.SetPriority(SchedulerPriority::LOW); + m_aDragScrollIdle.SetPriority( SchedulerPriority::HIGH_IDLE ); m_aDragScrollIdle.Start(); } diff --git a/desktop/source/deployment/gui/dp_gui_dialog2.cxx b/desktop/source/deployment/gui/dp_gui_dialog2.cxx index 7c14fb3..99ee193 100644 --- a/desktop/source/deployment/gui/dp_gui_dialog2.cxx +++ b/desktop/source/deployment/gui/dp_gui_dialog2.cxx @@ -1202,7 +1202,6 @@ UpdateRequiredDialog::UpdateRequiredDialog(vcl::Window *pParent, TheExtensionMan m_pUpdateBtn->Enable( false ); m_pCloseBtn->GrabFocus(); - m_aIdle.SetPriority( SchedulerPriority::LOWEST ); m_aIdle.SetIdleHdl( LINK( this, UpdateRequiredDialog, TimeOutHdl ) ); } diff --git a/formula/source/ui/dlg/formula.cxx b/formula/source/ui/dlg/formula.cxx index b24759e..c87cc68 100644 --- a/formula/source/ui/dlg/formula.cxx +++ b/formula/source/ui/dlg/formula.cxx @@ -1803,7 +1803,6 @@ OUString FormulaDlg::GetMeText() const void FormulaDlg::Update() { m_pImpl->Update(); - m_pImpl->aIdle.SetPriority(SchedulerPriority::LOWER); m_pImpl->aIdle.SetIdleHdl(LINK( this, FormulaDlg, UpdateFocusHdl)); m_pImpl->aIdle.Start(); } diff --git a/formula/source/ui/dlg/funcutl.cxx b/formula/source/ui/dlg/funcutl.cxx index d67bb00..6168fc4 100644 --- a/formula/source/ui/dlg/funcutl.cxx +++ b/formula/source/ui/dlg/funcutl.cxx @@ -435,7 +435,6 @@ RefEdit::RefEdit( vcl::Window* _pParent, vcl::Window* pShrinkModeLabel, WinBits , pLabelWidget(pShrinkModeLabel) { aIdle.SetIdleHdl( LINK( this, RefEdit, UpdateHdl ) ); - aIdle.SetPriority( SchedulerPriority::LOW ); } RefEdit::RefEdit( vcl::Window* _pParent,IControlReferenceHandler* pParent, @@ -446,7 +445,6 @@ RefEdit::RefEdit( vcl::Window* _pParent,IControlReferenceHandler* pParent, , pLabelWidget(pShrinkModeLabel) { aIdle.SetIdleHdl( LINK( this, RefEdit, UpdateHdl ) ); - aIdle.SetPriority( SchedulerPriority::LOW ); } VCL_BUILDER_DECL_FACTORY(RefEdit) @@ -515,7 +513,6 @@ void RefEdit::SetReferences( IControlReferenceHandler* pDlg, vcl::Window* pLabel if( pDlg ) { aIdle.SetIdleHdl( LINK( this, RefEdit, UpdateHdl ) ); - aIdle.SetPriority( SchedulerPriority::LOW ); } else { diff --git a/include/vcl/scheduler.hxx b/include/vcl/scheduler.hxx index 1ab02eb..31ef8f2 100644 --- a/include/vcl/scheduler.hxx +++ b/include/vcl/scheduler.hxx @@ -26,16 +26,14 @@ struct ImplSchedulerData; struct ImplSVData; enum class SchedulerPriority { - HIGHEST = 0, - HIGH = 1, - RESIZE = 2, - REPAINT = 3, - MEDIUM = 3, - POST_PAINT = 4, - DEFAULT_IDLE = 5, - LOW = 6, - LOWER = 7, - LOWEST = 8 + HIGHEST, ///< These events should run very fast! + DEFAULT, ///< Default priority used, e.g. the default timer priority + HIGH_IDLE, ///< Important idle events to be run before processing drawing events + RESIZE, ///< Resize runs before repaint, so we won't paint twice + REPAINT, ///< All repaint events should go in here + POST_PAINT, ///< Everything running directly after painting + DEFAULT_IDLE, ///< Default idle priority + LOWEST ///< Low, very idle cleanup tasks }; class VCL_DLLPUBLIC Scheduler diff --git a/reportdesign/source/ui/report/DesignView.cxx b/reportdesign/source/ui/report/DesignView.cxx index c5d2974..cd4230d 100644 --- a/reportdesign/source/ui/report/DesignView.cxx +++ b/reportdesign/source/ui/report/DesignView.cxx @@ -117,7 +117,6 @@ ODesignView::ODesignView( vcl::Window* pParent, m_aSplitWin->SetAlign(WindowAlign::Left); m_aSplitWin->Show(); - m_aMarkIdle.SetPriority( SchedulerPriority::LOW ); m_aMarkIdle.SetIdleHdl( LINK( this, ODesignView, MarkTimeout ) ); } diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx index dddcde6..762da40 100644 --- a/sc/source/core/data/documen2.cxx +++ b/sc/source/core/data/documen2.cxx @@ -247,7 +247,6 @@ ScDocument::ScDocument( ScDocumentMode eMode, SfxObjectShell* pDocShell ) : SetLanguage( ScGlobal::eLnge, ScGlobal::eLnge, ScGlobal::eLnge ); aTrackIdle.SetIdleHdl( LINK( this, ScDocument, TrackTimeHdl ) ); - aTrackIdle.SetPriority( SchedulerPriority::LOW ); } sfx2::LinkManager* ScDocument::GetLinkManager() diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx index d06ed71..6f7d981 100644 --- a/sc/source/ui/app/scmod.cxx +++ b/sc/source/ui/app/scmod.cxx @@ -176,7 +176,6 @@ ScModule::ScModule( SfxObjectFactory* pFact ) : ERRCODE_AREA_APP2-1, GetResMgr() ); - aSpellIdle.SetPriority(SchedulerPriority::LOWER); aSpellIdle.SetIdleHdl( LINK( this, ScModule, SpellTimerHdl ) ); aSpellIdle.SetDebugName( "sc::ScModule aSpellIdle" ); diff --git a/sc/source/ui/docshell/autostyl.cxx b/sc/source/ui/docshell/autostyl.cxx index 463b88b..db7a400 100644 --- a/sc/source/ui/docshell/autostyl.cxx +++ b/sc/source/ui/docshell/autostyl.cxx @@ -65,7 +65,7 @@ ScAutoStyleList::ScAutoStyleList(ScDocShell* pShell) { aTimer.SetTimeoutHdl( LINK( this, ScAutoStyleList, TimerHdl ) ); aInitIdle.SetIdleHdl( LINK( this, ScAutoStyleList, InitHdl ) ); - aInitIdle.SetPriority( SchedulerPriority::HIGHEST ); + aInitIdle.SetPriority( SchedulerPriority::HIGH_IDLE ); } ScAutoStyleList::~ScAutoStyleList() diff --git a/sc/source/ui/formdlg/dwfunctr.cxx b/sc/source/ui/formdlg/dwfunctr.cxx index 8a36f6d..b30765ed 100644 --- a/sc/source/ui/formdlg/dwfunctr.cxx +++ b/sc/source/ui/formdlg/dwfunctr.cxx @@ -70,7 +70,6 @@ ScFunctionWin::ScFunctionWin( SfxBindings* pBindingsP, vcl::Window* pParent, con InitLRUList(); SetStyle(GetStyle()|WB_CLIPCHILDREN); - aIdle.SetPriority(SchedulerPriority::LOWER); aIdle.SetIdleHdl(LINK( this, ScFunctionWin, TimerHdl)); aFiFuncDesc->SetUpdateMode(true); diff --git a/sc/source/ui/miscdlgs/acredlin.cxx b/sc/source/ui/miscdlgs/acredlin.cxx index e52abbd..17764ae 100644 --- a/sc/source/ui/miscdlgs/acredlin.cxx +++ b/sc/source/ui/miscdlgs/acredlin.cxx @@ -108,13 +108,11 @@ ScAcceptChgDlg::ScAcceptChgDlg(SfxBindings* pB, SfxChildWindow* pCW, vcl::Window m_pAcceptChgCtr = VclPtr<SvxAcceptChgCtr>::Create(get_content_area(), this); nAcceptCount=0; nRejectCount=0; - aReOpenIdle.SetPriority(SchedulerPriority::MEDIUM); aReOpenIdle.SetIdleHdl(LINK( this, ScAcceptChgDlg, ReOpenTimerHdl )); pTPFilter=m_pAcceptChgCtr->GetFilterPage(); pTPView=m_pAcceptChgCtr->GetViewPage(); pTheView=pTPView->GetTableControl(); - aSelectionIdle.SetPriority(SchedulerPriority::LOW); aSelectionIdle.SetIdleHdl(LINK( this, ScAcceptChgDlg, UpdateSelectionHdl )); aSelectionIdle.SetDebugName( "ScAcceptChgDlg aSelectionIdle" ); diff --git a/sc/source/ui/miscdlgs/anyrefdg.cxx b/sc/source/ui/miscdlgs/anyrefdg.cxx index 63e6cef..a80c61e 100644 --- a/sc/source/ui/miscdlgs/anyrefdg.cxx +++ b/sc/source/ui/miscdlgs/anyrefdg.cxx @@ -765,7 +765,6 @@ ScRefHandler::ScRefHandler( vcl::Window &rWindow, SfxBindings* pB, bool bBindRef pActiveWin(nullptr) { m_aHelper.SetWindow(m_rWindow.get()); - aIdle.SetPriority(SchedulerPriority::LOWER); aIdle.SetIdleHdl(LINK( this, ScRefHandler, UpdateFocusHdl)); if( bBindRef ) EnterRefMode(); diff --git a/sc/source/ui/miscdlgs/conflictsdlg.cxx b/sc/source/ui/miscdlgs/conflictsdlg.cxx index 99abeb3..e2ee2a8 100644 --- a/sc/source/ui/miscdlgs/conflictsdlg.cxx +++ b/sc/source/ui/miscdlgs/conflictsdlg.cxx @@ -421,7 +421,6 @@ ScConflictsDlg::ScConflictsDlg( vcl::Window* pParent, ScViewData* pViewData, ScD m_pLbConflicts->SetSelectionMode( SelectionMode::Multiple ); m_pLbConflicts->SetHighlightRange(); - maSelectionIdle.SetPriority( SchedulerPriority::LOW ); maSelectionIdle.SetIdleHdl( LINK( this, ScConflictsDlg, UpdateSelectionHdl ) ); maSelectionIdle.SetDebugName( "ScConflictsDlg maSelectionIdle" ); diff --git a/sd/source/ui/dlg/filedlg.cxx b/sd/source/ui/dlg/filedlg.cxx index 9fa35bb..c3cf3c7 100644 --- a/sd/source/ui/dlg/filedlg.cxx +++ b/sd/source/ui/dlg/filedlg.cxx @@ -129,7 +129,6 @@ IMPL_LINK_NOARG_TYPED(SdFileDialog_Imp, PlayMusicHdl, void*, void) { mxPlayer.set( avmedia::MediaWindow::createPlayer( aUrl, "" ), css::uno::UNO_QUERY_THROW ); mxPlayer->start(); - maUpdateIdle.SetPriority( SchedulerPriority::LOW ); maUpdateIdle.Start(); } catch (const css::uno::Exception&) diff --git a/sd/source/ui/framework/module/ShellStackGuard.cxx b/sd/source/ui/framework/module/ShellStackGuard.cxx index a37cf5f..eea14db 100644 --- a/sd/source/ui/framework/module/ShellStackGuard.cxx +++ b/sd/source/ui/framework/module/ShellStackGuard.cxx @@ -72,7 +72,6 @@ ShellStackGuard::ShellStackGuard (Reference<frame::XController>& rxController) // Prepare the printer polling. maPrinterPollingIdle.SetIdleHdl(LINK(this,ShellStackGuard,TimeoutHandler)); - maPrinterPollingIdle.SetPriority(SchedulerPriority::LOWER); } } diff --git a/sd/source/ui/view/sdview.cxx b/sd/source/ui/view/sdview.cxx index ebb545b..741a1c5 100644 --- a/sd/source/ui/view/sdview.cxx +++ b/sd/source/ui/view/sdview.cxx @@ -143,9 +143,7 @@ View::View(SdDrawDocument& rDrawDoc, OutputDevice* pOutDev, // Timer for delayed drop (has to be for MAC) maDropErrorIdle.SetIdleHdl( LINK(this, View, DropErrorHdl) ); - maDropErrorIdle.SetPriority(SchedulerPriority::MEDIUM); maDropInsertFileIdle.SetIdleHdl( LINK(this, View, DropInsertFileHdl) ); - maDropInsertFileIdle.SetPriority(SchedulerPriority::MEDIUM); } void View::ImplClearDrawDropMarker() diff --git a/sfx2/source/appl/appcfg.cxx b/sfx2/source/appl/appcfg.cxx index bef93b6..d830482 100644 --- a/sfx2/source/appl/appcfg.cxx +++ b/sfx2/source/appl/appcfg.cxx @@ -111,7 +111,7 @@ SfxEventAsyncer_Impl::SfxEventAsyncer_Impl( const SfxEventHint& rHint ) StartListening( *rHint.GetObjShell() ); pIdle = new Idle("SfxEventASyncer"); pIdle->SetIdleHdl( LINK(this, SfxEventAsyncer_Impl, IdleHdl) ); - pIdle->SetPriority( SchedulerPriority::HIGHEST ); + pIdle->SetPriority( SchedulerPriority::HIGH_IDLE ); pIdle->SetDebugName( "sfx::SfxEventAsyncer_Impl pIdle" ); pIdle->Start(); } diff --git a/sfx2/source/appl/newhelp.cxx b/sfx2/source/appl/newhelp.cxx index 9ff07b0..0196c1a 100644 --- a/sfx2/source/appl/newhelp.cxx +++ b/sfx2/source/appl/newhelp.cxx @@ -553,7 +553,6 @@ IndexTabPage_Impl::IndexTabPage_Impl(vcl::Window* pParent, SfxHelpIndexWindow_Im m_pOpenBtn->SetClickHdl( LINK( this, IndexTabPage_Impl, OpenHdl ) ); Link<Timer *, void> aTimeoutLink = LINK( this, IndexTabPage_Impl, TimeoutHdl ); aFactoryIdle.SetIdleHdl( LINK(this, IndexTabPage_Impl, IdleHdl )); - aFactoryIdle.SetPriority(SchedulerPriority::LOWER); aKeywordTimer.SetTimeoutHdl( aTimeoutLink ); } @@ -1434,7 +1433,6 @@ SfxHelpIndexWindow_Impl::SfxHelpIndexWindow_Impl(SfxHelpWindow_Impl* _pParent) nMinWidth = ( m_pActiveLB->GetSizePixel().Width() / 2 ); aIdle.SetIdleHdl( LINK( this, SfxHelpIndexWindow_Impl, InitHdl ) ); - aIdle.SetPriority( SchedulerPriority::LOWER ); aIdle.Start(); Show(); diff --git a/sfx2/source/control/dispatch.cxx b/sfx2/source/control/dispatch.cxx index 39c005c..b2a34e9 100644 --- a/sfx2/source/control/dispatch.cxx +++ b/sfx2/source/control/dispatch.cxx @@ -449,7 +449,7 @@ void SfxDispatcher::Construct_Impl( SfxDispatcher* pParent ) xImp->xPoster = new SfxHintPoster(aGenLink); - xImp->aIdle.SetPriority(SchedulerPriority::MEDIUM); + xImp->aIdle.SetPriority(SchedulerPriority::HIGH_IDLE ); xImp->aIdle.SetIdleHdl( LINK(this, SfxDispatcher, EventHdl_Impl ) ); xImp->aIdle.SetDebugName( "sfx::SfxDispatcher_Impl aIdle" ); } @@ -586,8 +586,6 @@ void SfxDispatcher::Pop(SfxShell& rShell, SfxDispatcherPopFlags nMode) if(!pSfxApp->IsDowning() && !xImp->aToDoStack.empty()) { // No immediate update is requested - xImp->aIdle.SetPriority(SchedulerPriority::MEDIUM); - xImp->aIdle.SetIdleHdl( LINK(this, SfxDispatcher, EventHdl_Impl ) ); xImp->aIdle.Start(); } else @@ -789,8 +787,6 @@ void SfxDispatcher::DoActivate_Impl(bool bMDI) if(!xImp->aToDoStack.empty()) { // No immediate update is requested - xImp->aIdle.SetPriority(SchedulerPriority::MEDIUM); - xImp->aIdle.SetIdleHdl( LINK(this, SfxDispatcher, EventHdl_Impl ) ); xImp->aIdle.Start(); } } diff --git a/svtools/source/contnr/imivctl1.cxx b/svtools/source/contnr/imivctl1.cxx index aece5b3..b9b6217 100644 --- a/svtools/source/contnr/imivctl1.cxx +++ b/svtools/source/contnr/imivctl1.cxx @@ -143,7 +143,7 @@ SvxIconChoiceCtrl_Impl::SvxIconChoiceCtrl_Impl( aEditIdle.SetIdleHdl(LINK(this,SvxIconChoiceCtrl_Impl,EditTimeoutHdl)); aEditIdle.SetDebugName( "svtools::SvxIconChoiceCtrl_Impl aEditIdle" ); - aAutoArrangeIdle.SetPriority( SchedulerPriority::LOW ); + aAutoArrangeIdle.SetPriority( SchedulerPriority::HIGH_IDLE ); aAutoArrangeIdle.SetIdleHdl(LINK(this,SvxIconChoiceCtrl_Impl,AutoArrangeHdl)); aAutoArrangeIdle.SetDebugName( "svtools::SvxIconChoiceCtrl_Impl aAutoArrangeIdle" ); @@ -151,11 +151,11 @@ SvxIconChoiceCtrl_Impl::SvxIconChoiceCtrl_Impl( aCallSelectHdlIdle.SetIdleHdl( LINK(this,SvxIconChoiceCtrl_Impl,CallSelectHdlHdl)); aCallSelectHdlIdle.SetDebugName( "svtools::SvxIconChoiceCtrl_Impl aCallSelectHdlIdle" ); - aDocRectChangedIdle.SetPriority( SchedulerPriority::MEDIUM ); + aDocRectChangedIdle.SetPriority( SchedulerPriority::HIGH_IDLE ); aDocRectChangedIdle.SetIdleHdl(LINK(this,SvxIconChoiceCtrl_Impl,DocRectChangedHdl)); aDocRectChangedIdle.SetDebugName( "svtools::SvxIconChoiceCtrl_Impl aDocRectChangedIdle" ); - aVisRectChangedIdle.SetPriority( SchedulerPriority::MEDIUM ); + aVisRectChangedIdle.SetPriority( SchedulerPriority::HIGH_IDLE ); aVisRectChangedIdle.SetIdleHdl(LINK(this,SvxIconChoiceCtrl_Impl,VisRectChangedHdl)); aVisRectChangedIdle.SetDebugName( "svtools::SvxIconChoiceCtrl_Impl aVisRectChangedIdle" ); diff --git a/svtools/source/contnr/svimpbox.cxx b/svtools/source/contnr/svimpbox.cxx index d364a3b..672e35c 100644 --- a/svtools/source/contnr/svimpbox.cxx +++ b/svtools/source/contnr/svimpbox.cxx @@ -89,7 +89,7 @@ SvImpLBox::SvImpLBox( SvTreeListBox* pLBView, SvTreeList* pLBTree, WinBits nWinS nNodeBmpWidth = 0; bAsyncBeginDrag = false; - aAsyncBeginDragIdle.SetPriority( SchedulerPriority::HIGHEST ); + aAsyncBeginDragIdle.SetPriority( SchedulerPriority::HIGH_IDLE ); aAsyncBeginDragIdle.SetIdleHdl( LINK(this,SvImpLBox,BeginDragHdl)); // button animation in listbox pActiveButton = nullptr; diff --git a/svx/source/dialog/_contdlg.cxx b/svx/source/dialog/_contdlg.cxx index 6e072e6..3b34c32 100644 --- a/svx/source/dialog/_contdlg.cxx +++ b/svx/source/dialog/_contdlg.cxx @@ -286,7 +286,6 @@ SvxSuperContourDlg::SvxSuperContourDlg(SfxBindings *_pBindings, SfxChildWindow * Resize(); - aUpdateIdle.SetPriority( SchedulerPriority::LOW ); aUpdateIdle.SetIdleHdl( LINK( this, SvxSuperContourDlg, UpdateHdl ) ); aCreateIdle.SetPriority( SchedulerPriority::RESIZE ); diff --git a/svx/source/dialog/imapdlg.cxx b/svx/source/dialog/imapdlg.cxx index c3f46e6..61dea55 100644 --- a/svx/source/dialog/imapdlg.cxx +++ b/svx/source/dialog/imapdlg.cxx @@ -203,7 +203,6 @@ SvxIMapDlg::SvxIMapDlg(SfxBindings *_pBindings, SfxChildWindow *pCW, vcl::Window m_pCbbTarget->Disable(); pOwnData->bExecState = false; - pOwnData->aIdle.SetPriority( SchedulerPriority::LOW ); pOwnData->aIdle.SetIdleHdl( LINK( this, SvxIMapDlg, UpdateHdl ) ); m_pTbxIMapDlg1->EnableItem( mnActiveId, false ); diff --git a/svx/source/sdr/contact/objectcontactofpageview.cxx b/svx/source/sdr/contact/objectcontactofpageview.cxx index efeaad6..57fdc7e 100644 --- a/svx/source/sdr/contact/objectcontactofpageview.cxx +++ b/svx/source/sdr/contact/objectcontactofpageview.cxx @@ -61,7 +61,7 @@ namespace sdr setPreviewRenderer(((SdrPaintView&)rPageWindow.GetPageView().GetView()).IsPreviewRenderer()); // init timer - SetPriority(SchedulerPriority::HIGH); + SetPriority(SchedulerPriority::HIGH_IDLE); Stop(); } diff --git a/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx b/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx index 4827c3d..dc274cd 100644 --- a/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx +++ b/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx @@ -84,7 +84,7 @@ PagePrimitiveExtractor::PagePrimitiveExtractor( setPreviewRenderer(true); // init timer - SetPriority(SchedulerPriority::HIGH); + SetPriority(SchedulerPriority::HIGH_IDLE); Stop(); } diff --git a/svx/source/sdr/event/eventhandler.cxx b/svx/source/sdr/event/eventhandler.cxx index 681d9cf..4588972 100644 --- a/svx/source/sdr/event/eventhandler.cxx +++ b/svx/source/sdr/event/eventhandler.cxx @@ -83,7 +83,7 @@ namespace sdr TimerEventHandler::TimerEventHandler() { - SetPriority(SchedulerPriority::HIGH); + SetPriority(SchedulerPriority::HIGH_IDLE); Stop(); } diff --git a/svx/source/svdraw/svdibrow.cxx b/svx/source/svdraw/svdibrow.cxx index 51e6f47..40ed111 100644 --- a/svx/source/svdraw/svdibrow.cxx +++ b/svx/source/svdraw/svdibrow.cxx @@ -1101,7 +1101,7 @@ void SdrItemBrowser::SetDirty() { if (!bDirty) { bDirty = true; - aIdle.SetPriority(SchedulerPriority::HIGH); + aIdle.SetPriority(SchedulerPriority::HIGH_IDLE); aIdle.Start(); } } diff --git a/svx/source/tbxctrls/grafctrl.cxx b/svx/source/tbxctrls/grafctrl.cxx index 7c066c8..90cddd8 100644 --- a/svx/source/tbxctrls/grafctrl.cxx +++ b/svx/source/tbxctrls/grafctrl.cxx @@ -121,7 +121,6 @@ ImplGrafMetricField::ImplGrafMetricField( vcl::Window* pParent, const OUString& SetSpinSize( 1 ); } - maIdle.SetPriority( SchedulerPriority::LOW ); maIdle.SetIdleHdl( LINK( this, ImplGrafMetricField, ImplModifyHdl ) ); } diff --git a/sw/source/uibase/docvw/srcedtw.cxx b/sw/source/uibase/docvw/srcedtw.cxx index 6b34e90..a566e87 100644 --- a/sw/source/uibase/docvw/srcedtw.cxx +++ b/sw/source/uibase/docvw/srcedtw.cxx @@ -535,7 +535,6 @@ void SwSrcEditWindow::CreateTextEngine() m_pOutWin->SetFont( aFont ); m_pTextEngine->SetFont( aFont ); - m_aSyntaxIdle.SetPriority( SchedulerPriority::LOWER ); m_aSyntaxIdle.SetIdleHdl( LINK( this, SwSrcEditWindow, SyntaxTimerHdl ) ); m_pTextEngine->EnableUndo( true ); diff --git a/sw/source/uibase/utlui/unotools.cxx b/sw/source/uibase/utlui/unotools.cxx index 219823f..6e90ac2 100644 --- a/sw/source/uibase/utlui/unotools.cxx +++ b/sw/source/uibase/utlui/unotools.cxx @@ -84,7 +84,7 @@ SwOneExampleFrame::SwOneExampleFrame( vcl::Window& rWin, // the controller is asynchronously set aLoadedIdle.SetIdleHdl(LINK(this, SwOneExampleFrame, TimeoutHdl)); - aLoadedIdle.SetPriority(SchedulerPriority::HIGH); + aLoadedIdle.SetPriority(SchedulerPriority::HIGH_IDLE); CreateControl(); diff --git a/vcl/osx/salinst.cxx b/vcl/osx/salinst.cxx index 53be65c..06ad2c0 100644 --- a/vcl/osx/salinst.cxx +++ b/vcl/osx/salinst.cxx @@ -105,7 +105,6 @@ void AquaSalInstance::delayedSettingsChanged( bool bInvalidate ) { osl::Guard< comphelper::SolarMutex > aGuard( *mpSalYieldMutex ); AquaDelayedSettingsChanged* pIdle = new AquaDelayedSettingsChanged( bInvalidate ); - pIdle->SetPriority( SchedulerPriority::MEDIUM ); pIdle->Start(); } diff --git a/vcl/source/app/idle.cxx b/vcl/source/app/idle.cxx index 1fe9819..5224c77 100644 --- a/vcl/source/app/idle.cxx +++ b/vcl/source/app/idle.cxx @@ -44,6 +44,7 @@ Idle::Idle( const sal_Char *pDebugName ) : Scheduler( pDebugName ) , mbAuto( false ) { + mePriority = SchedulerPriority::DEFAULT_IDLE; } Idle::Idle( const Idle& rIdle ) : Scheduler(rIdle) @@ -61,8 +62,7 @@ void Idle::Start() { switch (mePriority) { - case SchedulerPriority::LOW: - case SchedulerPriority::LOWER: + case SchedulerPriority::DEFAULT_IDLE: case SchedulerPriority::LOWEST: nPeriod = Scheduler::InfiniteTimeoutMs; break; @@ -82,7 +82,7 @@ bool Idle::ReadyForSchedule( const sal_uInt64 /* nTime */ ) const void Idle::UpdateMinPeriod( const sal_uInt64 /* nTime */, sal_uInt64 &nMinPeriod ) const { - nMinPeriod = ImmediateTimeoutMs; + nMinPeriod = ImmediateTimeoutMs; // don't wait } AutoIdle::AutoIdle( const sal_Char *pDebugName ) diff --git a/vcl/source/app/scheduler.cxx b/vcl/source/app/scheduler.cxx index 134f895..37c0565 100644 --- a/vcl/source/app/scheduler.cxx +++ b/vcl/source/app/scheduler.cxx @@ -311,7 +311,7 @@ Scheduler& Scheduler::operator=( const Scheduler& rScheduler ) Scheduler::Scheduler(const sal_Char *pDebugName): mpSchedulerData(nullptr), mpDebugName(pDebugName), - mePriority(SchedulerPriority::HIGH) + mePriority(SchedulerPriority::DEFAULT) { } diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx index fbf6a73..852c090 100644 --- a/vcl/source/app/svapp.cxx +++ b/vcl/source/app/svapp.cxx @@ -463,7 +463,7 @@ void Application::Execute() pSVData->maAppData.mnEventTestLimit = 50; pSVData->maAppData.mpEventTestingIdle = new Idle("eventtesting"); pSVData->maAppData.mpEventTestingIdle->SetIdleHdl(LINK(&(pSVData->maAppData), ImplSVAppData, VclEventTestingHdl)); - pSVData->maAppData.mpEventTestingIdle->SetPriority(SchedulerPriority::MEDIUM); + pSVData->maAppData.mpEventTestingIdle->SetPriority(SchedulerPriority::HIGH_IDLE); pSVData->maAppData.mpEventTestInput = new SvFileStream("eventtesting", StreamMode::READ); pSVData->maAppData.mpEventTestingIdle->Start(); } diff --git a/vcl/source/app/timer.cxx b/vcl/source/app/timer.cxx index fb5d382..8a30fe1 100644 --- a/vcl/source/app/timer.cxx +++ b/vcl/source/app/timer.cxx @@ -51,7 +51,7 @@ Timer::Timer(const sal_Char *pDebugName) : mnTimeout(ImmediateTimeoutMs), mbAuto(false) { - mePriority = SchedulerPriority::HIGHEST; + mePriority = SchedulerPriority::DEFAULT; } Timer::Timer( const Timer& rTimer ) : diff --git a/vcl/source/edit/textdata.cxx b/vcl/source/edit/textdata.cxx index cc7e79a..7974f52 100644 --- a/vcl/source/edit/textdata.cxx +++ b/vcl/source/edit/textdata.cxx @@ -275,7 +275,7 @@ IdleFormatter::IdleFormatter() { mpView = nullptr; mnRestarts = 0; - SetPriority(SchedulerPriority::HIGH); + SetPriority(SchedulerPriority::HIGH_IDLE); } IdleFormatter::~IdleFormatter() diff --git a/vcl/source/window/dockmgr.cxx b/vcl/source/window/dockmgr.cxx index 0bd29c9..78769e14 100644 --- a/vcl/source/window/dockmgr.cxx +++ b/vcl/source/window/dockmgr.cxx @@ -90,11 +90,11 @@ ImplDockFloatWin2::ImplDockFloatWin2( vcl::Window* pParent, WinBits nWinBits, SetBackground( GetSettings().GetStyleSettings().GetFaceColor() ); maDockIdle.SetIdleHdl( LINK( this, ImplDockFloatWin2, DockTimerHdl ) ); - maDockIdle.SetPriority( SchedulerPriority::MEDIUM ); + maDockIdle.SetPriority( SchedulerPriority::HIGH_IDLE ); maDockIdle.SetDebugName( "vcl::ImplDockFloatWin2 maDockIdle" ); maEndDockIdle.SetIdleHdl( LINK( this, ImplDockFloatWin2, EndDockTimerHdl ) ); - maEndDockIdle.SetPriority( SchedulerPriority::MEDIUM ); + maEndDockIdle.SetPriority( SchedulerPriority::HIGH_IDLE ); maEndDockIdle.SetDebugName( "vcl::ImplDockFloatWin2 maEndDockIdle" ); } diff --git a/vcl/source/window/dockwin.cxx b/vcl/source/window/dockwin.cxx index f35f68e..c2e7206 100644 --- a/vcl/source/window/dockwin.cxx +++ b/vcl/source/window/dockwin.cxx @@ -106,7 +106,7 @@ ImplDockFloatWin::ImplDockFloatWin( vcl::Window* pParent, WinBits nWinBits, SetBackground(); maDockIdle.SetIdleHdl( LINK( this, ImplDockFloatWin, DockTimerHdl ) ); - maDockIdle.SetPriority( SchedulerPriority::MEDIUM ); + maDockIdle.SetPriority( SchedulerPriority::HIGH_IDLE ); maDockIdle.SetDebugName( "vcl::ImplDockFloatWin maDockIdle" ); } commit 0c9d05a87606c1f5c65230d5136c8728a414a0b2 Author: Jan-Marek Glogowski <glo...@fbihome.de> Date: Tue Sep 13 12:20:45 2016 +0200 Don't wait in Yield with pending events This re-introduces some functionality of commit 87199d3829257420429057336283c55be6ae7481 I'm not sure, if we really want to skip the wait on pendig events. Change-Id: Ie88c2945acb066e312bab7d0f5b2f3b525fa1c4c diff --git a/include/vcl/scheduler.hxx b/include/vcl/scheduler.hxx index 7b210a6..1ab02eb 100644 --- a/include/vcl/scheduler.hxx +++ b/include/vcl/scheduler.hxx @@ -23,6 +23,7 @@ #include <vcl/dllapi.h> struct ImplSchedulerData; +struct ImplSVData; enum class SchedulerPriority { HIGHEST = 0, @@ -45,6 +46,8 @@ private: static inline void UpdateMinPeriod( ImplSchedulerData *pSchedulerData, const sal_uInt64 nTime, sal_uInt64 &nMinPeriod ); + static inline bool HasPendingEvents( const ImplSVData* pSVData, const sal_uInt64 nTime ); + protected: ImplSchedulerData* mpSchedulerData; /// Pointer to element in scheduler list const sal_Char *mpDebugName; /// Useful for debugging @@ -88,6 +91,8 @@ public: static bool ProcessTaskScheduling(); /// Process all events until we are idle static void ProcessAllPendingEvents(); + /// Are there any pending tasks in the LO task queue? + static bool HasPendingEvents(); /// Control the deterministic mode. In this mode, two subsequent runs of /// LibreOffice fire about the same amount idles. diff --git a/vcl/source/app/scheduler.cxx b/vcl/source/app/scheduler.cxx index f0a3e9b..134f895 100644 --- a/vcl/source/app/scheduler.cxx +++ b/vcl/source/app/scheduler.cxx @@ -146,6 +146,19 @@ bool Scheduler::GetDeterministicMode() return g_bDeterministicMode; } +inline bool Scheduler::HasPendingEvents( const ImplSVData* pSVData, const sal_uInt64 nTime ) +{ + return ( pSVData->mbNeedsReschedule || ((pSVData->mnTimerPeriod != InfiniteTimeoutMs) + && (nTime >= pSVData->mnLastUpdate + pSVData->mnTimerPeriod)) ); +} + +bool Scheduler::HasPendingEvents() +{ + ImplSVData* pSVData = ImplGetSVData(); + sal_uInt64 nTime = tools::Time::GetSystemTicks(); + return HasPendingEvents( pSVData, nTime ); +} + inline void Scheduler::UpdateMinPeriod( ImplSchedulerData *pSchedulerData, const sal_uInt64 nTime, sal_uInt64 &nMinPeriod ) { @@ -158,8 +171,7 @@ bool Scheduler::ProcessTaskScheduling() { ImplSVData* pSVData = ImplGetSVData(); sal_uInt64 nTime = tools::Time::GetSystemTicks(); - if (!pSVData->mbNeedsReschedule && - (nTime < pSVData->mnLastUpdate + pSVData->mnTimerPeriod) ) + if ( !HasPendingEvents( pSVData, nTime ) ) return false; pSVData->mbNeedsReschedule = false; diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx index dbacc26..fbf6a73 100644 --- a/vcl/source/app/svapp.cxx +++ b/vcl/source/app/svapp.cxx @@ -481,6 +481,9 @@ inline bool ImplYield(bool i_bWait, bool i_bAllEvents, sal_uLong const nReleased SAL_INFO("vcl.schedule", "Enter ImplYield: " << (i_bWait ? "wait" : "no wait") << ": " << (i_bAllEvents ? "all events" : "one event") << ": " << nReleased); + if ( i_bWait && Scheduler::HasPendingEvents() ) + i_bWait = false; + // TODO: there's a data race here on WNT only because ImplYield may be // called without SolarMutex; if we can get rid of LazyDelete (with VclPtr) // then the only remaining use of mnDispatchLevel is in OSX specific code commit cb8595f687b834af228441954650e988ef24352e Author: Jan-Marek Glogowski <glo...@fbihome.de> Date: Sun Jul 31 17:31:07 2016 +0200 Just schedule tasks, if timeout has ellapsed As the native main loop wakes up on new events and not just by timer timeouts, make sure there is really an ellapsed event. Probably we should just schedule events via the system timeout. At least this will prevent expensive re-scheduling. Conflicts: vcl/source/app/scheduler.cxx Change-Id: I248c9b8acb7df026295d10f256871b9fc8d39c07 diff --git a/vcl/inc/svdata.hxx b/vcl/inc/svdata.hxx index 154316b..b4dcf10 100644 --- a/vcl/inc/svdata.hxx +++ b/vcl/inc/svdata.hxx @@ -310,13 +310,17 @@ struct ImplSVData Application* mpApp; // pApp VclPtr<WorkWindow> mpDefaultWin; // Default-Window bool mbDeInit; // Is VCL deinitializing + ImplSchedulerData* mpFirstSchedulerData; // list of all running tasks ImplSchedulerData* mpFreeSchedulerData; // list of all deleted tasks for reuse + bool mbNeedsReschedule; // indicator, if the list of tasks has changed + sal_uInt64 mnTimerPeriod; // current timer period / sleep time + sal_uInt64 mnLastUpdate; // last scheduler time SalTimer* mpSalTimer; // interface to sal event loop/timers + SalI18NImeStatus* mpImeStatus; // interface to ime status window SalSystem* mpSalSystem; // SalSystem interface ResMgr* mpResMgr; // SV-Resource-Manager - sal_uInt64 mnTimerPeriod; // current timer period ImplSVAppData maAppData; // indepen data for class Application ImplSVGDIData maGDIData; // indepen data for Output classes ImplSVWinData maWinData; // indepen data for Windows classes diff --git a/vcl/source/app/scheduler.cxx b/vcl/source/app/scheduler.cxx index 85cab39..f0a3e9b 100644 --- a/vcl/source/app/scheduler.cxx +++ b/vcl/source/app/scheduler.cxx @@ -129,6 +129,8 @@ void Scheduler::ImplStartTimer( sal_uInt64 nMS, bool bForce ) void Scheduler::CallbackTaskScheduling() { // this function is for the saltimer callback + ImplSVData* pSVData = ImplGetSVData(); + pSVData->mbNeedsReschedule = true; Scheduler::ProcessTaskScheduling(); } @@ -155,11 +157,15 @@ inline void Scheduler::UpdateMinPeriod( ImplSchedulerData *pSchedulerData, bool Scheduler::ProcessTaskScheduling() { ImplSVData* pSVData = ImplGetSVData(); + sal_uInt64 nTime = tools::Time::GetSystemTicks(); + if (!pSVData->mbNeedsReschedule && + (nTime < pSVData->mnLastUpdate + pSVData->mnTimerPeriod) ) + return false; + pSVData->mbNeedsReschedule = false; + ImplSchedulerData* pSchedulerData = pSVData->mpFirstSchedulerData; ImplSchedulerData* pPrevSchedulerData = nullptr; ImplSchedulerData *pMostUrgent = nullptr; - - sal_uInt64 nTime = tools::Time::GetSystemTicks(); sal_uInt64 nMinPeriod = InfiniteTimeoutMs; while ( pSchedulerData ) @@ -223,6 +229,7 @@ next_entry: pSVData->mpSalTimer->Stop(); pSVData->mnTimerPeriod = nMinPeriod; + pSVData->mnLastUpdate = nTime; return pMostUrgent != nullptr; } @@ -262,7 +269,10 @@ void Scheduler::Start() else pSVData->mpFirstSchedulerData = mpSchedulerData; } - mpSchedulerData->mnUpdateTime = tools::Time::GetSystemTicks(); + + assert( mpSchedulerData->mpScheduler == this ); + mpSchedulerData->mnUpdateTime = tools::Time::GetSystemTicks(); + pSVData->mbNeedsReschedule = true; } void Scheduler::Stop() commit f02220e3bd6d6c123712fc09fd76adda25074226 Author: Jan-Marek Glogowski <glo...@fbihome.de> Date: Mon Sep 12 17:03:29 2016 +0200 Drop special idle handling Idles are just instant, mainly low-priority timers. So we'll just schedule by priority. This basically also reverts the following commit: commit 06d731428ef6cf93c7333e8228bfb6088853b52f Change-Id: I446eaea0077f45a5b7daa0aa06dcb80010ac0bd5 diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index a7e24fc..55f55af 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -383,7 +383,7 @@ void DesktopLOKTest::testSearchCalc() {"SearchItem.Command", uno::makeAny(static_cast<sal_uInt16>(SvxSearchCmd::FIND_ALL))}, })); comphelper::dispatchCommand(".uno:ExecuteSearch", aPropertyValues); - Scheduler::ProcessEventsToIdle(); + Scheduler::ProcessAllPendingEvents(); std::vector<OString> aSelections; sal_Int32 nIndex = 0; @@ -417,7 +417,7 @@ void DesktopLOKTest::testSearchAllNotificationsCalc() {"SearchItem.Command", uno::makeAny(static_cast<sal_uInt16>(SvxSearchCmd::FIND_ALL))}, })); comphelper::dispatchCommand(".uno:ExecuteSearch", aPropertyValues); - Scheduler::ProcessEventsToIdle(); + Scheduler::ProcessAllPendingEvents(); // This was 1, make sure that we get no notifications about selection changes during search. CPPUNIT_ASSERT_EQUAL(0, m_nSelectionBeforeSearchResult); @@ -687,7 +687,7 @@ void DesktopLOKTest::testCommandResult() // the condition var. m_aCommandResultCondition.reset(); pDocument->pClass->postUnoCommand(pDocument, ".uno:Bold", nullptr, true); - Scheduler::ProcessEventsToIdle(); + Scheduler::ProcessAllPendingEvents(); m_aCommandResultCondition.wait(aTimeValue); CPPUNIT_ASSERT(m_aCommandResult.isEmpty()); @@ -697,7 +697,7 @@ void DesktopLOKTest::testCommandResult() m_aCommandResultCondition.reset(); pDocument->pClass->postUnoCommand(pDocument, ".uno:Bold", nullptr, true); - Scheduler::ProcessEventsToIdle(); + Scheduler::ProcessAllPendingEvents(); m_aCommandResultCondition.wait(aTimeValue); boost::property_tree::ptree aTree; @@ -720,7 +720,7 @@ void DesktopLOKTest::testWriterComments() TimeValue aTimeValue = {2 , 0}; // 2 seconds max m_aCommandResultCondition.reset(); pDocument->pClass->postUnoCommand(pDocument, ".uno:InsertAnnotation", nullptr, true); - Scheduler::ProcessEventsToIdle(); + Scheduler::ProcessAllPendingEvents(); m_aCommandResultCondition.wait(aTimeValue); CPPUNIT_ASSERT(!m_aCommandResult.isEmpty()); xToolkit->reschedule(); @@ -761,10 +761,10 @@ void DesktopLOKTest::testModifiedStatus() m_bModified = false; m_aStateChangedCondition.reset(); pDocument->pClass->postKeyEvent(pDocument, LOK_KEYEVENT_KEYINPUT, 't', 0); - Scheduler::ProcessEventsToIdle(); + Scheduler::ProcessAllPendingEvents(); TimeValue aTimeValue = { 2 , 0 }; // 2 seconds max m_aStateChangedCondition.wait(aTimeValue); - Scheduler::ProcessEventsToIdle(); + Scheduler::ProcessAllPendingEvents(); // This was false, there was no callback about the modified status change. CPPUNIT_ASSERT(m_bModified); @@ -775,9 +775,9 @@ void DesktopLOKTest::testModifiedStatus() utl::TempFile aTempFile; aTempFile.EnableKillingFile(); CPPUNIT_ASSERT(pDocument->pClass->saveAs(pDocument, aTempFile.GetURL().toUtf8().getStr(), "odt", "TakeOwnership")); - Scheduler::ProcessEventsToIdle(); + Scheduler::ProcessAllPendingEvents(); m_aStateChangedCondition.wait(aTimeValue); - Scheduler::ProcessEventsToIdle(); + Scheduler::ProcessAllPendingEvents(); // There was no callback about the modified status change. CPPUNIT_ASSERT(!m_bModified); @@ -785,9 +785,9 @@ void DesktopLOKTest::testModifiedStatus() // Modify the document again m_aStateChangedCondition.reset(); pDocument->pClass->postKeyEvent(pDocument, LOK_KEYEVENT_KEYINPUT, 't', 0); - Scheduler::ProcessEventsToIdle(); + Scheduler::ProcessAllPendingEvents(); m_aStateChangedCondition.wait(aTimeValue); - Scheduler::ProcessEventsToIdle(); + Scheduler::ProcessAllPendingEvents(); // There was no callback about the modified status change. CPPUNIT_ASSERT(m_bModified); @@ -800,7 +800,7 @@ void DesktopLOKTest::testModifiedStatus() m_aStateChangedCondition.reset(); pDocument->pClass->postUnoCommand(pDocument, ".uno:Save", nullptr, false); m_aStateChangedCondition.wait(aTimeValue); - Scheduler::ProcessEventsToIdle(); + Scheduler::ProcessAllPendingEvents(); // There was no callback about the modified status change. CPPUNIT_ASSERT(!m_bModified); @@ -820,12 +820,12 @@ void DesktopLOKTest::testTrackChanges() pDocument->pClass->createView(pDocument); pDocument->pClass->initializeForRendering(pDocument, nullptr); pDocument->pClass->registerCallback(pDocument, &DesktopLOKTest::callback, this); - Scheduler::ProcessEventsToIdle(); + Scheduler::ProcessAllPendingEvents(); // Enable trak changes and assert that both views get notified. m_nTrackChanges = 0; pDocument->pClass->postUnoCommand(pDocument, ".uno:TrackChanges", nullptr, false); - Scheduler::ProcessEventsToIdle(); + Scheduler::ProcessAllPendingEvents(); // This was 1, only the active view was notified. CPPUNIT_ASSERT_EQUAL(2, m_nTrackChanges); @@ -1057,7 +1057,7 @@ void DesktopLOKTest::testContextMenuCalc() LOK_MOUSEEVENT_MOUSEBUTTONDOWN, aPointOnImage.X(), aPointOnImage.Y(), 1, 4, 0); - Scheduler::ProcessEventsToIdle(); + Scheduler::ProcessAllPendingEvents(); TimeValue aTimeValue = {2 , 0}; // 2 seconds max m_aContextMenuCondition.wait(aTimeValue); @@ -1167,7 +1167,7 @@ void DesktopLOKTest::testContextMenuWriter() LOK_MOUSEEVENT_MOUSEBUTTONDOWN, aRandomPoint.X(), aRandomPoint.Y(), 1, 4, 0); - Scheduler::ProcessEventsToIdle(); + Scheduler::ProcessAllPendingEvents(); TimeValue aTimeValue = {2 , 0}; // 2 seconds max m_aContextMenuCondition.wait(aTimeValue); @@ -1223,7 +1223,7 @@ void DesktopLOKTest::testContextMenuImpress() LOK_MOUSEEVENT_MOUSEBUTTONDOWN, aRandomPoint.X(), aRandomPoint.Y(), 1, 4, 0); - Scheduler::ProcessEventsToIdle(); + Scheduler::ProcessAllPendingEvents(); TimeValue aTimeValue = {2 , 0}; // 2 seconds max m_aContextMenuCondition.wait(aTimeValue); @@ -1379,7 +1379,7 @@ void DesktopLOKTest::testNotificationCompression() handler->queue(LOK_CALLBACK_CELL_FORMULA, "blah"); // Should be dropped. handler->queue(LOK_CALLBACK_SET_PART, "1"); // Should be dropped. - Scheduler::ProcessEventsToIdle(); + Scheduler::ProcessAllPendingEvents(); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(13), notifs.size()); @@ -1539,11 +1539,11 @@ void DesktopLOKTest::testPaintPartTile() pDocument->m_pDocumentClass->paintPartTile(pDocument, pPixels, 1, 256, 256, 0, 0, 256, 256); // Type again. - Scheduler::ProcessEventsToIdle(); + Scheduler::ProcessAllPendingEvents(); aView1.m_bTilesInvalidated = false; pDocument->m_pDocumentClass->postKeyEvent(pDocument, LOK_KEYEVENT_KEYINPUT, 'x', 0); pDocument->m_pDocumentClass->postKeyEvent(pDocument, LOK_KEYEVENT_KEYUP, 'x', 0); - Scheduler::ProcessEventsToIdle(); + Scheduler::ProcessAllPendingEvents(); // This failed: paintPartTile() (as a side-effect) ended the text edit of // the first view, so there were no invalidations. CPPUNIT_ASSERT(aView1.m_bTilesInvalidated); diff --git a/include/vcl/idle.hxx b/include/vcl/idle.hxx index 1027f0c..f50e329 100644 --- a/include/vcl/idle.hxx +++ b/include/vcl/idle.hxx @@ -31,7 +31,7 @@ protected: virtual void SetDeletionFlags() override; - virtual bool ReadyForSchedule( const sal_uInt64 nTime, const bool bIdle ) const override; + virtual bool ReadyForSchedule( const sal_uInt64 nTime ) const override; virtual void UpdateMinPeriod( const sal_uInt64 nTime, sal_uInt64 &nMinPeriod ) const override; public: diff --git a/include/vcl/scheduler.hxx b/include/vcl/scheduler.hxx index e1934b1..7b210a6 100644 --- a/include/vcl/scheduler.hxx +++ b/include/vcl/scheduler.hxx @@ -57,7 +57,7 @@ protected: virtual void SetDeletionFlags(); - virtual bool ReadyForSchedule( const sal_uInt64 nTime, const bool bIdle ) const = 0; + virtual bool ReadyForSchedule( const sal_uInt64 nTime ) const = 0; virtual void UpdateMinPeriod( const sal_uInt64 nTime, sal_uInt64 &nMinPeriod ) const = 0; public: @@ -83,11 +83,11 @@ public: static void ImplDeInitScheduler(); /// Process one pending Timer with highhest priority - static void CallbackTaskScheduling( bool bIdle ); + static void CallbackTaskScheduling(); /// Process one pending task ahead of time with highest priority. - static bool ProcessTaskScheduling( bool bIdle ); + static bool ProcessTaskScheduling(); /// Process all events until we are idle - static void ProcessEventsToIdle(); + static void ProcessAllPendingEvents(); /// Control the deterministic mode. In this mode, two subsequent runs of /// LibreOffice fire about the same amount idles. diff --git a/include/vcl/timer.hxx b/include/vcl/timer.hxx index e4c922e..4f7e3d8 100644 --- a/include/vcl/timer.hxx +++ b/include/vcl/timer.hxx @@ -32,7 +32,7 @@ protected: virtual void SetDeletionFlags() override; - virtual bool ReadyForSchedule( const sal_uInt64 nTime, const bool bIdle ) const override; + virtual bool ReadyForSchedule( const sal_uInt64 nTime ) const override; virtual void UpdateMinPeriod( const sal_uInt64 nTime, sal_uInt64 &nMinPeriod ) const override; public: diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx index 3ff46d0..ec159dd 100644 --- a/sc/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx @@ -442,7 +442,7 @@ void ScTiledRenderingTest::testViewCursors() CPPUNIT_ASSERT(aView2.m_bOwnCursorInvalidated); pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, awt::Key::DOWN); pModelObj->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, awt::Key::DOWN); - Scheduler::ProcessEventsToIdle(); + Scheduler::ProcessAllPendingEvents(); SfxLokHelper::destroyView(SfxLokHelper::getView()); CPPUNIT_ASSERT(aView1.m_bViewCursorInvalidated); mxComponent->dispose(); @@ -481,7 +481,7 @@ void ScTiledRenderingTest::testTextViewSelection() // Create a selection on two cells in the second view, that's a text selection in LOK terms. aView1.m_bTextViewSelectionInvalidated = false; lcl_dispatchCommand(mxComponent, ".uno:GoRightSel", {}); - Scheduler::ProcessEventsToIdle(); + Scheduler::ProcessAllPendingEvents(); // Make sure the first view got its notification. CPPUNIT_ASSERT(aView1.m_bTextViewSelectionInvalidated); @@ -504,7 +504,7 @@ void ScTiledRenderingTest::testDocumentSizeChanged() comphelper::makePropertyValue("ToPoint", OUString("$A$30")), }; lcl_dispatchCommand(mxComponent, ".uno:GoToCell", aPropertyValues); - Scheduler::ProcessEventsToIdle(); + Scheduler::ProcessAllPendingEvents(); // Assert that the size in the payload is not 0. CPPUNIT_ASSERT(m_aDocumentSize.getWidth() > 0); CPPUNIT_ASSERT(m_aDocumentSize.getHeight() > 0); diff --git a/sd/qa/unit/misc-tests.cxx b/sd/qa/unit/misc-tests.cxx index c25abc6..003fd44 100644 --- a/sd/qa/unit/misc-tests.cxx +++ b/sd/qa/unit/misc-tests.cxx @@ -93,7 +93,7 @@ sd::DrawDocShellRef SdMiscTest::Load(const OUString& rURL, sal_Int32 nFormat) for (int i = 0; i < 1000; i++) { // Process all Tasks - slide sorter is created here - while (Scheduler::ProcessTaskScheduling(true)); + while (Scheduler::ProcessTaskScheduling()); if ((pSSVS = sd::slidesorter::SlideSorterViewShell::GetSlideSorter(pViewShell->GetViewShellBase())) != nullptr) break; osl::Thread::wait(std::chrono::milliseconds(100)); @@ -137,7 +137,7 @@ void SdMiscTest::testTdf96708() // Now wait for timers to trigger creation of auto-layout osl::Thread::wait(std::chrono::milliseconds(100)); - Scheduler::ProcessTaskScheduling(true); + Scheduler::ProcessTaskScheduling(); rSSController.GetClipboard().DoPaste(); const sal_uInt16 nMasterPageCnt2 = xDocSh->GetDoc()->GetMasterSdPageCount(PageKind::PK_STANDARD); diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx b/sd/qa/unit/tiledrendering/tiledrendering.cxx index 3f1a08c..c8b96260 100644 --- a/sd/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx @@ -455,7 +455,7 @@ void SdTiledRenderingTest::testUndoShells() {"AttributePageSize.Height", uno::makeAny(static_cast<sal_Int32>(10000))}, })); comphelper::dispatchCommand(".uno:AttributePageSize", aPropertyValues); - Scheduler::ProcessEventsToIdle(); + Scheduler::ProcessAllPendingEvents(); // Assert that view shell ID tracking works for SdUndoAction subclasses. SdDrawDocument* pDocument = pXImpressDocument->GetDoc(); @@ -732,7 +732,7 @@ void SdTiledRenderingTest::testInsertTable() )); comphelper::dispatchCommand(".uno:InsertTable", aArgs); - Scheduler::ProcessEventsToIdle(); + Scheduler::ProcessAllPendingEvents(); // get the table sd::ViewShell* pViewShell = pXImpressDocument->GetDocShell()->GetViewShell(); @@ -980,7 +980,7 @@ void SdTiledRenderingTest::testViewCursors() SdrObject* pObject = pActualPage->GetObj(0); SdrView* pView = pViewShell->GetView(); pView->MarkObj(pObject, pView->GetSdrPageView()); - Scheduler::ProcessEventsToIdle(); + Scheduler::ProcessAllPendingEvents(); // First view notices that there was a selection change in the other view. CPPUNIT_ASSERT(aView1.m_bGraphicViewSelectionInvalidated); @@ -1011,7 +1011,7 @@ void SdTiledRenderingTest::testViewCursorParts() SdrObject* pObject = pActualPage->GetObj(0); SdrView* pView = pViewShell->GetView(); pView->MarkObj(pObject, pView->GetSdrPageView()); - Scheduler::ProcessEventsToIdle(); + Scheduler::ProcessAllPendingEvents(); // First view notices that there was a selection change in the other view. CPPUNIT_ASSERT(aView1.m_bGraphicViewSelectionInvalidated); pView->UnmarkAllObj(pView->GetSdrPageView()); @@ -1023,7 +1023,7 @@ void SdTiledRenderingTest::testViewCursorParts() pActualPage = pViewShell->GetActualPage(); pObject = pActualPage->GetObj(0); pView->MarkObj(pObject, pView->GetSdrPageView()); - Scheduler::ProcessEventsToIdle(); + Scheduler::ProcessAllPendingEvents(); // First view ignores view selection, as it would be for part 1, and it's in part 0. // This failed when the "part" was always 0 in the callback. CPPUNIT_ASSERT(!aView1.m_bGraphicViewSelectionInvalidated); @@ -1050,14 +1050,14 @@ void SdTiledRenderingTest::testCursorViews() pXImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, awt::Key::TAB); pXImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 'x', 0); pXImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYUP, 'x', 0); - Scheduler::ProcessEventsToIdle(); + Scheduler::ProcessAllPendingEvents(); CPPUNIT_ASSERT(pView->IsTextEdit()); // Make sure that cursor state is not changed just because we create a second view. aView1.m_bCursorVisibleChanged = false; SfxLokHelper::createView(); pXImpressDocument->initializeForTiledRendering(uno::Sequence<beans::PropertyValue>()); - Scheduler::ProcessEventsToIdle(); + Scheduler::ProcessAllPendingEvents(); CPPUNIT_ASSERT(!aView1.m_bCursorVisibleChanged); // Make sure that typing in the first view causes an invalidation in the @@ -1073,7 +1073,7 @@ void SdTiledRenderingTest::testCursorViews() aView2.m_bTilesInvalidated = false; pXImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 'x', 0); pXImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYUP, 'x', 0); - Scheduler::ProcessEventsToIdle(); + Scheduler::ProcessAllPendingEvents(); // This failed: the second view was not invalidated when pressing a key in // the first view. CPPUNIT_ASSERT(aView2.m_bTilesInvalidated); @@ -1132,7 +1132,7 @@ void SdTiledRenderingTest::testUndoLimiting() pXImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, awt::Key::TAB); pXImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 'x', 0); pXImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYUP, 'x', 0); - Scheduler::ProcessEventsToIdle(); + Scheduler::ProcessAllPendingEvents(); CPPUNIT_ASSERT(pView->IsTextEdit()); // Now check what views see the undo action. @@ -1205,7 +1205,7 @@ void SdTiledRenderingTest::testCreateViewTextCursor() pXImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, awt::Key::TAB); pXImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 'x', 0); pXImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYUP, 'x', 0); - Scheduler::ProcessEventsToIdle(); + Scheduler::ProcessAllPendingEvents(); sd::ViewShell* pViewShell = pXImpressDocument->GetDocShell()->GetViewShell(); SdrView* pSdrView = pViewShell->GetView(); CPPUNIT_ASSERT(pSdrView->IsTextEdit()); diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx index f203fca..07c11c7 100644 --- a/sw/qa/extras/tiledrendering/tiledrendering.cxx +++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx @@ -570,7 +570,7 @@ void SwTiledRenderingTest::testSearchAllNotifications() {"SearchItem.Command", uno::makeAny(static_cast<sal_uInt16>(SvxSearchCmd::FIND_ALL))}, })); comphelper::dispatchCommand(".uno:ExecuteSearch", aPropertyValues); - Scheduler::ProcessEventsToIdle(); + Scheduler::ProcessAllPendingEvents(); // This was 5, make sure that we get no notifications about selection changes during search. CPPUNIT_ASSERT_EQUAL(0, m_nSelectionBeforeSearchResult); @@ -763,7 +763,7 @@ void SwTiledRenderingTest::testMissingInvalidation() aView2.m_bTilesInvalidated = false; pXTextDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, awt::Key::DELETE); pXTextDocument->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, awt::Key::DELETE); - Scheduler::ProcessEventsToIdle(); + Scheduler::ProcessAllPendingEvents(); CPPUNIT_ASSERT(aView1.m_bTilesInvalidated); CPPUNIT_ASSERT(aView2.m_bTilesInvalidated); mxComponent->dispose(); @@ -877,7 +877,7 @@ void SwTiledRenderingTest::testViewCursorVisibility() Point aCenter = pObject->GetSnapRect().Center(); pXTextDocument->postMouseEvent(LOK_MOUSEEVENT_MOUSEBUTTONDOWN, aCenter.getX(), aCenter.getY(), 1, MOUSE_LEFT, 0); pXTextDocument->postMouseEvent(LOK_MOUSEEVENT_MOUSEBUTTONUP, aCenter.getX(), aCenter.getY(), 1, MOUSE_LEFT, 0); - Scheduler::ProcessEventsToIdle(); + Scheduler::ProcessAllPendingEvents(); // Make sure the "view/text" cursor of the first view gets a notification. CPPUNIT_ASSERT(!aView1.m_bViewCursorVisible); mxComponent->dispose(); @@ -907,13 +907,13 @@ void SwTiledRenderingTest::testViewCursorCleanup() aView1.m_bGraphicViewSelection = false; pXTextDocument->postMouseEvent(LOK_MOUSEEVENT_MOUSEBUTTONDOWN, aCenter.getX(), aCenter.getY(), 1, MOUSE_LEFT, 0); pXTextDocument->postMouseEvent(LOK_MOUSEEVENT_MOUSEBUTTONUP, aCenter.getX(), aCenter.getY(), 1, MOUSE_LEFT, 0); - Scheduler::ProcessEventsToIdle(); + Scheduler::ProcessAllPendingEvents(); // Make sure there is a graphic view selection on the first view. CPPUNIT_ASSERT(aView1.m_bGraphicViewSelection); // Now destroy the second view. SfxLokHelper::destroyView(nView2); - Scheduler::ProcessEventsToIdle(); + Scheduler::ProcessAllPendingEvents(); CPPUNIT_ASSERT_EQUAL(static_cast<std::size_t>(1), SfxLokHelper::getViewsCount()); // Make sure that the graphic view selection on the first view is cleaned up. CPPUNIT_ASSERT(!aView1.m_bGraphicViewSelection); @@ -1016,7 +1016,7 @@ void SwTiledRenderingTest::testUndoInvalidations() aView1.m_bTilesInvalidated = false; aView2.m_bTilesInvalidated = false; comphelper::dispatchCommand(".uno:Undo", {}); - Scheduler::ProcessEventsToIdle(); + Scheduler::ProcessAllPendingEvents(); CPPUNIT_ASSERT(aView1.m_bTilesInvalidated); // Undo was dispatched on the first view, this second view was not invalidated. CPPUNIT_ASSERT(aView2.m_bTilesInvalidated); @@ -1138,7 +1138,7 @@ void SwTiledRenderingTest::testUndoRepairDispatch() sw::UndoManager& rUndoManager = pDoc->GetUndoManager(); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), rUndoManager.GetUndoActionCount()); comphelper::dispatchCommand(".uno:Undo", {}); - Scheduler::ProcessEventsToIdle(); + Scheduler::ProcessAllPendingEvents(); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), rUndoManager.GetUndoActionCount()); // But the same is allowed in repair mode. @@ -1149,7 +1149,7 @@ void SwTiledRenderingTest::testUndoRepairDispatch() {"Repair", uno::makeAny(true)} })); comphelper::dispatchCommand(".uno:Undo", aPropertyValues); - Scheduler::ProcessEventsToIdle(); + Scheduler::ProcessAllPendingEvents(); // This was 1: repair mode couldn't undo the action, either. CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(0), rUndoManager.GetUndoActionCount()); @@ -1263,7 +1263,7 @@ void SwTiledRenderingTest::testTrackChanges() {"RejectTrackedChange", uno::makeAny(static_cast<sal_uInt16>(0))} })); comphelper::dispatchCommand(".uno:RejectTrackedChange", aPropertyValues); - Scheduler::ProcessEventsToIdle(); + Scheduler::ProcessAllPendingEvents(); // Assert that the reject was performed. SwShellCursor* pShellCursor = pWrtShell->getShellCursor(false); diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index 5080f37..fc0371c 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -2806,7 +2806,7 @@ void SwUiWriterTest::testTdf97601() CPPUNIT_ASSERT_EQUAL(true, bool(xModifiable->isModified())); calcLayout(); // This never returned. - Scheduler::ProcessEventsToIdle(); + Scheduler::ProcessAllPendingEvents(); } void SwUiWriterTest::testTdf75137() @@ -3860,7 +3860,7 @@ void SwUiWriterTest::testRedlineParam() {"NextTrackedChange", uno::makeAny(static_cast<sal_uInt16>(0))} })); lcl_dispatchCommand(mxComponent, ".uno:NextTrackedChange", aPropertyValues); - Scheduler::ProcessEventsToIdle(); + Scheduler::ProcessAllPendingEvents(); SwShellCursor* pShellCursor = pWrtShell->getShellCursor(false); // This failed: the parameter wasn't handled so the next change (zzz) was // selected, not the first one (aaa). @@ -3873,7 +3873,7 @@ void SwUiWriterTest::testRedlineParam() {"NextTrackedChange", uno::makeAny(static_cast<sal_uInt16>(1))} }); lcl_dispatchCommand(mxComponent, ".uno:NextTrackedChange", aPropertyValues); - Scheduler::ProcessEventsToIdle(); + Scheduler::ProcessAllPendingEvents(); pShellCursor = pWrtShell->getShellCursor(false); CPPUNIT_ASSERT_EQUAL(OUString("zzz"), pShellCursor->GetText()); @@ -3884,7 +3884,7 @@ void SwUiWriterTest::testRedlineParam() {"RejectTrackedChange", uno::makeAny(static_cast<sal_uInt16>(1))} }); lcl_dispatchCommand(mxComponent, ".uno:RejectTrackedChange", aPropertyValues); - Scheduler::ProcessEventsToIdle(); + Scheduler::ProcessAllPendingEvents(); pShellCursor = pWrtShell->getShellCursor(false); // This was 'middlezzz', the uno command rejected the redline under the diff --git a/toolkit/source/awt/vclxtoolkit.cxx b/toolkit/source/awt/vclxtoolkit.cxx index 6acd3bb..6ced639 100644 --- a/toolkit/source/awt/vclxtoolkit.cxx +++ b/toolkit/source/awt/vclxtoolkit.cxx @@ -1951,7 +1951,7 @@ void SAL_CALL VCLXToolkit::processEventsToIdle() throw (css::uno::RuntimeException, std::exception) { SolarMutexGuard aSolarGuard; - Scheduler::ProcessEventsToIdle(); + Scheduler::ProcessAllPendingEvents(); } sal_Int64 SAL_CALL VCLXToolkit::getOpenGLBufferSwapCounter() diff --git a/vcl/headless/svpinst.cxx b/vcl/headless/svpinst.cxx index 28d1c69..53e7869b 100644 --- a/vcl/headless/svpinst.cxx +++ b/vcl/headless/svpinst.cxx @@ -240,8 +240,7 @@ bool SvpSalInstance::CheckTimeout( bool bExecuteTimers ) ImplSVData* pSVData = ImplGetSVData(); if( pSVData->mpSalTimer ) { - bool idle = true; // TODO - pSVData->mpSalTimer->CallCallback( idle ); + pSVData->mpSalTimer->CallCallback(); } } } diff --git a/vcl/inc/saltimer.hxx b/vcl/inc/saltimer.hxx index a143fbe..8585ddd 100644 --- a/vcl/inc/saltimer.hxx +++ b/vcl/inc/saltimer.hxx @@ -49,10 +49,10 @@ public: m_pProc = pProc; } - void CallCallback( bool idle ) + void CallCallback() { if( m_pProc ) - m_pProc( idle ); + m_pProc(); } }; diff --git a/vcl/inc/salwtype.hxx b/vcl/inc/salwtype.hxx index b7f803e..7228b2e 100644 --- a/vcl/inc/salwtype.hxx +++ b/vcl/inc/salwtype.hxx @@ -261,7 +261,7 @@ struct SalLongPressEvent long mnY; }; -typedef void (*SALTIMERPROC)( bool idle ); +typedef void (*SALTIMERPROC)(); #endif // INCLUDED_VCL_INC_SALWTYPE_HXX diff --git a/vcl/inc/unx/gtk/gtkdata.hxx b/vcl/inc/unx/gtk/gtkdata.hxx index 6b193f1..6ba4556 100644 --- a/vcl/inc/unx/gtk/gtkdata.hxx +++ b/vcl/inc/unx/gtk/gtkdata.hxx @@ -97,7 +97,6 @@ class GtkData : public SalGenericData GSource* m_pUserEvent; osl::Mutex m_aDispatchMutex; oslCondition m_aDispatchCondition; - bool blockIdleTimeout; public: GtkData( SalInstance *pInstance ); @@ -119,7 +118,6 @@ public: virtual bool ErrorTrapPop( bool bIgnoreError = true ) override; inline GtkSalDisplay *GetGtkDisplay() const; - bool BlockIdleTimeout() const { return blockIdleTimeout; } }; class GtkSalFrame; diff --git a/vcl/inc/unx/saldata.hxx b/vcl/inc/unx/saldata.hxx index a115298..cfd8b53 100644 --- a/vcl/inc/unx/saldata.hxx +++ b/vcl/inc/unx/saldata.hxx @@ -72,7 +72,7 @@ public: inline SalXLib* GetLib() const { return pXLib_; } - static void Timeout( bool idle ); + static void Timeout(); // X errors virtual void ErrorTrapPush() override; ... etc. - the rest is truncated _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits