Title: [264017] trunk/Tools
Revision
264017
Author
[email protected]
Date
2020-07-07 08:07:52 -0700 (Tue, 07 Jul 2020)

Log Message

Added a test for callOnMainThread
https://bugs.webkit.org/show_bug.cgi?id=214025

Reviewed by Sam Weinig.

This test failed prior to https://trac.webkit.org/changeset/263981.

* TestWebKitAPI/Tests/WTF/RunLoop.cpp:
(TestWebKitAPI::TEST): Added a test demonstrating why a simple "is the
queue empty?" check doesn't work when you support both re-entrancy and
threads. While the main thread is sleeping in a nested RunLoop, a
secondary thread can see a non-empty queue.

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (264016 => 264017)


--- trunk/Tools/ChangeLog	2020-07-07 13:57:38 UTC (rev 264016)
+++ trunk/Tools/ChangeLog	2020-07-07 15:07:52 UTC (rev 264017)
@@ -1,3 +1,18 @@
+2020-07-07  Geoffrey Garen  <[email protected]>
+
+        Added a test for callOnMainThread
+        https://bugs.webkit.org/show_bug.cgi?id=214025
+
+        Reviewed by Sam Weinig.
+
+        This test failed prior to https://trac.webkit.org/changeset/263981.
+
+        * TestWebKitAPI/Tests/WTF/RunLoop.cpp:
+        (TestWebKitAPI::TEST): Added a test demonstrating why a simple "is the
+        queue empty?" check doesn't work when you support both re-entrancy and
+        threads. While the main thread is sleeping in a nested RunLoop, a
+        secondary thread can see a non-empty queue.
+
 2020-07-07  Philippe Normand  <[email protected]>
 
         [GStreamer] OGV/VP8 video not playing on minibrowser (neither epiphany)

Modified: trunk/Tools/TestWebKitAPI/Tests/WTF/RunLoop.cpp (264016 => 264017)


--- trunk/Tools/TestWebKitAPI/Tests/WTF/RunLoop.cpp	2020-07-07 13:57:38 UTC (rev 264016)
+++ trunk/Tools/TestWebKitAPI/Tests/WTF/RunLoop.cpp	2020-07-07 15:07:52 UTC (rev 264017)
@@ -97,6 +97,26 @@
     Util::run(&done);
 }
 
+TEST(WTF_RunLoop, CallOnMainCrossThreadWhileNested)
+{
+    WTF::initializeMainThread();
+
+    bool done = false;
+
+    callOnMainThread([&done] {
+        Thread::create("CallOnMainCrossThread", [&done] {
+            callOnMainThread([&done] {
+                done = true;
+            });
+        });
+
+        Util::run(&done);
+    });
+    callOnMainThread([] { });
+
+    Util::run(&done);
+}
+
 class DerivedOneShotTimer : public RunLoop::Timer<DerivedOneShotTimer> {
 public:
     DerivedOneShotTimer(bool& testFinished)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to