Title: [273669] trunk/Source/WebKit
Revision
273669
Author
[email protected]
Date
2021-03-01 11:49:54 -0800 (Mon, 01 Mar 2021)

Log Message

EventDispatcher::wheelEvent is accessing m_scrollingTrees without locking m_scrollingTreesMutex since r271235
https://bugs.webkit.org/show_bug.cgi?id=222529

Reviewed by Carlos Garcia Campos.

r271235 added a code to access m_scrollingTrees, but it didn't
lock m_scrollingTreesMutex. The code can be removed by moving it
into the above lambda _expression_.

EventDispatcher::wheelEvent was using a local lambda _expression_.
However the return value wasn't used. And, MSVC can't compile the
lambda _expression_ because it has a bug that 'this' can't be used
in lambda expressions. Converted the lambda _expression_ to a
do-while statement.

* WebProcess/WebPage/EventDispatcher.cpp:
(WebKit::EventDispatcher::wheelEvent):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (273668 => 273669)


--- trunk/Source/WebKit/ChangeLog	2021-03-01 19:47:48 UTC (rev 273668)
+++ trunk/Source/WebKit/ChangeLog	2021-03-01 19:49:54 UTC (rev 273669)
@@ -1,3 +1,23 @@
+2021-03-01  Fujii Hironori  <[email protected]>
+
+        EventDispatcher::wheelEvent is accessing m_scrollingTrees without locking m_scrollingTreesMutex since r271235
+        https://bugs.webkit.org/show_bug.cgi?id=222529
+
+        Reviewed by Carlos Garcia Campos.
+
+        r271235 added a code to access m_scrollingTrees, but it didn't
+        lock m_scrollingTreesMutex. The code can be removed by moving it
+        into the above lambda _expression_.
+
+        EventDispatcher::wheelEvent was using a local lambda _expression_.
+        However the return value wasn't used. And, MSVC can't compile the
+        lambda _expression_ because it has a bug that 'this' can't be used
+        in lambda expressions. Converted the lambda _expression_ to a
+        do-while statement.
+
+        * WebProcess/WebPage/EventDispatcher.cpp:
+        (WebKit::EventDispatcher::wheelEvent):
+
 2021-02-25  Simon Fraser  <[email protected]>
 
         Remove ENABLE_WEBPROCESS_WINDOWSERVER_BLOCKING which is always true for macOS

Modified: trunk/Source/WebKit/WebProcess/WebPage/EventDispatcher.cpp (273668 => 273669)


--- trunk/Source/WebKit/WebProcess/WebPage/EventDispatcher.cpp	2021-03-01 19:47:48 UTC (rev 273668)
+++ trunk/Source/WebKit/WebProcess/WebPage/EventDispatcher.cpp	2021-03-01 19:49:54 UTC (rev 273669)
@@ -122,12 +122,14 @@
 
     auto processingSteps = OptionSet<WebCore::WheelEventProcessingSteps> { WheelEventProcessingSteps::MainThreadForScrolling, WheelEventProcessingSteps::MainThreadForBlockingDOMEventDispatch };
 #if ENABLE(SCROLLING_THREAD)
-    processingSteps = [&]() -> OptionSet<WheelEventProcessingSteps> {
+    do {
         LockHolder locker(m_scrollingTreesMutex);
 
         auto scrollingTree = m_scrollingTrees.get(pageID);
-        if (!scrollingTree)
-            return { WheelEventProcessingSteps::MainThreadForScrolling, WheelEventProcessingSteps::MainThreadForBlockingDOMEventDispatch };
+        if (!scrollingTree) {
+            dispatchWheelEventViaMainThread(pageID, wheelEvent, processingSteps);
+            break;
+        }
         
         // FIXME: It's pretty horrible that we're updating the back/forward state here.
         // WebCore should always know the current state and know when it changes so the
@@ -160,13 +162,7 @@
             // respond to the UI process that the event was handled.
             protectedThis->sendDidReceiveEvent(pageID, wheelEvent.type(), result.wasHandled);
         });
-
-        return processingSteps;
-    }();
-
-    auto scrollingTree = m_scrollingTrees.get(pageID);
-    if (!scrollingTree)
-        dispatchWheelEventViaMainThread(pageID, wheelEvent, processingSteps);
+    } while (false);
 #else
     UNUSED_PARAM(canRubberBandAtLeft);
     UNUSED_PARAM(canRubberBandAtRight);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to