Convert bTimer => bIdle

All other places already refer to being Idle, so change the
Scheduler::ProcessTaskScheduling argument to bIdle and adapt
all other scheduler-related functions.

Change-Id: If5a605abbc3e620092127b65ada29f11215a0343
This commit is contained in:
Jan-Marek Glogowski
2016-09-06 10:44:05 +02:00
parent 9ec3b1e1bf
commit 17bb382624
10 changed files with 18 additions and 20 deletions

View File

@@ -28,7 +28,7 @@ class VCL_DLLPUBLIC Idle : public Scheduler
Link<Idle *, void> maIdleHdl; // Callback Link
protected:
virtual bool ReadyForSchedule( bool bTimerOnly, sal_uInt64 nTimeNow ) const override;
virtual bool ReadyForSchedule( bool bIdle, sal_uInt64 nTimeNow ) const override;
virtual bool IsIdle() const override;
virtual sal_uInt64 UpdateMinPeriod( sal_uInt64 nMinPeriod, sal_uInt64 nTimeNow ) const override;

View File

@@ -54,7 +54,7 @@ protected:
friend struct ImplSchedulerData;
virtual void SetDeletionFlags();
/// Is this item ready to be dispatched at nTimeNow
virtual bool ReadyForSchedule( bool bTimerOnly, sal_uInt64 nTimeNow ) const = 0;
virtual bool ReadyForSchedule( bool bIdle, sal_uInt64 nTimeNow ) const = 0;
/// Schedule only when other timers and events are processed
virtual bool IsIdle() const = 0;
/**
@@ -90,7 +90,7 @@ public:
/// Calculate minimum timeout - and return its value.
static sal_uInt64 CalculateMinimumTimeout( bool &bHasActiveIdles );
/// Process one pending task ahead of time with highest priority.
static bool ProcessTaskScheduling( bool bTimerOnly );
static bool ProcessTaskScheduling( bool bIdle );
/// Process all events until we are idle
static void ProcessEventsToIdle();

View File

@@ -31,7 +31,7 @@ protected:
bool mbAuto;
virtual void SetDeletionFlags() override;
virtual bool ReadyForSchedule( bool bTimerOnly, sal_uInt64 nTimeNow ) const override;
virtual bool ReadyForSchedule( bool bIdle, sal_uInt64 nTimeNow ) const override;
virtual bool IsIdle() const override;
virtual sal_uInt64 UpdateMinPeriod( sal_uInt64 nMinPeriod, sal_uInt64 nTimeNow ) const override;

View File

@@ -70,7 +70,7 @@ struct ImplSchedulerData
void Invoke();
const char *GetDebugName() const;
static ImplSchedulerData *GetMostImportantTask( bool bTimerOnly, sal_uInt64 nTimeNow );
static ImplSchedulerData *GetMostImportantTask( bool bIdle, sal_uInt64 nTimeNow );
};
#endif // INCLUDED_VCL_INC_SALTIMER_HXX

View File

@@ -211,7 +211,7 @@ void LifecycleTest::testFocus()
xWin->Show();
xChild->GrabFocus();
// process asynchronous ToTop
Scheduler::ProcessTaskScheduling(false);
Scheduler::ProcessTaskScheduling( true );
// FIXME: really awful to test focus issues without showing windows.
// CPPUNIT_ASSERT(xChild->HasFocus());
}

View File

@@ -117,7 +117,7 @@ void TimerTest::testIdle()
{
bool bTriggered = false;
IdleBool aTest( bTriggered );
Scheduler::ProcessTaskScheduling(false);
Scheduler::ProcessTaskScheduling( true );
CPPUNIT_ASSERT_MESSAGE("idle triggered", bTriggered);
}

View File

@@ -63,10 +63,10 @@ void Idle::Start()
Scheduler::ImplStartTimer(nPeriod);
}
bool Idle::ReadyForSchedule( bool bTimerOnly, sal_uInt64 /* nTimeNow */ ) const
bool Idle::ReadyForSchedule( bool bIdle, sal_uInt64 /* nTimeNow */ ) const
{
// always ready if not only looking for timers.
return !bTimerOnly;
return bIdle;
}
bool Idle::IsIdle() const

View File

@@ -49,7 +49,7 @@ void ImplSchedulerData::Invoke()
mbInScheduler = false;
}
ImplSchedulerData *ImplSchedulerData::GetMostImportantTask( bool bTimerOnly, sal_uInt64 nTimeNow )
ImplSchedulerData *ImplSchedulerData::GetMostImportantTask( bool bIdle, sal_uInt64 nTimeNow )
{
ImplSVData* pSVData = ImplGetSVData();
ImplSchedulerData *pMostUrgent = nullptr;
@@ -57,7 +57,7 @@ ImplSchedulerData *ImplSchedulerData::GetMostImportantTask( bool bTimerOnly, sal
for ( ImplSchedulerData *pSchedulerData = pSVData->mpFirstSchedulerData; pSchedulerData; pSchedulerData = pSchedulerData->mpNext )
{
if ( !pSchedulerData->mpScheduler || pSchedulerData->mbDelete || pSchedulerData->mbInScheduler ||
!pSchedulerData->mpScheduler->ReadyForSchedule( bTimerOnly, nTimeNow ) ||
!pSchedulerData->mpScheduler->ReadyForSchedule( bIdle, nTimeNow ) ||
!pSchedulerData->mpScheduler->IsActive())
continue;
if (!pMostUrgent)
@@ -164,20 +164,20 @@ void InitSystemTimer(ImplSVData* pSVData)
}
void Scheduler::CallbackTaskScheduling(bool)
void Scheduler::CallbackTaskScheduling( bool bIdle )
{
// this function is for the saltimer callback
Scheduler::ProcessTaskScheduling( false );
Scheduler::ProcessTaskScheduling( bIdle );
}
bool Scheduler::ProcessTaskScheduling( bool bTimerOnly )
bool Scheduler::ProcessTaskScheduling( bool bIdle )
{
ImplSchedulerData* pSchedulerData;
sal_uInt64 nTime = tools::Time::GetSystemTicks();
DBG_TESTSOLARMUTEX();
if ((pSchedulerData = ImplSchedulerData::GetMostImportantTask(bTimerOnly, nTime)))
if ((pSchedulerData = ImplSchedulerData::GetMostImportantTask(bIdle, nTime)))
{
SAL_INFO("vcl.schedule", "Invoke task " << pSchedulerData->GetDebugName());
@@ -203,8 +203,6 @@ bool Scheduler::GetDeterministicMode()
sal_uInt64 Scheduler::CalculateMinimumTimeout( bool &bHasActiveIdles )
{
// process all pending Tasks
// if bTimer True, only handle timer
ImplSchedulerData* pSchedulerData = nullptr;
ImplSchedulerData* pPrevSchedulerData = nullptr;
ImplSVData* pSVData = ImplGetSVData();

View File

@@ -515,7 +515,7 @@ 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
Scheduler::ProcessTaskScheduling(eResult == SalYieldResult::EVENT);
Scheduler::ProcessTaskScheduling(eResult != SalYieldResult::EVENT);
}
// flush lazy deleted objects
@@ -535,7 +535,7 @@ void Application::Reschedule( bool i_bAllEvents )
void Scheduler::ProcessEventsToIdle()
{
int nSanity = 1000;
while(Scheduler::ProcessTaskScheduling(false) ||
while(Scheduler::ProcessTaskScheduling( true ) ||
ImplYield(false, false, 0))
{
if (nSanity-- < 0)

View File

@@ -31,7 +31,7 @@ void Timer::SetDeletionFlags()
}
}
bool Timer::ReadyForSchedule( bool /* bTimerOnly */, sal_uInt64 nTimeNow ) const
bool Timer::ReadyForSchedule( bool /* bIdle */, sal_uInt64 nTimeNow ) const
{
return (mpSchedulerData->mnUpdateTime + mnTimeout) <= nTimeNow;
}