[Libreoffice-commits] core.git: include/vcl vcl/headless vcl/inc vcl/osx vcl/source vcl/unx vcl/win
Michael Meeks
michael.meeks at collabora.com
Tue Nov 24 01:03:01 PST 2015
include/vcl/scheduler.hxx | 4 +++-
vcl/headless/svpinst.cxx | 5 +++--
vcl/inc/headless/svpinst.hxx | 2 +-
vcl/inc/osx/salinst.h | 2 +-
vcl/inc/salinst.hxx | 4 +++-
vcl/inc/unx/gtk/gtkdata.hxx | 2 +-
vcl/inc/unx/gtk/gtkinst.hxx | 2 +-
vcl/inc/unx/saldisp.hxx | 2 +-
vcl/inc/unx/salinst.h | 2 +-
vcl/inc/win/salinst.h | 2 +-
vcl/osx/salinst.cxx | 6 +++---
vcl/source/app/scheduler.cxx | 4 ++--
vcl/source/app/timer.cxx | 3 +--
vcl/unx/generic/app/saldata.cxx | 10 ++++++----
vcl/unx/generic/app/salinst.cxx | 2 +-
vcl/unx/gtk/gtkdata.cxx | 7 ++++---
vcl/unx/gtk/gtkinst.cxx | 2 +-
vcl/win/source/app/salinst.cxx | 14 ++++++++------
18 files changed, 42 insertions(+), 33 deletions(-)
New commits:
commit 4bd8ffd27f17ec4915790a260087ef1890169911
Author: Michael Meeks <michael.meeks at collabora.com>
Date: Mon Nov 23 21:44:36 2015 +0000
Replace return boolean from DoYield with pleasant enumeration.
Change-Id: I1b1f885b4d7916a18dfb2457a8e9af9a5b4ae6e4
Reviewed-on: https://gerrit.libreoffice.org/20138
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Michael Meeks <michael.meeks at collabora.com>
diff --git a/include/vcl/scheduler.hxx b/include/vcl/scheduler.hxx
index d88115b..d1d8d83 100644
--- a/include/vcl/scheduler.hxx
+++ b/include/vcl/scheduler.hxx
@@ -94,8 +94,10 @@ public:
// Process one pending Timer with highhest priority
static void CallbackTaskScheduling( bool ignore );
+ /// Calculate minimum timeout - and return its value.
+ static sal_uInt64 CalculateMinimumTimeout();
/// Process one pending task ahead of time with highhest priority.
- static void ProcessTaskScheduling( bool bTimer );
+ static void ProcessTaskScheduling( bool bTimer );
};
#endif // INCLUDED_VCL_SCHEDULER_HXX
diff --git a/vcl/headless/svpinst.cxx b/vcl/headless/svpinst.cxx
index ec7039a..0d765c1 100644
--- a/vcl/headless/svpinst.cxx
+++ b/vcl/headless/svpinst.cxx
@@ -261,7 +261,7 @@ SalBitmap* SvpSalInstance::CreateSalBitmap()
#endif
}
-bool SvpSalInstance::DoYield(bool bWait, bool bHandleAllCurrentEvents, sal_uLong const nReleased)
+SalYieldResult SvpSalInstance::DoYield(bool bWait, bool bHandleAllCurrentEvents, sal_uLong const nReleased)
{
(void) nReleased;
assert(nReleased == 0); // not implemented
@@ -329,7 +329,8 @@ bool SvpSalInstance::DoYield(bool bWait, bool bHandleAllCurrentEvents, sal_uLong
DoReleaseYield(nTimeoutMS);
}
- return bEvent;
+ return bEvent ? SalYieldResult::EVENT :
+ SalYieldResult::TIMEOUT;
}
void SvpSalInstance::DoReleaseYield( int nTimeoutMS )
diff --git a/vcl/inc/headless/svpinst.hxx b/vcl/inc/headless/svpinst.hxx
index 779a65f..2d2716e 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 bool DoYield(bool bWait, bool bHandleAllCurrentEvents, sal_uLong nReleased) override;
+ virtual SalYieldResult DoYield(bool bWait, bool bHandleAllCurrentEvents, sal_uLong nReleased) override;
virtual bool AnyInput( VclInputFlags nType ) override;
// may return NULL to disable session management
diff --git a/vcl/inc/osx/salinst.h b/vcl/inc/osx/salinst.h
index 151da02..5c65241 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 bool DoYield(bool bWait, bool bHandleAllCurrentEvents,
+ virtual SalYieldResult 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 6ed84b9..b20448f 100644
--- a/vcl/inc/salinst.hxx
+++ b/vcl/inc/salinst.hxx
@@ -60,6 +60,8 @@ class Menu;
enum class VclInputFlags;
enum class SalFrameStyleFlags;
+enum SalYieldResult { EVENT, TIMEOUT };
+
class VCL_PLUGIN_PUBLIC SalInstance
{
private:
@@ -132,7 +134,7 @@ public:
* If @bHandleAllCurrentEvents - dispatch multiple posted
* user events. Returns true if events needed processing.
*/
- virtual bool DoYield(bool bWait, bool bHandleAllCurrentEvents, sal_uLong nReleased) = 0;
+ virtual SalYieldResult DoYield(bool bWait, bool bHandleAllCurrentEvents, sal_uLong nReleased) = 0;
virtual bool AnyInput( VclInputFlags nType ) = 0;
// menus
diff --git a/vcl/inc/unx/gtk/gtkdata.hxx b/vcl/inc/unx/gtk/gtkdata.hxx
index aa513ce..082aa62 100644
--- a/vcl/inc/unx/gtk/gtkdata.hxx
+++ b/vcl/inc/unx/gtk/gtkdata.hxx
@@ -115,7 +115,7 @@ public:
static gboolean userEventFn( gpointer data );
void PostUserEvent();
- bool Yield( bool bWait, bool bHandleAllCurrentEvents );
+ SalYieldResult Yield( bool bWait, bool bHandleAllCurrentEvents );
inline GdkDisplay *GetGdkDisplay();
virtual void ErrorTrapPush() override;
diff --git a/vcl/inc/unx/gtk/gtkinst.hxx b/vcl/inc/unx/gtk/gtkinst.hxx
index 3dd8f0d..002b654 100644
--- a/vcl/inc/unx/gtk/gtkinst.hxx
+++ b/vcl/inc/unx/gtk/gtkinst.hxx
@@ -80,7 +80,7 @@ public:
const SystemGraphicsData* ) override;
virtual SalBitmap* CreateSalBitmap() override;
- virtual bool DoYield(bool bWait, bool bHandleAllCurrentEvents, sal_uLong nReleased) override;
+ virtual SalYieldResult DoYield(bool bWait, bool bHandleAllCurrentEvents, sal_uLong nReleased) override;
virtual bool AnyInput( VclInputFlags nType ) override;
virtual GenPspGraphics *CreatePrintGraphics() override;
diff --git a/vcl/inc/unx/saldisp.hxx b/vcl/inc/unx/saldisp.hxx
index e6c2a0f..58ac8d0 100644
--- a/vcl/inc/unx/saldisp.hxx
+++ b/vcl/inc/unx/saldisp.hxx
@@ -153,7 +153,7 @@ public:
virtual ~SalXLib();
virtual void Init();
- virtual bool Yield( bool bWait, bool bHandleAllCurrentEvents );
+ virtual SalYieldResult 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 5ccb9a1..54119d4 100644
--- a/vcl/inc/unx/salinst.h
+++ b/vcl/inc/unx/salinst.h
@@ -71,7 +71,7 @@ public:
virtual SalBitmap* CreateSalBitmap() override;
virtual SalSession* CreateSalSession() override;
- virtual bool DoYield(bool bWait, bool bHandleAllCurrentEvents, sal_uLong nReleased) override;
+ virtual SalYieldResult DoYield(bool bWait, bool bHandleAllCurrentEvents, sal_uLong nReleased) override;
virtual bool AnyInput( VclInputFlags nType ) override;
virtual void* GetConnectionIdentifier( ConnectionIdentifierType& rReturnedType, int& rReturnedBytes ) override;
diff --git a/vcl/inc/win/salinst.h b/vcl/inc/win/salinst.h
index c50aaa5..b6408ea 100644
--- a/vcl/inc/win/salinst.h
+++ b/vcl/inc/win/salinst.h
@@ -72,7 +72,7 @@ public:
virtual void AcquireYieldMutex( sal_uIntPtr nCount ) override;
virtual bool CheckYieldMutex() override;
- virtual bool DoYield(bool bWait, bool bHandleAllCurrentEvents, sal_uLong nReleased) override;
+ virtual SalYieldResult 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 f2afec8..8cdce3f 100644
--- a/vcl/osx/salinst.cxx
+++ b/vcl/osx/salinst.cxx
@@ -559,7 +559,7 @@ class ReleasePoolHolder
~ReleasePoolHolder() { [mpPool release]; }
};
-bool AquaSalInstance::DoYield(bool bWait, bool bHandleAllCurrentEvents, sal_uLong const nReleased)
+SalYieldResult AquaSalInstance::DoYield(bool bWait, bool bHandleAllCurrentEvents, sal_uLong const nReleased)
{
(void) nReleased;
assert(nReleased == 0); // not implemented
@@ -600,7 +600,7 @@ bool AquaSalInstance::DoYield(bool bWait, bool bHandleAllCurrentEvents, sal_uLon
osl_setCondition( maWaitingYieldCond );
// return if only one event is asked for
if( ! bHandleAllCurrentEvents )
- return true;
+ return SalYieldResult::EVENT;
}
}
@@ -711,7 +711,7 @@ bool AquaSalInstance::DoYield(bool bWait, bool bHandleAllCurrentEvents, sal_uLon
}
}
- return bHadEvent;
+ return bHadEvent ? SalYieldResult::EVENT : SalYieldResult::TIMEOUT;
}
bool AquaSalInstance::AnyInput( VclInputFlags nType )
diff --git a/vcl/source/app/scheduler.cxx b/vcl/source/app/scheduler.cxx
index 6092f1d..138fbcd 100644
--- a/vcl/source/app/scheduler.cxx
+++ b/vcl/source/app/scheduler.cxx
@@ -41,7 +41,7 @@ void ImplSchedulerData::Invoke()
mbInScheduler = false;
}
-ImplSchedulerData *ImplSchedulerData::GetMostImportantTask( bool bTimer )
+ImplSchedulerData *ImplSchedulerData::GetMostImportantTask( bool bTimerOnly )
{
ImplSVData* pSVData = ImplGetSVData();
ImplSchedulerData *pMostUrgent = nullptr;
@@ -49,7 +49,7 @@ ImplSchedulerData *ImplSchedulerData::GetMostImportantTask( bool bTimer )
for ( ImplSchedulerData *pSchedulerData = pSVData->mpFirstSchedulerData; pSchedulerData; pSchedulerData = pSchedulerData->mpNext )
{
if ( !pSchedulerData->mpScheduler || pSchedulerData->mbDelete || pSchedulerData->mnUpdateStack >= pSVData->mnUpdateStack
- || !pSchedulerData->mpScheduler->ReadyForSchedule( bTimer ) || !pSchedulerData->mpScheduler->IsActive())
+ || !pSchedulerData->mpScheduler->ReadyForSchedule( bTimerOnly ) || !pSchedulerData->mpScheduler->IsActive())
continue;
if (!pMostUrgent)
pMostUrgent = pSchedulerData;
diff --git a/vcl/source/app/timer.cxx b/vcl/source/app/timer.cxx
index b048504..de7c52b 100644
--- a/vcl/source/app/timer.cxx
+++ b/vcl/source/app/timer.cxx
@@ -30,9 +30,8 @@ void Timer::SetDeletionFlags()
}
}
-bool Timer::ReadyForSchedule( bool bTimer ) const
+bool Timer::ReadyForSchedule( bool /* bTimerOnly */ ) const
{
- (void)bTimer;
return (mpSchedulerData->mnUpdateTime + mnTimeout) <= tools::Time::GetSystemTicks();
}
diff --git a/vcl/unx/generic/app/saldata.cxx b/vcl/unx/generic/app/saldata.cxx
index ceee7fc..3f9d184 100644
--- a/vcl/unx/generic/app/saldata.cxx
+++ b/vcl/unx/generic/app/saldata.cxx
@@ -606,7 +606,8 @@ bool SalXLib::CheckTimeout( bool bExecuteTimers )
return bRet;
}
-bool SalXLib::Yield( bool bWait, bool bHandleAllCurrentEvents )
+SalYieldResult
+SalXLib::Yield( bool bWait, bool bHandleAllCurrentEvents )
{
blockIdleTimeout = !bWait;
// check for timeouts here if you want to make screenshots
@@ -629,7 +630,7 @@ bool SalXLib::Yield( bool bWait, bool bHandleAllCurrentEvents )
if( ! bHandleAllCurrentEvents )
{
blockIdleTimeout = false;
- return true;
+ return SalYieldResult::EVENT;
}
}
}
@@ -706,7 +707,7 @@ bool SalXLib::Yield( bool bWait, bool bHandleAllCurrentEvents )
if (nFound == 0)
{
blockIdleTimeout = false;
- return false;
+ return SalYieldResult::TIMEOUT;
}
for ( int nFD = 0; nFD < nFDs_; nFD++ )
@@ -736,7 +737,8 @@ bool SalXLib::Yield( bool bWait, bool bHandleAllCurrentEvents )
}
blockIdleTimeout = false;
- return bHandledEvent;
+ return bHandledEvent ? SalYieldResult::EVENT
+ : SalYieldResult::TIMEOUT;
}
void SalXLib::Wakeup()
diff --git a/vcl/unx/generic/app/salinst.cxx b/vcl/unx/generic/app/salinst.cxx
index 457fc52..af3f95c 100644
--- a/vcl/unx/generic/app/salinst.cxx
+++ b/vcl/unx/generic/app/salinst.cxx
@@ -151,7 +151,7 @@ bool X11SalInstance::AnyInput(VclInputFlags nType)
return bRet;
}
-bool X11SalInstance::DoYield(bool bWait, bool bHandleAllCurrentEvents, sal_uLong const nReleased)
+SalYieldResult 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 02ad2b8..d25b036 100644
--- a/vcl/unx/gtk/gtkdata.cxx
+++ b/vcl/unx/gtk/gtkdata.cxx
@@ -579,7 +579,7 @@ void GtkData::Dispose()
}
/// Allows events to be processed, returns true if we processed an event.
-bool GtkData::Yield( bool bWait, bool bHandleAllCurrentEvents )
+SalYieldResult GtkData::Yield( bool bWait, bool bHandleAllCurrentEvents )
{
blockIdleTimeout = !bWait;
@@ -598,7 +598,7 @@ bool GtkData::Yield( bool bWait, bool bHandleAllCurrentEvents )
else if( ! bWait )
{
blockIdleTimeout = false;
- return false; // someone else is waiting already, return
+ return SalYieldResult::TIMEOUT; // someone else is waiting already, return
}
if( bDispatchThread )
@@ -633,7 +633,8 @@ bool GtkData::Yield( bool bWait, bool bHandleAllCurrentEvents )
}
blockIdleTimeout = false;
- return bWasEvent;
+ return bWasEvent ? SalYieldResult::EVENT
+ : SalYieldResult::TIMEOUT;
}
void GtkData::Init()
diff --git a/vcl/unx/gtk/gtkinst.cxx b/vcl/unx/gtk/gtkinst.cxx
index ec13855..f7da84f 100644
--- a/vcl/unx/gtk/gtkinst.cxx
+++ b/vcl/unx/gtk/gtkinst.cxx
@@ -396,7 +396,7 @@ void GtkInstance::RemoveTimer (SalTimer *pTimer)
m_aTimers.erase( it );
}
-bool GtkInstance::DoYield(bool bWait, bool bHandleAllCurrentEvents, sal_uLong const nReleased)
+SalYieldResult GtkInstance::DoYield(bool bWait, bool bHandleAllCurrentEvents, sal_uLong const nReleased)
{
(void) nReleased;
assert(nReleased == 0); // not implemented
diff --git a/vcl/win/source/app/salinst.cxx b/vcl/win/source/app/salinst.cxx
index fcb5a15..5cf6c3d 100644
--- a/vcl/win/source/app/salinst.cxx
+++ b/vcl/win/source/app/salinst.cxx
@@ -621,7 +621,8 @@ static void ImplSalDispatchMessage( MSG* pMsg )
ImplSalPostDispatchMsg( pMsg, lResult );
}
-bool ImplSalYield( bool bWait, bool bHandleAllCurrentEvents )
+SalYieldResult
+ImplSalYield( bool bWait, bool bHandleAllCurrentEvents )
{
MSG aMsg;
bool bWasMsg = false, bOneEvent = false;
@@ -648,12 +649,13 @@ bool ImplSalYield( bool bWait, bool bHandleAllCurrentEvents )
ImplSalDispatchMessage( &aMsg );
}
}
- return bWasMsg;
+ return bWasMsg ? SalYieldResult::EVENT :
+ SalYieldResult::TIMEOUT;
}
-bool WinSalInstance::DoYield(bool bWait, bool bHandleAllCurrentEvents, sal_uLong const nReleased)
+SalYieldResult WinSalInstance::DoYield(bool bWait, bool bHandleAllCurrentEvents, sal_uLong const nReleased)
{
- bool bDidWork = false;
+ SalYieldResult eDidWork = SalYieldResult::TIMEOUT;
// NOTE: if nReleased != 0 this will be called without SolarMutex
// so don't do anything dangerous before releasing it here
SalYieldMutex* pYieldMutex = mpSalYieldMutex;
@@ -694,7 +696,7 @@ bool WinSalInstance::DoYield(bool bWait, bool bHandleAllCurrentEvents, sal_uLong
}
else
{
- bDidWork = ImplSalYield( bWait, bHandleAllCurrentEvents );
+ eDidWork = ImplSalYield( bWait, bHandleAllCurrentEvents );
n = nCount;
while ( n )
@@ -703,7 +705,7 @@ bool WinSalInstance::DoYield(bool bWait, bool bHandleAllCurrentEvents, sal_uLong
n--;
}
}
- return bDidWork;
+ return eDidWork;
}
LRESULT CALLBACK SalComWndProc( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam, int& rDef )
More information about the Libreoffice-commits
mailing list