Title: [275937] trunk/Source/WebKit
- Revision
- 275937
- Author
- [email protected]
- Date
- 2021-04-14 01:20:52 -0700 (Wed, 14 Apr 2021)
Log Message
[iOS] WKMouseDeviceObserver is calling WebProcessProxy::send() on a non-main thread
https://bugs.webkit.org/show_bug.cgi?id=224529
<rdar://76598710>
Reviewed by Tim Horton.
Make sure WKMouseDeviceObserver calls WebProcessProxy::notifyHasMouseDeviceChanged() on the main thread
since:
1. It iterates over WebProcessProxy::allProcesses() which is only safe on the main thread
2. It calls WebProcessProxy::send() wich is only safe on the main thread
* UIProcess/WebProcessProxy.h:
* UIProcess/ios/WKMouseDeviceObserver.mm:
(-[WKMouseDeviceObserver mousePointerDevicesDidChange:]):
(-[WKMouseDeviceObserver _setHasMouseDeviceForTesting:]):
* UIProcess/ios/WebProcessProxyIOS.mm:
(WebKit::WebProcessProxy::notifyHasMouseDeviceChanged):
Modified Paths
Diff
Modified: trunk/Source/WebKit/ChangeLog (275936 => 275937)
--- trunk/Source/WebKit/ChangeLog 2021-04-14 07:44:16 UTC (rev 275936)
+++ trunk/Source/WebKit/ChangeLog 2021-04-14 08:20:52 UTC (rev 275937)
@@ -1,3 +1,23 @@
+2021-04-14 Chris Dumez <[email protected]>
+
+ [iOS] WKMouseDeviceObserver is calling WebProcessProxy::send() on a non-main thread
+ https://bugs.webkit.org/show_bug.cgi?id=224529
+ <rdar://76598710>
+
+ Reviewed by Tim Horton.
+
+ Make sure WKMouseDeviceObserver calls WebProcessProxy::notifyHasMouseDeviceChanged() on the main thread
+ since:
+ 1. It iterates over WebProcessProxy::allProcesses() which is only safe on the main thread
+ 2. It calls WebProcessProxy::send() wich is only safe on the main thread
+
+ * UIProcess/WebProcessProxy.h:
+ * UIProcess/ios/WKMouseDeviceObserver.mm:
+ (-[WKMouseDeviceObserver mousePointerDevicesDidChange:]):
+ (-[WKMouseDeviceObserver _setHasMouseDeviceForTesting:]):
+ * UIProcess/ios/WebProcessProxyIOS.mm:
+ (WebKit::WebProcessProxy::notifyHasMouseDeviceChanged):
+
2021-04-14 Miguel Gomez <[email protected]>
[GTK][WPE] Add a property to the WebKitWebView indicating whether the web process is responsive
Modified: trunk/Source/WebKit/UIProcess/WebProcessProxy.h (275936 => 275937)
--- trunk/Source/WebKit/UIProcess/WebProcessProxy.h 2021-04-14 07:44:16 UTC (rev 275936)
+++ trunk/Source/WebKit/UIProcess/WebProcessProxy.h 2021-04-14 08:20:52 UTC (rev 275937)
@@ -217,7 +217,7 @@
static bool fullKeyboardAccessEnabled();
#if HAVE(UIKIT_WITH_MOUSE_SUPPORT) && PLATFORM(IOS)
- static void notifyHasMouseDeviceChanged();
+ static void notifyHasMouseDeviceChanged(bool hasMouseDevice);
#endif
static void notifyHasStylusDeviceChanged(bool hasStylusDevice);
Modified: trunk/Source/WebKit/UIProcess/ios/WKMouseDeviceObserver.mm (275936 => 275937)
--- trunk/Source/WebKit/UIProcess/ios/WKMouseDeviceObserver.mm 2021-04-14 07:44:16 UTC (rev 275936)
+++ trunk/Source/WebKit/UIProcess/ios/WKMouseDeviceObserver.mm 2021-04-14 08:20:52 UTC (rev 275937)
@@ -30,6 +30,7 @@
#import "WebProcessProxy.h"
#import <wtf/BlockPtr.h>
+#import <wtf/MainThread.h>
#import <wtf/OSObjectPtr.h>
#import <wtf/RetainPtr.h>
@@ -106,7 +107,9 @@
_hasMouseDevice = hasMouseDevice;
- WebKit::WebProcessProxy::notifyHasMouseDeviceChanged();
+ ensureOnMainRunLoop([hasMouseDevice] {
+ WebKit::WebProcessProxy::notifyHasMouseDeviceChanged(hasMouseDevice);
+ });
}
#pragma mark - Testing
@@ -115,7 +118,9 @@
{
_hasMouseDevice = hasMouseDevice;
- WebKit::WebProcessProxy::notifyHasMouseDeviceChanged();
+ ensureOnMainRunLoop([hasMouseDevice] {
+ WebKit::WebProcessProxy::notifyHasMouseDeviceChanged(hasMouseDevice);
+ });
}
@end
Modified: trunk/Source/WebKit/UIProcess/ios/WebProcessProxyIOS.mm (275936 => 275937)
--- trunk/Source/WebKit/UIProcess/ios/WebProcessProxyIOS.mm 2021-04-14 07:44:16 UTC (rev 275936)
+++ trunk/Source/WebKit/UIProcess/ios/WebProcessProxyIOS.mm 2021-04-14 08:20:52 UTC (rev 275937)
@@ -58,9 +58,9 @@
#if HAVE(UIKIT_WITH_MOUSE_SUPPORT) && PLATFORM(IOS)
-void WebProcessProxy::notifyHasMouseDeviceChanged()
+void WebProcessProxy::notifyHasMouseDeviceChanged(bool hasMouseDevice)
{
- bool hasMouseDevice = [[WKMouseDeviceObserver sharedInstance] hasMouseDevice];
+ ASSERT(isMainRunLoop());
for (auto* webProcessProxy : WebProcessProxy::allProcesses().values())
webProcessProxy->send(Messages::WebProcess::SetHasMouseDevice(hasMouseDevice), 0);
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes