Title: [260392] trunk/Source/WebCore
Revision
260392
Author
andresg...@apple.com
Date
2020-04-20 13:11:09 -0700 (Mon, 20 Apr 2020)

Log Message

The rect for the primary screen should be retrieved on the main thread.
https://bugs.webkit.org/show_bug.cgi?id=210760

Reviewed by Chris Fleizach.

- Call to screenRectForPrimaryScreen is dispatched to main thread.
- This value is cached since it is very unlikely to change in normal
usage and this would avoid hitting the main thread repeatedly.

* accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
(-[WebAccessibilityObjectWrapper primaryScreenHeight]):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (260391 => 260392)


--- trunk/Source/WebCore/ChangeLog	2020-04-20 20:09:47 UTC (rev 260391)
+++ trunk/Source/WebCore/ChangeLog	2020-04-20 20:11:09 UTC (rev 260392)
@@ -1,3 +1,17 @@
+2020-04-20  Andres Gonzalez  <andresg...@apple.com>
+
+        The rect for the primary screen should be retrieved on the main thread.
+        https://bugs.webkit.org/show_bug.cgi?id=210760
+
+        Reviewed by Chris Fleizach.
+
+        - Call to screenRectForPrimaryScreen is dispatched to main thread.
+        - This value is cached since it is very unlikely to change in normal
+        usage and this would avoid hitting the main thread repeatedly.
+
+        * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
+        (-[WebAccessibilityObjectWrapper primaryScreenHeight]):
+
 2020-04-15  Sergio Villar Senin  <svil...@igalia.com>
 
         [WebXR] Update WebXRSession and WebXRSystem interfaces

Modified: trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm (260391 => 260392)


--- trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm	2020-04-20 20:09:47 UTC (rev 260391)
+++ trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm	2020-04-20 20:11:09 UTC (rev 260392)
@@ -1942,7 +1942,14 @@
 
 - (NSNumber *)primaryScreenHeight
 {
-    FloatRect screenRect = screenRectForPrimaryScreen();
+    // The rect for primary screen should not change in normal use. So cache it
+    // here to avoid hitting the main thread repeatedly.
+    static FloatRect screenRect;
+    if (screenRect.isEmpty()) {
+        screenRect = Accessibility::retrieveValueFromMainThread<FloatRect>([] () -> FloatRect {
+            return screenRectForPrimaryScreen();
+        });
+    }
     return [NSNumber numberWithFloat:screenRect.height()];
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to