Title: [240841] trunk/Source/WebCore
- Revision
- 240841
- Author
- csaave...@igalia.com
- Date
- 2019-02-01 02:32:55 -0800 (Fri, 01 Feb 2019)
Log Message
Race-condition during scrolling thread creation
https://bugs.webkit.org/show_bug.cgi?id=194016
Reviewed by Saam Barati.
There is a threading issue during the initialization
of the scrolling thread caused by createThreadIfNeeded
locking only on the creation of the thread but not on
the initialization of the main loop, making it possible
for a thread to try to spin the main loop before it's
created.
Fix this by unconditionally waiting on the main loop
being created. This makes it necessary to always hold
the lock, even when the thread is already created.
* page/scrolling/ScrollingThread.cpp:
(WebCore::ScrollingThread::createThreadIfNeeded):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (240840 => 240841)
--- trunk/Source/WebCore/ChangeLog 2019-02-01 10:03:31 UTC (rev 240840)
+++ trunk/Source/WebCore/ChangeLog 2019-02-01 10:32:55 UTC (rev 240841)
@@ -1,3 +1,24 @@
+2019-02-01 Claudio Saavedra <csaave...@igalia.com>
+
+ Race-condition during scrolling thread creation
+ https://bugs.webkit.org/show_bug.cgi?id=194016
+
+ Reviewed by Saam Barati.
+
+ There is a threading issue during the initialization
+ of the scrolling thread caused by createThreadIfNeeded
+ locking only on the creation of the thread but not on
+ the initialization of the main loop, making it possible
+ for a thread to try to spin the main loop before it's
+ created.
+
+ Fix this by unconditionally waiting on the main loop
+ being created. This makes it necessary to always hold
+ the lock, even when the thread is already created.
+
+ * page/scrolling/ScrollingThread.cpp:
+ (WebCore::ScrollingThread::createThreadIfNeeded):
+
2019-02-01 Simon Fraser <simon.fra...@apple.com>
Use ScrollingNodeID in more places, and improve the name of a ScrollableArea function that returns a ScrollingNodeID
Modified: trunk/Source/WebCore/page/scrolling/ScrollingThread.cpp (240840 => 240841)
--- trunk/Source/WebCore/page/scrolling/ScrollingThread.cpp 2019-02-01 10:03:31 UTC (rev 240840)
+++ trunk/Source/WebCore/page/scrolling/ScrollingThread.cpp 2019-02-01 10:32:55 UTC (rev 240841)
@@ -72,24 +72,21 @@
void ScrollingThread::createThreadIfNeeded()
{
- if (m_thread)
- return;
-
// Wait for the thread to initialize the run loop.
- {
- std::unique_lock<Lock> lock(m_initializeRunLoopMutex);
+ std::unique_lock<Lock> lock(m_initializeRunLoopMutex);
+ if (!m_thread) {
m_thread = Thread::create("WebCore: Scrolling", [this] {
WTF::Thread::setCurrentThreadIsUserInteractive();
initializeRunLoop();
});
-
+ }
+
#if PLATFORM(COCOA)
- m_initializeRunLoopConditionVariable.wait(lock, [this]{ return m_threadRunLoop; });
+ m_initializeRunLoopConditionVariable.wait(lock, [this]{ return m_threadRunLoop; });
#else
- m_initializeRunLoopConditionVariable.wait(lock, [this]{ return m_runLoop; });
+ m_initializeRunLoopConditionVariable.wait(lock, [this]{ return m_runLoop; });
#endif
- }
}
void ScrollingThread::dispatchFunctionsFromScrollingThread()
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes