diff options
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/app/idle.cxx | 10 | ||||
-rw-r--r-- | vcl/source/app/scheduler.cxx | 21 | ||||
-rw-r--r-- | vcl/source/app/timer.cxx | 9 |
3 files changed, 33 insertions, 7 deletions
diff --git a/vcl/source/app/idle.cxx b/vcl/source/app/idle.cxx index 198ccfc1b96e..123f37a13e4f 100644 --- a/vcl/source/app/idle.cxx +++ b/vcl/source/app/idle.cxx @@ -47,9 +47,15 @@ void Idle::Start() Scheduler::ImplStartTimer(Scheduler::ImmediateTimeoutMs); } -bool Idle::ReadyForSchedule( bool bTimer ) const +bool Idle::ReadyForSchedule( bool bTimerOnly, sal_uInt64 /* nTimeNow */ ) const { - return !bTimer; + // always ready if not only looking for timers. + return !bTimerOnly; +} + +bool Idle::IsIdle() const +{ + return true; } sal_uInt64 Idle::UpdateMinPeriod( sal_uInt64 nMinPeriod, sal_uInt64 /* nTime */ ) const diff --git a/vcl/source/app/scheduler.cxx b/vcl/source/app/scheduler.cxx index 8e548bc5cb42..265d6f64c332 100644 --- a/vcl/source/app/scheduler.cxx +++ b/vcl/source/app/scheduler.cxx @@ -46,10 +46,11 @@ ImplSchedulerData *ImplSchedulerData::GetMostImportantTask( bool bTimerOnly ) ImplSVData* pSVData = ImplGetSVData(); ImplSchedulerData *pMostUrgent = nullptr; + sal_uInt64 nTimeNow = tools::Time::GetSystemTicks(); for ( ImplSchedulerData *pSchedulerData = pSVData->mpFirstSchedulerData; pSchedulerData; pSchedulerData = pSchedulerData->mpNext ) { if ( !pSchedulerData->mpScheduler || pSchedulerData->mbDelete || - !pSchedulerData->mpScheduler->ReadyForSchedule( bTimerOnly ) || + !pSchedulerData->mpScheduler->ReadyForSchedule( bTimerOnly, nTimeNow ) || !pSchedulerData->mpScheduler->IsActive()) continue; if (!pMostUrgent) @@ -207,10 +208,24 @@ sal_uInt64 Scheduler::CalculateMinimumTimeout( bool &bHasActiveIdles ) { if (!pSchedulerData->mbInScheduler) { - if ( pSchedulerData->mpScheduler->ReadyForSchedule( true ) ) - nMinPeriod = pSchedulerData->mpScheduler->UpdateMinPeriod( nMinPeriod, nTime ); + // FIXME: move into a helper. + const char *pSchedulerName = pSchedulerData->mpScheduler->mpDebugName; + if (!pSchedulerName) + pSchedulerName = "unknown"; + + if ( !pSchedulerData->mpScheduler->IsIdle() ) + { + sal_uInt64 nOldMinPeriod = nMinPeriod; + nMinPeriod = pSchedulerData->mpScheduler->UpdateMinPeriod( + nOldMinPeriod, nTime ); + SAL_INFO("vcl.schedule", "Have active timer " << pSchedulerName << + "update min period from " << nOldMinPeriod << " to " << nMinPeriod); + } else + { + SAL_INFO("vcl.schedule", "Have active idle " << pSchedulerName); bHasActiveIdles = true; + } } pPrevSchedulerData = pSchedulerData; } diff --git a/vcl/source/app/timer.cxx b/vcl/source/app/timer.cxx index cb00fabb4efb..1766d7f0efe1 100644 --- a/vcl/source/app/timer.cxx +++ b/vcl/source/app/timer.cxx @@ -31,9 +31,14 @@ void Timer::SetDeletionFlags() } } -bool Timer::ReadyForSchedule( bool /* bTimerOnly */ ) const +bool Timer::ReadyForSchedule( bool /* bTimerOnly */, sal_uInt64 nTimeNow ) const { - return (mpSchedulerData->mnUpdateTime + mnTimeout) <= tools::Time::GetSystemTicks(); + return (mpSchedulerData->mnUpdateTime + mnTimeout) <= nTimeNow; +} + +bool Timer::IsIdle() const +{ + return false; } sal_uInt64 Timer::UpdateMinPeriod( sal_uInt64 nMinPeriod, sal_uInt64 nTime ) const |