WebKit Bugzilla
Attachment 349114 Details for
Bug 189335
: [RunLoopGeneric] OneShotTimer should not remain "isActive" after fired
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-189335-20180907143728.patch (text/plain), 4.19 KB, created by
Yoshiaki Jitsukawa
on 2018-09-06 22:38:04 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Yoshiaki Jitsukawa
Created:
2018-09-06 22:38:04 PDT
Size:
4.19 KB
patch
obsolete
>Subversion Revision: 235778 >diff --git a/Source/WTF/ChangeLog b/Source/WTF/ChangeLog >index b4983ab31a07b899738ac71f355ddf14986a0018..d4b6186b0091ecadaaffc99ccc34f904d54d474c 100644 >--- a/Source/WTF/ChangeLog >+++ b/Source/WTF/ChangeLog >@@ -1,3 +1,16 @@ >+2018-09-06 Yoshiaki Jitsukawa <yoshiaki.jitsukawa@sony.com> >+ >+ [RunLoopGeneric] OneShotTimer should be inactive when fired. >+ https://bugs.webkit.org/show_bug.cgi?id=189335 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * wtf/generic/RunLoopGeneric.cpp: >+ (WTF::RunLoop::TimerBase::ScheduledTask::fired): >+ (WTF::RunLoop::TimerBase::isActive const): >+ >+ Deactivate one-shot timer before invoking its callback. >+ > 2018-09-05 Brent Fulgham <bfulgham@apple.com> > > The width of an empty or nullptr TextRun should be zero >diff --git a/Source/WTF/wtf/generic/RunLoopGeneric.cpp b/Source/WTF/wtf/generic/RunLoopGeneric.cpp >index 7869199798c55d821463d5efc180651d1a10d146..b45b1b95bdf3a955f495e120b41a0f8256b1fe7a 100644 >--- a/Source/WTF/wtf/generic/RunLoopGeneric.cpp >+++ b/Source/WTF/wtf/generic/RunLoopGeneric.cpp >@@ -50,12 +50,13 @@ public: > if (!isActive()) > return false; > >- m_function(); >- > if (!m_isRepeating) >- return false; >+ deactivate(); > >- updateReadyTime(); >+ m_function(); >+ >+ if (isActive()) >+ updateReadyTime(); > return isActive(); > } > >@@ -290,7 +291,7 @@ bool RunLoop::TimerBase::isActive() const > > bool RunLoop::TimerBase::isActive(const AbstractLocker&) const > { >- return m_scheduledTask; >+ return m_scheduledTask && m_scheduledTask->isActive(); > } > > Seconds RunLoop::TimerBase::secondsUntilFire() const >diff --git a/Tools/ChangeLog b/Tools/ChangeLog >index 051a402d080716e6b9de3aadddf5cc4f83d12426..7898134c422639c1027fdf9c41f031760d9ac658 100644 >--- a/Tools/ChangeLog >+++ b/Tools/ChangeLog >@@ -1,3 +1,18 @@ >+2018-09-06 Yoshiaki Jitsukawa <yoshiaki.jitsukawa@sony.com> >+ >+ [RunLoopGeneric] OneShotTimer should be inactive when fired. >+ https://bugs.webkit.org/show_bug.cgi?id=189335 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * TestWebKitAPI/Tests/WTF/RunLoop.cpp: >+ (TestWebKitAPI::TEST): >+ >+ Add test expectations about timer's active state. >+ >+ Add a new test to restart a one-shot timer within >+ its fired callback. >+ > 2018-09-06 Zalan Bujtas <zalan@apple.com> > > [LFC] Add support for min/max-height percentage values. >diff --git a/Tools/TestWebKitAPI/Tests/WTF/RunLoop.cpp b/Tools/TestWebKitAPI/Tests/WTF/RunLoop.cpp >index 93b3d8c28f3208176cd3bc52b7f9e3d614a07917..33c69ffaea26b536f68b6e965b39e3b1434b1e7a 100644 >--- a/Tools/TestWebKitAPI/Tests/WTF/RunLoop.cpp >+++ b/Tools/TestWebKitAPI/Tests/WTF/RunLoop.cpp >@@ -85,6 +85,7 @@ TEST(WTF_RunLoop, OneShotTimer) > > void fired() > { >+ EXPECT_FALSE(isActive()); > m_testFinished = true; > stop(); > } >@@ -100,6 +101,44 @@ TEST(WTF_RunLoop, OneShotTimer) > } > } > >+TEST(WTF_RunLoop, ChainingOneShotTimer) >+{ >+ RunLoop::initializeMainRunLoop(); >+ >+ bool testFinished = false; >+ >+ class DerivedTimer : public RunLoop::Timer<DerivedTimer> { >+ public: >+ DerivedTimer(bool& testFinished) >+ : RunLoop::Timer<DerivedTimer>(RunLoop::current(), this, &DerivedTimer::fired) >+ , m_testFinished(testFinished) >+ { >+ } >+ >+ void fired() >+ { >+ EXPECT_FALSE(isActive()); >+ if (++m_count != 2) { >+ startOneShot(100_ms); >+ EXPECT_TRUE(isActive()); >+ } else { >+ m_testFinished = true; >+ stop(); >+ } >+ } >+ >+ private: >+ unsigned m_count { 0 }; >+ bool& m_testFinished; >+ }; >+ >+ { >+ DerivedTimer timer(testFinished); >+ timer.startOneShot(100_ms); >+ Util::run(&testFinished); >+ } >+} >+ > TEST(WTF_RunLoop, RepeatingTimer) > { > RunLoop::initializeMainRunLoop(); >@@ -116,6 +155,7 @@ TEST(WTF_RunLoop, RepeatingTimer) > > void fired() > { >+ EXPECT_TRUE(isActive()); > if (++m_count == 10) { > m_testFinished = true; > stop();
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 189335
:
349004
|
349114
|
349292
|
425179
|
425286