[Libreoffice-commits] core.git: include/vcl sd/qa vcl/osx vcl/qa vcl/source
Jan-Marek Glogowski (via logerrit)
logerrit at kemper.freedesktop.org
Sun Apr 4 22:31:01 UTC 2021
include/vcl/scheduler.hxx | 11 +++++----
sd/qa/unit/misc-tests.cxx | 4 +--
sd/qa/unit/uiimpress.cxx | 3 --
vcl/osx/salframeview.mm | 2 -
vcl/qa/cppunit/lifecycle.cxx | 43 ------------------------------------
vcl/source/app/salusereventlist.cxx | 2 -
vcl/source/app/scheduler.cxx | 14 ++---------
7 files changed, 15 insertions(+), 64 deletions(-)
New commits:
commit 5e53fe7b53017068d183e923f6a77f0afaf31d67
Author: Jan-Marek Glogowski <glogow at fbihome.de>
AuthorDate: Fri Mar 19 15:17:42 2021 +0100
Commit: Jan-Marek Glogowski <glogow at fbihome.de>
CommitDate: Mon Apr 5 00:30:18 2021 +0200
VCL drop Scheduler::ProcessTaskScheduling
Just process tasks (and system events) via DoYield and actually
wake up the system timer on OSX.
This drops the testFocus unit test. There is some comment about
it in README.lifecycle, but the test's CPPUNIT_ASSERT was already
commented and mmeeks suggested to simply drop it.
Even worse: just replacing
- Scheduler::ProcessTaskScheduling();
+ Scheduler::ProcessEventsToIdle();
results in a SIGSEGV in my local Linux build, which is a totally
unrelated crash.
Change-Id: Ie3e2a8668b8501f081706dde0ba3684801c30cc2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112761
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski <glogow at fbihome.de>
diff --git a/include/vcl/scheduler.hxx b/include/vcl/scheduler.hxx
index 7219146cbf39..1b63404139bf 100644
--- a/include/vcl/scheduler.hxx
+++ b/include/vcl/scheduler.hxx
@@ -45,10 +45,13 @@ public:
static void ImplDeInitScheduler();
- /// Process one pending Timer with highest priority
- static void CallbackTaskScheduling();
- /// Process one pending task ahead of time with highest priority.
- static bool ProcessTaskScheduling();
+ /**
+ * System timer callback function, which processes one LO task
+ *
+ * Will restart the system timer, so it will process further tasks at the right time.
+ **/
+ static void CallbackTaskScheduling();
+
/**
* Process all events until none is pending
*
diff --git a/sd/qa/unit/misc-tests.cxx b/sd/qa/unit/misc-tests.cxx
index 6afebe7edc0f..6329ca3a602c 100644
--- a/sd/qa/unit/misc-tests.cxx
+++ b/sd/qa/unit/misc-tests.cxx
@@ -186,7 +186,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());
+ Scheduler::ProcessEventsToIdle();
if ((pSSVS = sd::slidesorter::SlideSorterViewShell::GetSlideSorter(pViewShell->GetViewShellBase())) != nullptr)
break;
osl::Thread::wait(std::chrono::milliseconds(100));
@@ -231,7 +231,7 @@ void SdMiscTest::testTdf96708()
// Now wait for timers to trigger creation of auto-layout
osl::Thread::wait(std::chrono::milliseconds(100));
- Scheduler::ProcessTaskScheduling();
+ Scheduler::ProcessEventsToIdle();
rSSController.GetClipboard().DoPaste();
const sal_uInt16 nMasterPageCnt2 = xDocSh->GetDoc()->GetMasterSdPageCount(PageKind::Standard);
diff --git a/sd/qa/unit/uiimpress.cxx b/sd/qa/unit/uiimpress.cxx
index f284806edceb..7f9c176ab87e 100644
--- a/sd/qa/unit/uiimpress.cxx
+++ b/sd/qa/unit/uiimpress.cxx
@@ -128,8 +128,7 @@ sd::slidesorter::SlideSorterViewShell* SdUiImpressTest::getSlideSorterViewShell(
for (int i = 0; i < 1000; i++)
{
// Process all Tasks - slide sorter is created here
- while (Scheduler::ProcessTaskScheduling())
- ;
+ Scheduler::ProcessEventsToIdle();
if ((pSSVS = sd::slidesorter::SlideSorterViewShell::GetSlideSorter(
pViewShell->GetViewShellBase()))
!= nullptr)
diff --git a/vcl/osx/salframeview.mm b/vcl/osx/salframeview.mm
index 517998b188ea..cbe7befabf82 100644
--- a/vcl/osx/salframeview.mm
+++ b/vcl/osx/salframeview.mm
@@ -529,7 +529,7 @@ static AquaSalFrame* getMouseContainerFrame()
if (bWasLiveResize != bIsLiveResize)
{
pInstance->mbIsLiveResize = bIsLiveResize;
- Scheduler::ProcessTaskScheduling();
+ Scheduler::Wakeup();
}
AquaSalGraphics* pGraphics = mpFrame->mpGraphics;
diff --git a/vcl/qa/cppunit/lifecycle.cxx b/vcl/qa/cppunit/lifecycle.cxx
index 6cdbbe0819d6..bf1ee3575e62 100644
--- a/vcl/qa/cppunit/lifecycle.cxx
+++ b/vcl/qa/cppunit/lifecycle.cxx
@@ -37,7 +37,6 @@ public:
void testParentedWidgets();
void testChildDispose();
void testPostDispose();
- void testFocus();
void testLeakage();
void testToolkit();
@@ -49,7 +48,6 @@ public:
CPPUNIT_TEST(testParentedWidgets);
CPPUNIT_TEST(testChildDispose);
CPPUNIT_TEST(testPostDispose);
- CPPUNIT_TEST(testFocus);
CPPUNIT_TEST(testLeakage);
CPPUNIT_TEST(testToolkit);
CPPUNIT_TEST_SUITE_END();
@@ -190,47 +188,6 @@ void LifecycleTest::testPostDispose()
namespace {
-class FocusCrashPostDispose : public TabControl
-{
-public:
- explicit FocusCrashPostDispose(vcl::Window *pParent) :
- TabControl(pParent, 0)
- {
- }
- virtual bool PreNotify( NotifyEvent& ) override
- {
- return false;
- }
- virtual bool EventNotify( NotifyEvent& ) override
- {
- return false;
- }
- virtual void GetFocus() override
- {
- CPPUNIT_FAIL("get focus");
- }
- virtual void LoseFocus() override
- {
- CPPUNIT_FAIL("this should never be called");
- }
-};
-
-}
-
-void LifecycleTest::testFocus()
-{
- ScopedVclPtrInstance<WorkWindow> xWin(nullptr, WB_APP|WB_STDWORK);
- ScopedVclPtrInstance< FocusCrashPostDispose > xChild(xWin);
- xWin->Show();
- xChild->GrabFocus();
- // process asynchronous ToTop
- Scheduler::ProcessTaskScheduling();
- // FIXME: really awful to test focus issues without showing windows.
- // CPPUNIT_ASSERT(xChild->HasFocus());
-}
-
-namespace {
-
template <class vcl_type>
class LeakTestClass : public vcl_type
{
diff --git a/vcl/source/app/salusereventlist.cxx b/vcl/source/app/salusereventlist.cxx
index 309e66bafc29..949467ae218c 100644
--- a/vcl/source/app/salusereventlist.cxx
+++ b/vcl/source/app/salusereventlist.cxx
@@ -108,7 +108,7 @@ bool SalUserEventList::DispatchUserEvents( bool bHandleAllCurrentEvents )
* Because otherwise the exception is caught somewhere totally unrelated.
* TODO Ideally we could capture a proper backtrace and feed this into breakpad,
* which is do-able, but requires writing some assembly.
- * See also Scheduler::ProcessTaskScheduling
+ * See also Scheduler::CallbackTaskScheduling
*/
#ifdef IOS
ProcessEvent( aEvent );
diff --git a/vcl/source/app/scheduler.cxx b/vcl/source/app/scheduler.cxx
index ebc08e0f9a84..735792cfc3e2 100644
--- a/vcl/source/app/scheduler.cxx
+++ b/vcl/source/app/scheduler.cxx
@@ -260,12 +260,6 @@ void Scheduler::ImplStartTimer(sal_uInt64 nMS, bool bForce, sal_uInt64 nTime)
}
}
-void Scheduler::CallbackTaskScheduling()
-{
- // this function is for the saltimer callback
- Scheduler::ProcessTaskScheduling();
-}
-
static bool g_bDeterministicMode = false;
void Scheduler::SetDeterministicMode(bool bDeterministic)
@@ -333,7 +327,7 @@ static ImplSchedulerData* DropSchedulerData(
return pSchedulerDataNext;
}
-bool Scheduler::ProcessTaskScheduling()
+void Scheduler::CallbackTaskScheduling()
{
ImplSVData *pSVData = ImplGetSVData();
ImplSchedulerContext &rSchedCtx = pSVData->maSchedCtx;
@@ -342,7 +336,7 @@ bool Scheduler::ProcessTaskScheduling()
SchedulerGuard aSchedulerGuard;
if ( !rSchedCtx.mbActive || InfiniteTimeoutMs == rSchedCtx.mnTimerPeriod )
- return false;
+ return;
sal_uInt64 nTime = tools::Time::GetSystemTicks();
// Allow for decimals, so subtract in the compare (needed at least on iOS)
@@ -350,7 +344,7 @@ bool Scheduler::ProcessTaskScheduling()
{
int nSleep = rSchedCtx.mnTimerStart + rSchedCtx.mnTimerPeriod - nTime;
UpdateSystemTimer(rSchedCtx, nSleep, true, nTime);
- return false;
+ return;
}
ImplSchedulerData* pSchedulerData = nullptr;
@@ -531,8 +525,6 @@ bool Scheduler::ProcessTaskScheduling()
UpdateSystemTimer( rSchedCtx, nMinPeriod, false, nTime );
}
}
-
- return !!pMostUrgent;
}
void Scheduler::Wakeup()
More information about the Libreoffice-commits
mailing list