summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan-Marek Glogowski <glogow@fbihome.de>2016-09-08 06:55:30 +0200
committerJan-Marek Glogowski <glogow@fbihome.de>2017-07-13 12:10:21 +0200
commitd348035a60361a1b9ba9eb7b67013204a24a6633 (patch)
tree85e7e4ff2dd926ef9d2907b4f4900815bdbb96c5
parent1782893282a4543e946e6b2c8de863b10fab0c85 (diff)
Drop special idle handling
Idles are just instant timers, which should most time have a low priority, By dropping most special idle handling we'll just schedule by priority. This also reverts SalYieldResult back to a bool, which just indicates if any event was processed. Change-Id: Ia0b91b06dffb77af066f01838d8f9483523bf67d
-rw-r--r--include/vcl/idle.hxx2
-rw-r--r--include/vcl/scheduler.hxx7
-rw-r--r--include/vcl/task.hxx2
-rw-r--r--include/vcl/timer.hxx2
-rw-r--r--sd/qa/unit/misc-tests.cxx4
-rw-r--r--vcl/headless/svpinst.cxx10
-rw-r--r--vcl/inc/headless/svpinst.hxx2
-rw-r--r--vcl/inc/osx/salinst.h2
-rw-r--r--vcl/inc/salinst.hxx8
-rw-r--r--vcl/inc/saltimer.hxx4
-rw-r--r--vcl/inc/salwtype.hxx2
-rw-r--r--vcl/inc/unx/gtk/gtkdata.hxx4
-rw-r--r--vcl/inc/unx/gtk/gtkinst.hxx2
-rw-r--r--vcl/inc/unx/saldata.hxx2
-rw-r--r--vcl/inc/unx/saldisp.hxx3
-rw-r--r--vcl/inc/unx/salinst.h2
-rw-r--r--vcl/inc/win/salinst.h2
-rw-r--r--vcl/osx/salinst.cxx11
-rw-r--r--vcl/osx/salnstimer.mm3
-rw-r--r--vcl/osx/saltimer.cxx6
-rw-r--r--vcl/qa/cppunit/lifecycle.cxx2
-rw-r--r--vcl/source/app/idle.cxx5
-rw-r--r--vcl/source/app/scheduler.cxx11
-rw-r--r--vcl/source/app/svapp.cxx23
-rw-r--r--vcl/source/app/timer.cxx2
-rw-r--r--vcl/unx/generic/app/saldata.cxx32
-rw-r--r--vcl/unx/generic/app/salinst.cxx2
-rw-r--r--vcl/unx/gtk/gtkdata.cxx18
-rw-r--r--vcl/unx/gtk/gtkinst.cxx2
-rw-r--r--vcl/unx/gtk3/gtk3gtkdata.cxx18
-rw-r--r--vcl/unx/kde4/KDEXLib.cxx24
-rw-r--r--vcl/unx/kde4/KDEXLib.hxx5
-rw-r--r--vcl/win/app/salinst.cxx13
-rw-r--r--vcl/win/app/saltimer.cxx4
34 files changed, 83 insertions, 158 deletions
diff --git a/include/vcl/idle.hxx b/include/vcl/idle.hxx
index 2112fc62464c..157d14d96816 100644
--- a/include/vcl/idle.hxx
+++ b/include/vcl/idle.hxx
@@ -35,7 +35,7 @@ private:
sal_uInt64 GetTimeout() const = delete;
protected:
- virtual bool ReadyForSchedule( bool bIdle, sal_uInt64 nTimeNow ) const override;
+ virtual bool ReadyForSchedule( sal_uInt64 nTimeNow ) const override;
virtual sal_uInt64 UpdateMinPeriod( sal_uInt64 nMinPeriod, sal_uInt64 nTimeNow ) const override;
Idle( bool bAuto, const sal_Char *pDebugName = nullptr );
diff --git a/include/vcl/scheduler.hxx b/include/vcl/scheduler.hxx
index f68b4a3b1a60..1dd127c96f9a 100644
--- a/include/vcl/scheduler.hxx
+++ b/include/vcl/scheduler.hxx
@@ -47,16 +47,17 @@ public:
static void ImplDeInitScheduler();
/// Process one pending Timer with highhest priority
- static void CallbackTaskScheduling( bool ignore );
+ static void CallbackTaskScheduling();
/// Are there any pending tasks to process?
static bool HasPendingTasks();
/// 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();
/**
* Process events until the parameter turns true,
* allows processing until a specific event has been processed
*/
- static void ProcessEventsToIdle();
static void ProcessEventsToSignal(bool& bSignal);
/// Control the deterministic mode. In this mode, two subsequent runs of
diff --git a/include/vcl/task.hxx b/include/vcl/task.hxx
index f2cee319a64f..21eb934fee6d 100644
--- a/include/vcl/task.hxx
+++ b/include/vcl/task.hxx
@@ -57,7 +57,7 @@ protected:
virtual void SetDeletionFlags();
/// Is this item ready to be dispatched at nTimeNow
- virtual bool ReadyForSchedule( bool bIdle, sal_uInt64 nTimeNow ) const = 0;
+ virtual bool ReadyForSchedule( sal_uInt64 nTimeNow ) const = 0;
/**
* Adjust nMinPeriod downwards if we want to be notified before
* then, nTimeNow is the current time.
diff --git a/include/vcl/timer.hxx b/include/vcl/timer.hxx
index c4cb297022d1..5be766cb6aa7 100644
--- a/include/vcl/timer.hxx
+++ b/include/vcl/timer.hxx
@@ -31,7 +31,7 @@ class VCL_DLLPUBLIC Timer : public Task
protected:
virtual void SetDeletionFlags() override;
- virtual bool ReadyForSchedule( bool bIdle, sal_uInt64 nTimeNow ) const override;
+ virtual bool ReadyForSchedule( sal_uInt64 nTimeNow ) const override;
virtual sal_uInt64 UpdateMinPeriod( sal_uInt64 nMinPeriod, sal_uInt64 nTimeNow ) const override;
Timer( bool bAuto, const sal_Char *pDebugName = nullptr );
diff --git a/sd/qa/unit/misc-tests.cxx b/sd/qa/unit/misc-tests.cxx
index e90deebc059e..60be08f83c09 100644
--- a/sd/qa/unit/misc-tests.cxx
+++ b/sd/qa/unit/misc-tests.cxx
@@ -105,7 +105,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));
@@ -149,7 +149,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::Standard);
diff --git a/vcl/headless/svpinst.cxx b/vcl/headless/svpinst.cxx
index a5a96fd41e52..2e803decccd3 100644
--- a/vcl/headless/svpinst.cxx
+++ b/vcl/headless/svpinst.cxx
@@ -239,10 +239,7 @@ bool SvpSalInstance::CheckTimeout( bool bExecuteTimers )
// notify
ImplSVData* pSVData = ImplGetSVData();
if( pSVData->maSchedCtx.mpSalTimer )
- {
- bool idle = true; // TODO
- pSVData->maSchedCtx.mpSalTimer->CallCallback( idle );
- }
+ pSVData->maSchedCtx.mpSalTimer->CallCallback();
}
}
}
@@ -307,7 +304,7 @@ SalBitmap* SvpSalInstance::CreateSalBitmap()
#endif
}
-SalYieldResult SvpSalInstance::DoYield(bool bWait, bool bHandleAllCurrentEvents, sal_uLong const nReleased)
+bool SvpSalInstance::DoYield(bool bWait, bool bHandleAllCurrentEvents, sal_uLong const nReleased)
{
(void) nReleased;
assert(nReleased == 0); // not implemented
@@ -374,8 +371,7 @@ SalYieldResult SvpSalInstance::DoYield(bool bWait, bool bHandleAllCurrentEvents,
DoReleaseYield(nTimeoutMS);
}
- return bEvent ? SalYieldResult::EVENT :
- SalYieldResult::TIMEOUT;
+ return bEvent;
}
void SvpSalInstance::DoReleaseYield( int nTimeoutMS )
diff --git a/vcl/inc/headless/svpinst.hxx b/vcl/inc/headless/svpinst.hxx
index 4a82c413372a..e8bb96ab68ac 100644
--- a/vcl/inc/headless/svpinst.hxx
+++ b/vcl/inc/headless/svpinst.hxx
@@ -155,7 +155,7 @@ public:
// wait next event and dispatch
// must returned by UserEvent (SalFrame::PostEvent)
// and timer
- virtual SalYieldResult DoYield(bool bWait, bool bHandleAllCurrentEvents, sal_uLong nReleased) override;
+ virtual bool DoYield(bool bWait, bool bHandleAllCurrentEvents, sal_uLong nReleased) override;
virtual bool AnyInput( VclInputFlags nType ) override;
virtual bool IsMainThread() const override { return true; }
diff --git a/vcl/inc/osx/salinst.h b/vcl/inc/osx/salinst.h
index b92a2aa35665..146391b073c2 100644
--- a/vcl/inc/osx/salinst.h
+++ b/vcl/inc/osx/salinst.h
@@ -107,7 +107,7 @@ public:
virtual sal_uLong ReleaseYieldMutex() override;
virtual void AcquireYieldMutex( sal_uLong nCount ) override;
virtual bool CheckYieldMutex() override;
- virtual SalYieldResult DoYield(bool bWait, bool bHandleAllCurrentEvents,
+ virtual bool DoYield(bool bWait, bool bHandleAllCurrentEvents,
sal_uLong nReleased) override;
virtual bool AnyInput( VclInputFlags nType ) override;
virtual SalMenu* CreateMenu( bool bMenuBar, Menu* pVCLMenu ) override;
diff --git a/vcl/inc/salinst.hxx b/vcl/inc/salinst.hxx
index 0e2703af8999..d8b9b0a32d64 100644
--- a/vcl/inc/salinst.hxx
+++ b/vcl/inc/salinst.hxx
@@ -58,8 +58,6 @@ class Menu;
enum class VclInputFlags;
enum class SalFrameStyleFlags;
-enum SalYieldResult { EVENT, TIMEOUT };
-
typedef struct _cairo_font_options cairo_font_options_t;
class VCL_PLUGIN_PUBLIC SalInstance
@@ -133,10 +131,10 @@ public:
* Wait for the next event (if bWait) and dispatch it,
* includes posted events, and timers.
* If bHandleAllCurrentEvents - dispatch multiple posted
- * user events. Returns true if events needed processing.
+ * user events. Returns true if events were processed.
*/
- virtual SalYieldResult DoYield(bool bWait, bool bHandleAllCurrentEvents, sal_uLong nReleased) = 0;
- virtual bool AnyInput( VclInputFlags nType ) = 0;
+ virtual bool DoYield(bool bWait, bool bHandleAllCurrentEvents, sal_uLong nReleased) = 0;
+ virtual bool AnyInput( VclInputFlags nType ) = 0;
// menus
virtual SalMenu* CreateMenu( bool bMenuBar, Menu* pMenu );
diff --git a/vcl/inc/saltimer.hxx b/vcl/inc/saltimer.hxx
index e9f28169bf35..e0179dd5fd27 100644
--- a/vcl/inc/saltimer.hxx
+++ b/vcl/inc/saltimer.hxx
@@ -48,10 +48,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 e07a980754d0..1538c8e78a25 100644
--- a/vcl/inc/salwtype.hxx
+++ b/vcl/inc/salwtype.hxx
@@ -258,7 +258,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 8e8719a8a174..2582314eb003 100644
--- a/vcl/inc/unx/gtk/gtkdata.hxx
+++ b/vcl/inc/unx/gtk/gtkdata.hxx
@@ -98,7 +98,6 @@ class GtkData : public SalGenericData
osl::Mutex m_aDispatchMutex;
osl::Condition m_aDispatchCondition;
css::uno::Any m_aException;
- bool blockIdleTimeout;
public:
GtkData( SalInstance *pInstance );
@@ -113,14 +112,13 @@ public:
static gboolean userEventFn( gpointer data );
void PostUserEvent();
- SalYieldResult Yield( bool bWait, bool bHandleAllCurrentEvents );
+ bool Yield( bool bWait, bool bHandleAllCurrentEvents );
inline GdkDisplay *GetGdkDisplay();
virtual void ErrorTrapPush() override;
virtual bool ErrorTrapPop( bool bIgnoreError = true ) override;
inline GtkSalDisplay *GetGtkDisplay() const;
- bool BlockIdleTimeout() const { return blockIdleTimeout; }
void setException(const css::uno::Any& rException) { m_aException = rException; }
};
diff --git a/vcl/inc/unx/gtk/gtkinst.hxx b/vcl/inc/unx/gtk/gtkinst.hxx
index 983fbf287deb..4c86a3d62867 100644
--- a/vcl/inc/unx/gtk/gtkinst.hxx
+++ b/vcl/inc/unx/gtk/gtkinst.hxx
@@ -208,7 +208,7 @@ public:
const SystemGraphicsData* = nullptr ) override;
virtual SalBitmap* CreateSalBitmap() override;
- virtual SalYieldResult DoYield(bool bWait, bool bHandleAllCurrentEvents, sal_uLong nReleased) override;
+ virtual bool DoYield(bool bWait, bool bHandleAllCurrentEvents, sal_uLong nReleased) override;
virtual bool AnyInput( VclInputFlags nType ) override;
// impossible to handle correctly, as "main thread" depends on the dispatch mutex
virtual bool IsMainThread() const override { return false; }
diff --git a/vcl/inc/unx/saldata.hxx b/vcl/inc/unx/saldata.hxx
index 9e8928122a97..e7899c4138f4 100644
--- a/vcl/inc/unx/saldata.hxx
+++ b/vcl/inc/unx/saldata.hxx
@@ -72,7 +72,7 @@ public:
SalXLib* GetLib() const { return pXLib_; }
- static void Timeout( bool idle );
+ static void Timeout();
// X errors
virtual void ErrorTrapPush() override;
diff --git a/vcl/inc/unx/saldisp.hxx b/vcl/inc/unx/saldisp.hxx
index 31b11b470530..2c23d6010c35 100644
--- a/vcl/inc/unx/saldisp.hxx
+++ b/vcl/inc/unx/saldisp.hxx
@@ -153,7 +153,6 @@ protected:
timeval m_aTimeout;
sal_uLong m_nTimeoutMS;
int m_pTimeoutFDS[2];
- bool blockIdleTimeout;
int nFDs_;
fd_set aReadFDS_;
@@ -167,7 +166,7 @@ public:
virtual ~SalXLib();
virtual void Init();
- virtual SalYieldResult Yield( bool bWait, bool bHandleAllCurrentEvents );
+ virtual bool Yield( bool bWait, bool bHandleAllCurrentEvents );
virtual void Wakeup();
virtual void PostUserEvent();
diff --git a/vcl/inc/unx/salinst.h b/vcl/inc/unx/salinst.h
index 1f9c43bf2232..848356dff327 100644
--- a/vcl/inc/unx/salinst.h
+++ b/vcl/inc/unx/salinst.h
@@ -74,7 +74,7 @@ public:
virtual SalSession* CreateSalSession() override;
virtual OpenGLContext* CreateOpenGLContext() override;
- virtual SalYieldResult DoYield(bool bWait, bool bHandleAllCurrentEvents, sal_uLong nReleased) override;
+ virtual bool DoYield(bool bWait, bool bHandleAllCurrentEvents, sal_uLong nReleased) override;
virtual bool AnyInput( VclInputFlags nType ) override;
virtual bool IsMainThread() const override { return true; }
diff --git a/vcl/inc/win/salinst.h b/vcl/inc/win/salinst.h
index 022f67e0557a..359bc275e463 100644
--- a/vcl/inc/win/salinst.h
+++ b/vcl/inc/win/salinst.h
@@ -64,7 +64,7 @@ public:
virtual bool CheckYieldMutex() override;
virtual bool IsMainThread() const override;
- virtual SalYieldResult DoYield(bool bWait, bool bHandleAllCurrentEvents, sal_uLong nReleased) override;
+ virtual bool DoYield(bool bWait, bool bHandleAllCurrentEvents, sal_uLong nReleased) override;
virtual bool AnyInput( VclInputFlags nType ) override;
virtual SalMenu* CreateMenu( bool bMenuBar, Menu* ) override;
virtual void DestroyMenu( SalMenu* ) override;
diff --git a/vcl/osx/salinst.cxx b/vcl/osx/salinst.cxx
index cbc24100e42a..c1890c8d5eb7 100644
--- a/vcl/osx/salinst.cxx
+++ b/vcl/osx/salinst.cxx
@@ -559,7 +559,7 @@ class ReleasePoolHolder
~ReleasePoolHolder() { [mpPool release]; }
};
-SalYieldResult AquaSalInstance::DoYield(bool bWait, bool bHandleAllCurrentEvents, sal_uLong const nReleased)
+bool AquaSalInstance::DoYield(bool bWait, bool bHandleAllCurrentEvents, sal_uLong const nReleased)
{
(void) nReleased;
assert(nReleased == 0); // not implemented
@@ -600,7 +600,7 @@ SalYieldResult AquaSalInstance::DoYield(bool bWait, bool bHandleAllCurrentEvents
maWaitingYieldCond.set();
// return if only one event is asked for
if( ! bHandleAllCurrentEvents )
- return SalYieldResult::EVENT;
+ return true;
}
}
@@ -661,10 +661,7 @@ SAL_WNODEPRECATED_DECLARATIONS_POP
// this cause crashes on MacOSX 10.4
// [AquaSalTimer::pRunningTimer fire];
if (ImplGetSVData()->maSchedCtx.mpSalTimer != nullptr)
- {
- bool const idle = true; // TODO
- ImplGetSVData()->maSchedCtx.mpSalTimer->CallCallback( idle );
- }
+ ImplGetSVData()->maSchedCtx.mpSalTimer->CallCallback();
}
}
@@ -717,7 +714,7 @@ SAL_WNODEPRECATED_DECLARATIONS_POP
}
}
- return bHadEvent ? SalYieldResult::EVENT : SalYieldResult::TIMEOUT;
+ return bHadEvent;
}
bool AquaSalInstance::AnyInput( VclInputFlags nType )
diff --git a/vcl/osx/salnstimer.mm b/vcl/osx/salnstimer.mm
index 3c67b8b7f593..00f67e52cd26 100644
--- a/vcl/osx/salnstimer.mm
+++ b/vcl/osx/salnstimer.mm
@@ -35,8 +35,7 @@
ImplSVData* pSVData = ImplGetSVData();
if( pSVData->maSchedCtx.mpSalTimer )
{
- bool const idle = true; // TODO
- pSVData->maSchedCtx.mpSalTimer->CallCallback( idle );
+ pSVData->maSchedCtx.mpSalTimer->CallCallback();
// NSTimer does not end nextEventMatchingMask of NSApplication
// so we need to wakeup a waiting Yield to inform it something happened
diff --git a/vcl/osx/saltimer.cxx b/vcl/osx/saltimer.cxx
index 86e42553d097..0221c81a17ae 100644
--- a/vcl/osx/saltimer.cxx
+++ b/vcl/osx/saltimer.cxx
@@ -101,11 +101,7 @@ void AquaSalTimer::handleStartTimerEvent( NSEvent* pEvent )
{
SolarMutexGuard aGuard;
if( pSVData->maSchedCtx.mpSalTimer )
- {
- // timer already elapsed since event posted
- bool const idle = true; // TODO
- pSVData->maSchedCtx.mpSalTimer->CallCallback( idle );
- }
+ pSVData->maSchedCtx.mpSalTimer->CallCallback();
}
ImplSalStartTimer( sal_uLong( [pEvent data1] ) );
}
diff --git a/vcl/qa/cppunit/lifecycle.cxx b/vcl/qa/cppunit/lifecycle.cxx
index 6cede7ceee4d..26f8796a57ea 100644
--- a/vcl/qa/cppunit/lifecycle.cxx
+++ b/vcl/qa/cppunit/lifecycle.cxx
@@ -212,7 +212,7 @@ void LifecycleTest::testFocus()
xWin->Show();
xChild->GrabFocus();
// process asynchronous ToTop
- Scheduler::ProcessTaskScheduling( true );
+ Scheduler::ProcessTaskScheduling();
// FIXME: really awful to test focus issues without showing windows.
// CPPUNIT_ASSERT(xChild->HasFocus());
}
diff --git a/vcl/source/app/idle.cxx b/vcl/source/app/idle.cxx
index 912c79a65d57..18f12076710d 100644
--- a/vcl/source/app/idle.cxx
+++ b/vcl/source/app/idle.cxx
@@ -55,12 +55,11 @@ void Idle::Start()
Task::StartTimer(nPeriod);
}
-bool Idle::ReadyForSchedule( bool bIdle, sal_uInt64 /* nTimeNow */ ) const
+bool Idle::ReadyForSchedule( sal_uInt64 /* nTimeNow */ ) const
{
- // always ready if not only looking for timers.
ImplSVData *pSVData = ImplGetSVData();
pSVData->maSchedCtx.mbNeedsReschedule = true;
- return bIdle;
+ return true;
}
sal_uInt64 Idle::UpdateMinPeriod( sal_uInt64 /* nMinPeriod */, sal_uInt64 /* nTimeNow */ ) const
diff --git a/vcl/source/app/scheduler.cxx b/vcl/source/app/scheduler.cxx
index 9b954f4a1c3f..8c04d5916688 100644
--- a/vcl/source/app/scheduler.cxx
+++ b/vcl/source/app/scheduler.cxx
@@ -149,10 +149,10 @@ void Scheduler::ImplStartTimer(sal_uInt64 nMS, bool bForce)
}
}
-void Scheduler::CallbackTaskScheduling( bool bIdle )
+void Scheduler::CallbackTaskScheduling()
{
// this function is for the saltimer callback
- Scheduler::ProcessTaskScheduling( bIdle );
+ Scheduler::ProcessTaskScheduling();
}
static bool g_bDeterministicMode = false;
@@ -193,7 +193,7 @@ inline void Scheduler::UpdateMinPeriod( ImplSchedulerData *pSchedulerData,
}
}
-bool Scheduler::ProcessTaskScheduling( bool bIdle )
+bool Scheduler::ProcessTaskScheduling()
{
ImplSVData *pSVData = ImplGetSVData();
ImplSchedulerContext &rSchedCtx = pSVData->maSchedCtx;
@@ -252,7 +252,7 @@ bool Scheduler::ProcessTaskScheduling( bool bIdle )
UpdateMinPeriod( pSchedulerData, nTime, nMinPeriod );
// skip ready tasks with lower priority than the most urgent (numerical lower is higher)
- if ( pSchedulerData->mpTask->ReadyForSchedule( bIdle, nTime ) &&
+ if ( pSchedulerData->mpTask->ReadyForSchedule( nTime ) &&
(!pMostUrgent || (pSchedulerData->mpTask->GetPriority() < pMostUrgent->mpTask->GetPriority())) )
{
pMostUrgent = pSchedulerData;
@@ -299,10 +299,7 @@ next_entry:
pMostUrgent->mbInScheduler = false;
if ( pMostUrgent->mpTask && !pMostUrgent->mbDelete )
- {
pMostUrgent->mnUpdateTime = tools::Time::GetSystemTicks();
- UpdateMinPeriod( pMostUrgent, nTime, nMinPeriod );
- }
}
return !!pMostUrgent;
diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx
index 3a5c89850431..a6cad056c27a 100644
--- a/vcl/source/app/svapp.cxx
+++ b/vcl/source/app/svapp.cxx
@@ -469,8 +469,7 @@ 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 we have idles, don't wait for the timeout; check for events
- // and come back as quick as possible.
+ // we handle pending task outside the system event loop, so don't wait
if (i_bWait && Scheduler::HasPendingTasks())
i_bWait = false;
@@ -482,15 +481,12 @@ inline bool ImplYield(bool i_bWait, bool i_bAllEvents, sal_uLong const nReleased
// do not wait for events if application was already quit; in that
// case only dispatch events already available
- // do not wait for events either if the app decided that it is too busy for timers
- // (feature added for the slideshow)
- SalYieldResult eResult =
+ bool bProcessedEvent =
pSVData->mpDefInst->DoYield(
i_bWait && !pSVData->maAppData.mbAppQuit,
i_bAllEvents, nReleased);
- SAL_INFO("vcl.schedule", "DoYield returns: "
- << (eResult == SalYieldResult::EVENT ? "processed event" : "timeout"));
+ SAL_INFO("vcl.schedule", "DoYield returns: " << bProcessedEvent );
pSVData->maAppData.mnDispatchLevel--;
@@ -499,16 +495,15 @@ 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);
+ bProcessedEvent = Scheduler::ProcessTaskScheduling() || bProcessedEvent;
}
// flush lazy deleted objects
if( pSVData->maAppData.mnDispatchLevel == 0 )
vcl::LazyDelete::flush();
- SAL_INFO("vcl.schedule", "Leave ImplYield");
-
- return Scheduler::HasPendingTasks() || eResult == SalYieldResult::EVENT;
+ SAL_INFO("vcl.schedule", "Leave ImplYield with return " << bProcessedEvent );
+ return bProcessedEvent || Scheduler::HasPendingTasks();
}
bool Application::Reschedule( bool i_bAllEvents )
@@ -518,7 +513,7 @@ bool Application::Reschedule( bool i_bAllEvents )
void Scheduler::ProcessEventsToSignal(bool& bSignal)
{
- while(!bSignal && (Scheduler::ProcessTaskScheduling( true ) ||
+ while(!bSignal && (Scheduler::ProcessTaskScheduling() ||
ImplYield(false, false, 0)))
{
}
@@ -527,8 +522,8 @@ void Scheduler::ProcessEventsToSignal(bool& bSignal)
void Scheduler::ProcessEventsToIdle()
{
int nSanity = 1000;
- while(Scheduler::ProcessTaskScheduling( true ) ||
- ImplYield(false, false, 0))
+ while( Scheduler::ProcessTaskScheduling() ||
+ ImplYield(false, true, 0) )
{
if (nSanity-- < 0)
{
diff --git a/vcl/source/app/timer.cxx b/vcl/source/app/timer.cxx
index e1b6ac777ca5..18796806a318 100644
--- a/vcl/source/app/timer.cxx
+++ b/vcl/source/app/timer.cxx
@@ -30,7 +30,7 @@ void Timer::SetDeletionFlags()
Task::SetDeletionFlags();
}
-bool Timer::ReadyForSchedule( bool /* bIdle */, sal_uInt64 nTimeNow ) const
+bool Timer::ReadyForSchedule( sal_uInt64 nTimeNow ) const
{
return (GetSchedulerData()->mnUpdateTime + mnTimeout) <= nTimeNow;
}
diff --git a/vcl/unx/generic/app/saldata.cxx b/vcl/unx/generic/app/saldata.cxx
index 73369b5becb8..62fdd827ddd1 100644
--- a/vcl/unx/generic/app/saldata.cxx
+++ b/vcl/unx/generic/app/saldata.cxx
@@ -322,7 +322,6 @@ void X11SalData::PopXErrorLevel()
}
SalXLib::SalXLib()
- : blockIdleTimeout( false )
{
m_aTimeout.tv_sec = 0;
m_aTimeout.tv_usec = 0;
@@ -561,11 +560,11 @@ void X11SalData::XError( Display *pDisplay, XErrorEvent *pEvent )
m_aXErrorHandlerStack.back().m_bWas = true;
}
-void X11SalData::Timeout( bool idle )
+void X11SalData::Timeout()
{
ImplSVData* pSVData = ImplGetSVData();
if( pSVData->maSchedCtx.mpSalTimer )
- pSVData->maSchedCtx.mpSalTimer->CallCallback( idle );
+ pSVData->maSchedCtx.mpSalTimer->CallCallback();
}
struct YieldEntry
@@ -644,30 +643,17 @@ bool SalXLib::CheckTimeout( bool bExecuteTimers )
* timers are being dispatched.
*/
m_aTimeout += m_nTimeoutMS;
- // Determine if the app is idle (for idle timers). If there's user input pending,
- // if there's IO pending or if we're called inside a temporary yield (=blockIdleTimeout),
- // then the app is not idle.
- bool idle = true;
- if( blockIdleTimeout || XPending( vcl_sal::getSalDisplay(GetGenericData())->GetDisplay()))
- idle = false;
- for ( int nFD = 0; idle && nFD < nFDs_; nFD++ )
- {
- YieldEntry* pEntry = &(yieldTable[nFD]);
- if ( pEntry->fd && pEntry->HasPendingEvent())
- idle = false;
- }
// notify
- X11SalData::Timeout( idle );
+ X11SalData::Timeout();
}
}
}
return bRet;
}
-SalYieldResult
+bool
SalXLib::Yield( bool bWait, bool bHandleAllCurrentEvents )
{
- blockIdleTimeout = !bWait;
// check for timeouts here if you want to make screenshots
static char* p_prioritize_timer = getenv ("SAL_HIGHPRIORITY_REPAINT");
if (p_prioritize_timer != nullptr)
@@ -687,8 +673,7 @@ SalXLib::Yield( bool bWait, bool bHandleAllCurrentEvents )
pEntry->HandleNextEvent();
if( ! bHandleAllCurrentEvents )
{
- blockIdleTimeout = false;
- return SalYieldResult::EVENT;
+ return true;
}
}
}
@@ -764,8 +749,7 @@ SalXLib::Yield( bool bWait, bool bHandleAllCurrentEvents )
// someone-else has done the job for us
if (nFound == 0)
{
- blockIdleTimeout = false;
- return SalYieldResult::TIMEOUT;
+ return false;
}
for ( int nFD = 0; nFD < nFDs_; nFD++ )
@@ -793,10 +777,8 @@ SalXLib::Yield( bool bWait, bool bHandleAllCurrentEvents )
}
}
}
- blockIdleTimeout = false;
- return bHandledEvent ? SalYieldResult::EVENT
- : SalYieldResult::TIMEOUT;
+ return bHandledEvent;
}
void SalXLib::Wakeup()
diff --git a/vcl/unx/generic/app/salinst.cxx b/vcl/unx/generic/app/salinst.cxx
index c63274db4e4d..456c238a1d08 100644
--- a/vcl/unx/generic/app/salinst.cxx
+++ b/vcl/unx/generic/app/salinst.cxx
@@ -166,7 +166,7 @@ bool X11SalInstance::AnyInput(VclInputFlags nType)
return bRet;
}
-SalYieldResult X11SalInstance::DoYield(bool bWait, bool bHandleAllCurrentEvents, sal_uLong const nReleased)
+bool X11SalInstance::DoYield(bool bWait, bool bHandleAllCurrentEvents, sal_uLong const nReleased)
{
(void) nReleased;
assert(nReleased == 0); // not implemented
diff --git a/vcl/unx/gtk/gtkdata.cxx b/vcl/unx/gtk/gtkdata.cxx
index 710a345726ad..e5278f157698 100644
--- a/vcl/unx/gtk/gtkdata.cxx
+++ b/vcl/unx/gtk/gtkdata.cxx
@@ -417,7 +417,6 @@ GtkData::GtkData( SalInstance *pInstance )
: SalGenericData( SAL_DATA_GTK, pInstance )
, m_aDispatchMutex()
, m_aDispatchCondition()
- , blockIdleTimeout( false )
{
m_pUserEvent = nullptr;
}
@@ -461,10 +460,8 @@ void GtkData::Dispose()
}
/// Allows events to be processed, returns true if we processed an event.
-SalYieldResult GtkData::Yield( bool bWait, bool bHandleAllCurrentEvents )
+bool GtkData::Yield( bool bWait, bool bHandleAllCurrentEvents )
{
- blockIdleTimeout = !bWait;
-
/* #i33212# only enter g_main_context_iteration in one thread at any one
* time, else one of them potentially will never end as long as there is
* another thread in there. Having only one yielding thread actually dispatch
@@ -479,8 +476,7 @@ SalYieldResult GtkData::Yield( bool bWait, bool bHandleAllCurrentEvents )
bDispatchThread = true;
else if( ! bWait )
{
- blockIdleTimeout = false;
- return SalYieldResult::TIMEOUT; // someone else is waiting already, return
+ return false; // someone else is waiting already, return
}
if( bDispatchThread )
@@ -512,10 +508,8 @@ SalYieldResult GtkData::Yield( bool bWait, bool bHandleAllCurrentEvents )
if( bWasEvent )
m_aDispatchCondition.set(); // trigger non dispatch thread yields
}
- blockIdleTimeout = false;
- return bWasEvent ? SalYieldResult::EVENT
- : SalYieldResult::TIMEOUT;
+ return bWasEvent;
}
void GtkData::Init()
@@ -736,11 +730,7 @@ extern "C" {
ImplSVData* pSVData = ImplGetSVData();
if( pSVData->maSchedCtx.mpSalTimer )
- {
- // TODO: context_pending should be probably checked too, but it causes locking assertion failures
- bool idle = !pSalData->BlockIdleTimeout() && /*!g_main_context_pending( NULL ) &&*/ !gdk_events_pending();
- pSVData->maSchedCtx.mpSalTimer->CallCallback( idle );
- }
+ pSVData->maSchedCtx.mpSalTimer->CallCallback();
return TRUE;
}
diff --git a/vcl/unx/gtk/gtkinst.cxx b/vcl/unx/gtk/gtkinst.cxx
index 265dcb961a0e..034b634a0f79 100644
--- a/vcl/unx/gtk/gtkinst.cxx
+++ b/vcl/unx/gtk/gtkinst.cxx
@@ -411,7 +411,7 @@ void GtkInstance::RemoveTimer (SalTimer *pTimer)
m_aTimers.erase( it );
}
-SalYieldResult GtkInstance::DoYield(bool bWait, bool bHandleAllCurrentEvents, sal_uLong const nReleased)
+bool GtkInstance::DoYield(bool bWait, bool bHandleAllCurrentEvents, sal_uLong const nReleased)
{
(void) nReleased;
assert(nReleased == 0); // not implemented
diff --git a/vcl/unx/gtk3/gtk3gtkdata.cxx b/vcl/unx/gtk3/gtk3gtkdata.cxx
index 47235ebcbb02..3e074489bfd5 100644
--- a/vcl/unx/gtk3/gtk3gtkdata.cxx
+++ b/vcl/unx/gtk3/gtk3gtkdata.cxx
@@ -388,7 +388,6 @@ GtkData::GtkData( SalInstance *pInstance )
: SalGenericData( SAL_DATA_GTK3, pInstance )
, m_aDispatchMutex()
, m_aDispatchCondition()
- , blockIdleTimeout( false )
{
m_pUserEvent = nullptr;
}
@@ -437,10 +436,8 @@ void GtkData::Dispose()
}
/// Allows events to be processed, returns true if we processed an event.
-SalYieldResult GtkData::Yield( bool bWait, bool bHandleAllCurrentEvents )
+bool GtkData::Yield( bool bWait, bool bHandleAllCurrentEvents )
{
- blockIdleTimeout = !bWait;
-
/* #i33212# only enter g_main_context_iteration in one thread at any one
* time, else one of them potentially will never end as long as there is
* another thread in there. Having only one yielding thread actually dispatch
@@ -455,8 +452,7 @@ SalYieldResult GtkData::Yield( bool bWait, bool bHandleAllCurrentEvents )
bDispatchThread = true;
else if( ! bWait )
{
- blockIdleTimeout = false;
- return SalYieldResult::TIMEOUT; // someone else is waiting already, return
+ return false; // someone else is waiting already, return
}
if( bDispatchThread )
@@ -490,10 +486,8 @@ SalYieldResult GtkData::Yield( bool bWait, bool bHandleAllCurrentEvents )
if( bWasEvent )
m_aDispatchCondition.set(); // trigger non dispatch thread yields
}
- blockIdleTimeout = false;
- return bWasEvent ? SalYieldResult::EVENT
- : SalYieldResult::TIMEOUT;
+ return bWasEvent;
}
void GtkData::Init()
@@ -698,11 +692,7 @@ extern "C" {
ImplSVData* pSVData = ImplGetSVData();
if( pSVData->maSchedCtx.mpSalTimer )
- {
- // TODO: context_pending should be probably checked too, but it causes locking assertion failures
- bool idle = !pSalData->BlockIdleTimeout() && /*!g_main_context_pending( NULL ) &&*/ !gdk_events_pending();
- pSVData->maSchedCtx.mpSalTimer->CallCallback( idle );
- }
+ pSVData->maSchedCtx.mpSalTimer->CallCallback();
return TRUE;
}
diff --git a/vcl/unx/kde4/KDEXLib.cxx b/vcl/unx/kde4/KDEXLib.cxx
index a1dea735f348..23332d8c1777 100644
--- a/vcl/unx/kde4/KDEXLib.cxx
+++ b/vcl/unx/kde4/KDEXLib.cxx
@@ -50,8 +50,7 @@
KDEXLib::KDEXLib() :
SalXLib(), m_bStartupDone(false),
m_pFreeCmdLineArgs(nullptr), m_pAppCmdLineArgs(nullptr), m_nFakeCmdLineArgs( 0 ),
- m_isGlibEventLoopType(false),
- m_allowKdeDialogs(false), m_blockIdleTimeout(false)
+ m_isGlibEventLoopType(false), m_allowKdeDialogs(false)
{
// the timers created here means they belong to the main thread.
// As the timeoutTimer runs the LO event queue, which may block on a dialog,
@@ -267,7 +266,7 @@ void KDEXLib::socketNotifierActivated( int fd )
sdata.handle( fd, sdata.data );
}
-SalYieldResult KDEXLib::Yield( bool bWait, bool bHandleAllCurrentEvents )
+bool KDEXLib::Yield( bool bWait, bool bHandleAllCurrentEvents )
{
if( !m_isGlibEventLoopType )
{
@@ -278,9 +277,7 @@ SalYieldResult KDEXLib::Yield( bool bWait, bool bHandleAllCurrentEvents )
// otherwise they can remain unhandled for quite a long while
wasEvent = processYield( false, bHandleAllCurrentEvents );
}
- SalYieldResult aResult = SalXLib::Yield(bWait, bHandleAllCurrentEvents);
- return (aResult == SalYieldResult::EVENT || wasEvent) ?
- SalYieldResult::EVENT : SalYieldResult::TIMEOUT;
+ return SalXLib::Yield(bWait, bHandleAllCurrentEvents) || wasEvent;
}
// if we are the main thread (which is where the event processing is done),
// good, just do it
@@ -296,7 +293,7 @@ SalYieldResult KDEXLib::Yield( bool bWait, bool bHandleAllCurrentEvents )
// temporarily do it while checking for new events)
SalYieldMutexReleaser aReleaser;
Q_EMIT processYieldSignal( bWait, bHandleAllCurrentEvents );
- return SalYieldResult::TIMEOUT;
+ return false;
}
}
@@ -304,18 +301,15 @@ SalYieldResult KDEXLib::Yield( bool bWait, bool bHandleAllCurrentEvents )
* Quoting the Qt docs: [QAbstractEventDispatcher::processEvents] processes
* pending events that match flags until there are no more events to process.
*/
-SalYieldResult KDEXLib::processYield( bool bWait, bool )
+bool KDEXLib::processYield( bool bWait, bool )
{
- m_blockIdleTimeout = !bWait;
QAbstractEventDispatcher* dispatcher = QAbstractEventDispatcher::instance( qApp->thread());
bool wasEvent = false;
if ( bWait )
wasEvent = dispatcher->processEvents( QEventLoop::WaitForMoreEvents );
else
wasEvent = dispatcher->processEvents( QEventLoop::AllEvents );
- m_blockIdleTimeout = false;
- return wasEvent ? SalYieldResult::EVENT
- : SalYieldResult::TIMEOUT;
+ return wasEvent;
}
void KDEXLib::StartTimer( sal_uLong nMS )
@@ -353,11 +347,7 @@ void KDEXLib::timeoutActivated()
// some sense (timeouts should be more ok to wait and be triggered somewhen).
while( SalKDEDisplay::self()->HasUserEvents() )
SalKDEDisplay::self()->DispatchInternalEvent();
-
- // QGuiEventDispatcherGlib makes glib watch also X11 fd, but its hasPendingEvents()
- // doesn't check X11, so explicitly check XPending() here.
- bool idle = QApplication::hasPendingEvents() && !m_blockIdleTimeout && !XPending( QX11Info::display());
- X11SalData::Timeout( idle );
+ X11SalData::Timeout();
// QTimer is not single shot, so will be restarted immediately
}
diff --git a/vcl/unx/kde4/KDEXLib.hxx b/vcl/unx/kde4/KDEXLib.hxx
index 4b482cc8c0d9..1242d4542ac6 100644
--- a/vcl/unx/kde4/KDEXLib.hxx
+++ b/vcl/unx/kde4/KDEXLib.hxx
@@ -55,7 +55,6 @@ class KDEXLib : public QObject, public SalXLib
QTimer userEventTimer;
bool m_isGlibEventLoopType;
bool m_allowKdeDialogs;
- bool m_blockIdleTimeout;
private:
void setupEventLoop();
@@ -66,7 +65,7 @@ class KDEXLib : public QObject, public SalXLib
void userEventActivated();
void startTimeoutTimer();
void startUserEventTimer();
- SalYieldResult processYield( bool bWait, bool bHandleAllCurrentEvents );
+ static bool processYield( bool bWait, bool bHandleAllCurrentEvents );
Q_SIGNALS:
void startTimeoutTimerSignal();
void startUserEventTimerSignal();
@@ -79,7 +78,7 @@ class KDEXLib : public QObject, public SalXLib
virtual ~KDEXLib() override;
virtual void Init() override;
- virtual SalYieldResult Yield( bool bWait, bool bHandleAllCurrentEvents ) override;
+ virtual bool Yield( bool bWait, bool bHandleAllCurrentEvents ) override;
virtual void Insert( int fd, void* data, YieldFunc pending, YieldFunc queued, YieldFunc handle ) override;
virtual void Remove( int fd ) override;
virtual void StartTimer( sal_uLong nMS ) override;
diff --git a/vcl/win/app/salinst.cxx b/vcl/win/app/salinst.cxx
index 1fbdda70b261..6fbe7bca7021 100644
--- a/vcl/win/app/salinst.cxx
+++ b/vcl/win/app/salinst.cxx
@@ -559,7 +559,7 @@ static void ImplSalDispatchMessage( MSG* pMsg )
ImplSalPostDispatchMsg( pMsg, lResult );
}
-SalYieldResult
+bool
ImplSalYield( bool bWait, bool bHandleAllCurrentEvents )
{
MSG aMsg;
@@ -587,8 +587,7 @@ ImplSalYield( bool bWait, bool bHandleAllCurrentEvents )
ImplSalDispatchMessage( &aMsg );
}
}
- return bWasMsg ? SalYieldResult::EVENT :
- SalYieldResult::TIMEOUT;
+ return bWasMsg;
}
bool WinSalInstance::IsMainThread() const
@@ -597,9 +596,9 @@ bool WinSalInstance::IsMainThread() const
return pSalData->mnAppThreadId == GetCurrentThreadId();
}
-SalYieldResult WinSalInstance::DoYield(bool bWait, bool bHandleAllCurrentEvents, sal_uLong const nReleased)
+bool WinSalInstance::DoYield(bool bWait, bool bHandleAllCurrentEvents, sal_uLong const nReleased)
{
- SalYieldResult eDidWork = SalYieldResult::TIMEOUT;
+ bool bDidWork = false;
// NOTE: if nReleased != 0 this will be called without SolarMutex
// so don't do anything dangerous before releasing it here
SalYieldMutex* pYieldMutex = mpSalYieldMutex;
@@ -641,7 +640,7 @@ SalYieldResult WinSalInstance::DoYield(bool bWait, bool bHandleAllCurrentEvents,
{
if (nReleased == 0) // tdf#99383 ReAcquireSolarMutex shouldn't Yield
{
- eDidWork = ImplSalYield( bWait, bHandleAllCurrentEvents );
+ bDidWork = ImplSalYield( bWait, bHandleAllCurrentEvents );
}
n = nCount;
@@ -651,7 +650,7 @@ SalYieldResult WinSalInstance::DoYield(bool bWait, bool bHandleAllCurrentEvents,
n--;
}
}
- return eDidWork;
+ return bDidWork;
}
LRESULT CALLBACK SalComWndProc( HWND, UINT nMsg, WPARAM wParam, LPARAM lParam, int& rDef )
diff --git a/vcl/win/app/saltimer.cxx b/vcl/win/app/saltimer.cxx
index 3c1ff53c90c1..25412dcf6186 100644
--- a/vcl/win/app/saltimer.cxx
+++ b/vcl/win/app/saltimer.cxx
@@ -150,8 +150,8 @@ void EmitTimerCallback()
// try this a short time later again.
if (pSVData->maSchedCtx.mpSalTimer && ImplSalYieldMutexTryToAcquire())
{
- bool const idle = true; // TODO
- pSVData->maSchedCtx.mpSalTimer->CallCallback( idle );
+ pSVData->maSchedCtx.mpSalTimer->CallCallback();
+
ImplSalYieldMutexRelease();
// Run the timer again if it was started before, and also