Title: [295600] trunk/Source/WebKit/UIProcess/WebProcessPool.cpp
Revision
295600
Author
pvol...@apple.com
Date
2022-06-16 11:08:23 -0700 (Thu, 16 Jun 2022)

Log Message

Handle display reconfiguration on main thread
https://bugs.webkit.org/show_bug.cgi?id=241683
<rdar://83417447>

Reviewed by Simon Fraser.

It is not safe to handle this on a non main thread, since we send messages to the WebContent and GPU process.

* Source/WebKit/UIProcess/WebProcessPool.cpp:
(WebKit::displayReconfigurationCallBack):

Canonical link: https://commits.webkit.org/251605@main

Modified Paths

Diff

Modified: trunk/Source/WebKit/UIProcess/WebProcessPool.cpp (295599 => 295600)


--- trunk/Source/WebKit/UIProcess/WebProcessPool.cpp	2022-06-16 18:06:45 UTC (rev 295599)
+++ trunk/Source/WebKit/UIProcess/WebProcessPool.cpp	2022-06-16 18:08:23 UTC (rev 295600)
@@ -682,15 +682,17 @@
 #if PLATFORM(MAC)
 static void displayReconfigurationCallBack(CGDirectDisplayID display, CGDisplayChangeSummaryFlags flags, void *userInfo)
 {
-    auto screenProperties = WebCore::collectScreenProperties();
-    for (auto& processPool : WebProcessPool::allProcessPools()) {
-        processPool->sendToAllProcesses(Messages::WebProcess::SetScreenProperties(screenProperties));
-        processPool->sendToAllProcesses(Messages::WebProcess::DisplayConfigurationChanged(display, flags));
-        if (auto gpuProcess = processPool->gpuProcess()) {
-            gpuProcess->displayConfigurationChanged(display, flags);
-            gpuProcess->setScreenProperties(screenProperties);
+    RunLoop::main().dispatch([display, flags]() {
+        auto screenProperties = WebCore::collectScreenProperties();
+        for (auto& processPool : WebProcessPool::allProcessPools()) {
+            processPool->sendToAllProcesses(Messages::WebProcess::SetScreenProperties(screenProperties));
+            processPool->sendToAllProcesses(Messages::WebProcess::DisplayConfigurationChanged(display, flags));
+            if (auto gpuProcess = processPool->gpuProcess()) {
+                gpuProcess->displayConfigurationChanged(display, flags);
+                gpuProcess->setScreenProperties(screenProperties);
+            }
         }
-    }
+    });
 }
 
 static void registerDisplayConfigurationCallback()
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to