Title: [217884] trunk/Source/WebKit
- Revision
- 217884
- Author
- [email protected]
- Date
- 2017-06-07 08:48:18 -0700 (Wed, 07 Jun 2017)
Log Message
[iOS WK1 WebThread] Do not call out to the main thread for device orientation.
https://bugs.webkit.org/show_bug.cgi?id=173044
<rdar://problem/32449338>
Reviewed by Tim Horton.
Source/WebKit/ios:
On iOS WK1 we could end up with an inconsistent state, where the web thread is inside
the Document's constructor waiting on a delegate callback on the main thread
while the main thread executes a pending task that assumes a valid Document.
This patch ensures that we don't call out to the main thread from the Document's constructor.
* WebCoreSupport/WebChromeClientIOS.mm:
(WebChromeClientIOS::deviceOrientation): Caches deviceOrientation on the WebView so that we
don't have to lift the WebThread lock.
Source/WebKit/mac:
Cache the current device orientation so that we don't have to lift the WebThread lock
to collect it.
* WebView/WebFrame.mm:
(-[WebFrame deviceOrientationChanged]):
* WebView/WebView.mm:
(-[WebView _commonInitializationWithFrameName:groupName:]):
(-[WebView _setDeviceOrientation:]):
(-[WebView _deviceOrientation]):
* WebView/WebViewData.h:
* WebView/WebViewInternal.h:
Modified Paths
Diff
Modified: trunk/Source/WebKit/ios/ChangeLog (217883 => 217884)
--- trunk/Source/WebKit/ios/ChangeLog 2017-06-07 15:08:14 UTC (rev 217883)
+++ trunk/Source/WebKit/ios/ChangeLog 2017-06-07 15:48:18 UTC (rev 217884)
@@ -1,3 +1,20 @@
+2017-06-07 Zalan Bujtas <[email protected]>
+
+ [iOS WK1 WebThread] Do not call out to the main thread for device orientation.
+ https://bugs.webkit.org/show_bug.cgi?id=173044
+ <rdar://problem/32449338>
+
+ Reviewed by Tim Horton.
+
+ On iOS WK1 we could end up with an inconsistent state, where the web thread is inside
+ the Document's constructor waiting on a delegate callback on the main thread
+ while the main thread executes a pending task that assumes a valid Document.
+ This patch ensures that we don't call out to the main thread from the Document's constructor.
+
+ * WebCoreSupport/WebChromeClientIOS.mm:
+ (WebChromeClientIOS::deviceOrientation): Caches deviceOrientation on the WebView so that we
+ don't have to lift the WebThread lock.
+
2017-05-12 Chris Dumez <[email protected]>
Drop uses of PassRefPtr in WebKit/mac
Modified: trunk/Source/WebKit/ios/WebCoreSupport/WebChromeClientIOS.mm (217883 => 217884)
--- trunk/Source/WebKit/ios/WebCoreSupport/WebChromeClientIOS.mm 2017-06-07 15:08:14 UTC (rev 217883)
+++ trunk/Source/WebKit/ios/WebCoreSupport/WebChromeClientIOS.mm 2017-06-07 15:48:18 UTC (rev 217884)
@@ -361,12 +361,10 @@
}
#if ENABLE(ORIENTATION_EVENTS)
-
int WebChromeClientIOS::deviceOrientation() const
{
- return [[webView() _UIKitDelegateForwarder] deviceOrientation];
+ return [webView() _deviceOrientation];
}
-
#endif
#endif // PLATFORM(IOS)
Modified: trunk/Source/WebKit/mac/ChangeLog (217883 => 217884)
--- trunk/Source/WebKit/mac/ChangeLog 2017-06-07 15:08:14 UTC (rev 217883)
+++ trunk/Source/WebKit/mac/ChangeLog 2017-06-07 15:48:18 UTC (rev 217884)
@@ -1,3 +1,23 @@
+2017-06-07 Zalan Bujtas <[email protected]>
+
+ [iOS WK1 WebThread] Do not call out to the main thread for device orientation.
+ https://bugs.webkit.org/show_bug.cgi?id=173044
+ <rdar://problem/32449338>
+
+ Reviewed by Tim Horton.
+
+ Cache the current device orientation so that we don't have to lift the WebThread lock
+ to collect it.
+
+ * WebView/WebFrame.mm:
+ (-[WebFrame deviceOrientationChanged]):
+ * WebView/WebView.mm:
+ (-[WebView _commonInitializationWithFrameName:groupName:]):
+ (-[WebView _setDeviceOrientation:]):
+ (-[WebView _deviceOrientation]):
+ * WebView/WebViewData.h:
+ * WebView/WebViewInternal.h:
+
2017-06-06 Jer Noble <[email protected]>
[Cocoa] Set defaults for mediaContentTypesRequiringHardwareSupport setting
Modified: trunk/Source/WebKit/mac/WebView/WebFrame.mm (217883 => 217884)
--- trunk/Source/WebKit/mac/WebView/WebFrame.mm 2017-06-07 15:08:14 UTC (rev 217883)
+++ trunk/Source/WebKit/mac/WebView/WebFrame.mm 2017-06-07 15:48:18 UTC (rev 217884)
@@ -1286,6 +1286,10 @@
- (void)deviceOrientationChanged
{
WebThreadRun(^{
+#if ENABLE(ORIENTATION_EVENTS)
+ WebView *webView = getWebView(self);
+ [webView _setDeviceOrientation:[[webView _UIKitDelegateForwarder] deviceOrientation]];
+#endif
if (WebCore::Frame* frame = core(self))
frame->orientationChanged();
});
Modified: trunk/Source/WebKit/mac/WebView/WebView.mm (217883 => 217884)
--- trunk/Source/WebKit/mac/WebView/WebView.mm 2017-06-07 15:08:14 UTC (rev 217883)
+++ trunk/Source/WebKit/mac/WebView/WebView.mm 2017-06-07 15:48:18 UTC (rev 217884)
@@ -1521,7 +1521,10 @@
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_wakWindowScreenScaleChanged:) name:WAKWindowScreenScaleDidChangeNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_wakWindowVisibilityChanged:) name:WAKWindowVisibilityDidChangeNotification object:nil];
_private->_fixedPositionContent = [[WebFixedPositionContent alloc] initWithWebView:self];
+#if ENABLE(ORIENTATION_EVENTS)
+ _private->deviceOrientation = [[self _UIKitDelegateForwarder] deviceOrientation];
#endif
+#endif
if ([[NSUserDefaults standardUserDefaults] objectForKey:WebSmartInsertDeleteEnabled])
[self setSmartInsertDeleteEnabled:[[NSUserDefaults standardUserDefaults] boolForKey:WebSmartInsertDeleteEnabled]];
@@ -4188,6 +4191,18 @@
return _private->closing;
}
+#if ENABLE(ORIENTATION_EVENTS)
+- (void)_setDeviceOrientation:(NSUInteger)orientation
+{
+ _private->deviceOrientation = orientation;
+}
+
+- (NSUInteger)_deviceOrientation
+{
+ return _private->deviceOrientation;
+}
+#endif
+
+ (NSArray *)_productivityDocumentMIMETypes
{
#if USE(QUICK_LOOK)
Modified: trunk/Source/WebKit/mac/WebView/WebViewData.h (217883 => 217884)
--- trunk/Source/WebKit/mac/WebView/WebViewData.h 2017-06-07 15:08:14 UTC (rev 217883)
+++ trunk/Source/WebKit/mac/WebView/WebViewData.h 2017-06-07 15:48:18 UTC (rev 217884)
@@ -248,7 +248,10 @@
BOOL closed;
#if PLATFORM(IOS)
BOOL closing;
+#if ENABLE(ORIENTATION_EVENTS)
+ NSUInteger deviceOrientation;
#endif
+#endif
BOOL shouldCloseWithWindow;
BOOL mainFrameDocumentReady;
BOOL drawsBackground;
Modified: trunk/Source/WebKit/mac/WebView/WebViewInternal.h (217883 => 217884)
--- trunk/Source/WebKit/mac/WebView/WebViewInternal.h 2017-06-07 15:08:14 UTC (rev 217883)
+++ trunk/Source/WebKit/mac/WebView/WebViewInternal.h 2017-06-07 15:48:18 UTC (rev 217884)
@@ -254,7 +254,11 @@
- (void)_documentScaleChanged;
- (BOOL)_fetchCustomFixedPositionLayoutRect:(NSRect*)rect;
+#if ENABLE(ORIENTATION_EVENTS)
+- (void)_setDeviceOrientation:(NSUInteger)orientation;
+- (NSUInteger)_deviceOrientation;
#endif
+#endif
#if ENABLE(DATA_INTERACTION) && defined(__cplusplus)
- (void)_setDataInteractionData:(CGImageRef)image textIndicator:(std::optional<WebCore::TextIndicatorData>)textIndicator atClientPosition:(CGPoint)clientPosition anchorPoint:(CGPoint)anchorPoint action:(uint64_t)action;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes