[Libreoffice-commits] core.git: Branch 'feature/fixes19' - include/sfx2 include/vcl sfx2/source vcl/source
László Németh
laszlo.nemeth at collabora.com
Thu Apr 7 02:41:56 UTC 2016
include/sfx2/bindings.hxx | 6 ++---
include/vcl/idle.hxx | 13 +++++++++++
sfx2/source/control/bindings.cxx | 45 +++++++++++++++++++++++----------------
vcl/source/app/idle.cxx | 28 ++++++++++++++++++++++++
4 files changed, 71 insertions(+), 21 deletions(-)
New commits:
commit 0f60b62d972cfdebd6fcfc2ba8f0b6d94347967d
Author: László Németh <laszlo.nemeth at collabora.com>
Date: Thu Apr 7 04:39:19 2016 +0200
Revert "Revert "process SfxBindings in idle""
This reverts commit 13e2133199a0fcfca79a21fa8be475d446b685d0.
diff --git a/include/sfx2/bindings.hxx b/include/sfx2/bindings.hxx
index bbe5cc4..4708ca2 100644
--- a/include/sfx2/bindings.hxx
+++ b/include/sfx2/bindings.hxx
@@ -44,7 +44,7 @@ class SfxItemSet;
class SfxDispatcher;
class SfxBindings;
class SfxBindings_Impl;
-class Timer;
+class Idle;
class SfxWorkWindow;
class SfxUnoControllerItem;
struct SfxFoundCache_Impl;
@@ -131,8 +131,8 @@ private:
const SfxPoolItem *pItem,
SfxItemState eItemState );
SAL_DLLPRIVATE SfxStateCache* GetStateCache( sal_uInt16 nId, sal_uInt16 *pPos);
- DECL_DLLPRIVATE_LINK_TYPED( NextJob, Timer *, void );
- SAL_DLLPRIVATE bool NextJob_Impl(Timer * pTimer);
+ DECL_DLLPRIVATE_LINK_TYPED( NextJob, Idle *, void );
+ SAL_DLLPRIVATE bool NextJob_Impl(Idle * pTimer);
public:
SfxBindings();
diff --git a/include/vcl/idle.hxx b/include/vcl/idle.hxx
index 5460d33..e3e7a99 100644
--- a/include/vcl/idle.hxx
+++ b/include/vcl/idle.hxx
@@ -27,6 +27,7 @@ class VCL_DLLPUBLIC Idle : public Scheduler
{
protected:
Link<Idle *, void> maIdleHdl; // Callback Link
+ bool mbAuto;
public:
Idle( const sal_Char *pDebugName = nullptr );
@@ -39,12 +40,24 @@ public:
void SetIdleHdl( const Link<Idle *, void>& rLink ) { maIdleHdl = rLink; }
const Link<Idle *, void>& GetIdleHdl() const { return maIdleHdl; }
virtual void Invoke() override;
+ virtual void SetDeletionFlags() override;
virtual bool ReadyForSchedule( bool bTimerOnly, sal_uInt64 nTimeNow ) const override;
virtual bool IsIdle() const override;
virtual sal_uInt64 UpdateMinPeriod( sal_uInt64 nMinPeriod, sal_uInt64 nTime ) const override;
Idle& operator=( const Idle& rIdle );
};
+/// An auto-timer is a multi-shot timer re-emitting itself at
+/// interval until destroyed.
+class VCL_DLLPUBLIC AutoIdle : public Idle
+{
+public:
+ AutoIdle();
+ AutoIdle( const AutoIdle& rIdle );
+
+ AutoIdle& operator=( const AutoIdle& rIdle );
+};
+
#endif // INCLUDED_VCL_IDLE_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/source/control/bindings.cxx b/sfx2/source/control/bindings.cxx
index 5d13693..35f9f45 100644
--- a/sfx2/source/control/bindings.cxx
+++ b/sfx2/source/control/bindings.cxx
@@ -71,11 +71,11 @@ using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::util;
-static sal_uInt16 nTimeOut = 300;
+//static sal_uInt16 nTimeOut = 300;
-#define TIMEOUT_FIRST nTimeOut
-#define TIMEOUT_UPDATING 20
-#define TIMEOUT_IDLE 2500
+//#define TIMEOUT_FIRST nTimeOut
+//#define TIMEOUT_UPDATING 20
+//#define TIMEOUT_IDLE 2500
typedef std::unordered_map< sal_uInt16, bool > InvalidateSlotMap;
@@ -218,7 +218,7 @@ public:
bool bAllMsgDirty; // Has a MessageServer been invalidated?
bool bAllDirty; // After InvalidateAll
bool bCtrlReleased; // while EnterRegistrations
- AutoTimer aTimer; // for volatile Slots
+ AutoIdle aTimer; // for volatile Slots
bool bInUpdate; // for Assertions
bool bInNextJob; // for Assertions
bool bFirstRound; // First round in Update
@@ -253,7 +253,7 @@ SfxBindings::SfxBindings()
// all caches are valid (no pending invalidate-job)
// create the list of caches
pImp->pCaches = new SfxStateCacheArr_Impl;
- pImp->aTimer.SetTimeoutHdl( LINK(this, SfxBindings, NextJob) );
+ pImp->aTimer.SetIdleHdl( LINK(this, SfxBindings, NextJob) );
}
@@ -708,7 +708,8 @@ void SfxBindings::InvalidateAll
if ( !nRegLevel )
{
pImp->aTimer.Stop();
- pImp->aTimer.SetTimeout(TIMEOUT_FIRST);
+ //pImp->aTimer.SetTimeout(TIMEOUT_FIRST);
+ pImp->aTimer.SetPriority( SchedulerPriority::LOWER );
pImp->aTimer.Start();
}
}
@@ -760,7 +761,8 @@ void SfxBindings::Invalidate
if ( !nRegLevel )
{
pImp->aTimer.Stop();
- pImp->aTimer.SetTimeout(TIMEOUT_FIRST);
+ //pImp->aTimer.SetTimeout(TIMEOUT_FIRST);
+ pImp->aTimer.SetPriority( SchedulerPriority::LOWER );
pImp->aTimer.Start();
}
}
@@ -814,7 +816,8 @@ void SfxBindings::InvalidateShell
if ( !nRegLevel )
{
pImp->aTimer.Stop();
- pImp->aTimer.SetTimeout(TIMEOUT_FIRST);
+ //pImp->aTimer.SetTimeout(TIMEOUT_FIRST);
+ pImp->aTimer.SetPriority( SchedulerPriority::LOWER );
pImp->aTimer.Start();
pImp->bFirstRound = true;
pImp->nFirstShell = nLevel;
@@ -851,7 +854,8 @@ void SfxBindings::Invalidate
if ( !nRegLevel )
{
pImp->aTimer.Stop();
- pImp->aTimer.SetTimeout(TIMEOUT_FIRST);
+ //pImp->aTimer.SetTimeout(TIMEOUT_FIRST);
+ pImp->aTimer.SetPriority( SchedulerPriority::LOWER );
pImp->aTimer.Start();
}
}
@@ -888,7 +892,8 @@ void SfxBindings::Invalidate
if ( !nRegLevel )
{
pImp->aTimer.Stop();
- pImp->aTimer.SetTimeout(TIMEOUT_FIRST);
+ //pImp->aTimer.SetTimeout(TIMEOUT_FIRST);
+ pImp->aTimer.SetPriority( SchedulerPriority::LOWER );
pImp->aTimer.Start();
}
}
@@ -1547,12 +1552,12 @@ void SfxBindings::UpdateControllers_Impl
}
}
-IMPL_LINK_TYPED( SfxBindings, NextJob, Timer *, pTimer, void )
+IMPL_LINK_TYPED( SfxBindings, NextJob, Idle *, pTimer, void )
{
NextJob_Impl(pTimer);
}
-bool SfxBindings::NextJob_Impl(Timer * pTimer)
+bool SfxBindings::NextJob_Impl(Idle * pTimer)
{
#ifdef DBG_UTIL
// on Windows very often C++ Exceptions (GPF etc.) are caught by MSVCRT
@@ -1566,7 +1571,8 @@ bool SfxBindings::NextJob_Impl(Timer * pTimer)
if ( Application::GetLastInputInterval() < MAX_INPUT_DELAY && pTimer )
{
- pImp->aTimer.SetTimeout(TIMEOUT_UPDATING);
+ //pImp->aTimer.SetTimeout(TIMEOUT_UPDATING);
+ pImp->aTimer.SetPriority( SchedulerPriority::LOW );
return true;
}
@@ -1594,9 +1600,10 @@ bool SfxBindings::NextJob_Impl(Timer * pTimer)
}
pImp->bAllDirty = false;
- pImp->aTimer.SetTimeout(TIMEOUT_UPDATING);
+ //pImp->aTimer.SetTimeout(TIMEOUT_UPDATING);
+ pImp->aTimer.SetPriority( SchedulerPriority::LOW );
- // at least 10 loops and further if more jobs are available but no input
+ // at least .0 loops and further if more jobs are available but no input
bool bPreEmptive = pTimer && !pSfxApp->Get_Impl()->nInReschedule;
sal_uInt16 nLoops = 10;
pImp->bInNextJob = true;
@@ -1656,7 +1663,8 @@ bool SfxBindings::NextJob_Impl(Timer * pTimer)
}
if (bVolatileSlotsPresent)
- pImp->aTimer.SetTimeout(TIMEOUT_IDLE);
+ //pImp->aTimer.SetTimeout(TIMEOUT_IDLE);
+ pImp->aTimer.SetPriority( SchedulerPriority::LOWEST );
else
pImp->aTimer.Stop();
@@ -1774,7 +1782,8 @@ void SfxBindings::LeaveRegistrations( sal_uInt16 nLevel, const char *pFile, int
if ( pImp->pCaches && !pImp->pCaches->empty() )
{
pImp->aTimer.Stop();
- pImp->aTimer.SetTimeout(TIMEOUT_FIRST);
+ //pImp->aTimer.SetTimeout(TIMEOUT_FIRST);
+ pImp->aTimer.SetPriority( SchedulerPriority::LOWER );
pImp->aTimer.Start();
}
}
diff --git a/vcl/source/app/idle.cxx b/vcl/source/app/idle.cxx
index 123f37a..870406f 100644
--- a/vcl/source/app/idle.cxx
+++ b/vcl/source/app/idle.cxx
@@ -20,6 +20,16 @@
#include <vcl/idle.hxx>
#include "saltimer.hxx"
+void Idle::SetDeletionFlags()
+{
+ // If no AutoIdle, then stop.
+ if ( !mbAuto )
+ {
+ mpSchedulerData->mbDelete = true;
+ mbActive = false;
+ }
+}
+
void Idle::Invoke()
{
maIdleHdl.Call( this );
@@ -34,11 +44,13 @@ Idle& Idle::operator=( const Idle& rIdle )
Idle::Idle( const sal_Char *pDebugName ) : Scheduler( pDebugName )
{
+ mbAuto = false;
}
Idle::Idle( const Idle& rIdle ) : Scheduler(rIdle)
{
maIdleHdl = rIdle.maIdleHdl;
+ mbAuto = rIdle.mbAuto;
}
void Idle::Start()
@@ -76,4 +88,20 @@ sal_uInt64 Idle::UpdateMinPeriod( sal_uInt64 nMinPeriod, sal_uInt64 /* nTime */
return nMinPeriod;
}
+AutoIdle::AutoIdle()
+{
+ mbAuto = true;
+}
+
+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: */
More information about the Libreoffice-commits
mailing list