Title: [263090] trunk/Source/WebCore
Revision
263090
Author
[email protected]
Date
2020-06-16 08:00:35 -0700 (Tue, 16 Jun 2020)

Log Message

[iOS] Collecting screen properties in the UI process introduced a Safari launch time regression.
https://bugs.webkit.org/show_bug.cgi?id=213217
<rdar://problem/64374461>

Reviewed by Brent Fulgham.

Calling collectScreenProperties() in WebProcessPool::platformInitializeWebProcess() introduced a Safari launch time regression on iOS.
It turns out that calling screenIsMonochrome on iOS is expensive, but this call can still be done in the WebContent process, since there
are no sandbox restrictions making that call fail in the WebContent process. Call this function in the WebContent process instead of in
the UI process.

No new tests, since this change should not introduce a change in behavior. It goes back to calling the screenIsMonochrome function in the
WebContent process.

* platform/ScreenProperties.h:
(WebCore::ScreenData::encode const):
(WebCore::ScreenData::decode):
* platform/ios/PlatformScreenIOS.mm:
(WebCore::screenIsMonochrome):
(WebCore::collectScreenProperties):
* platform/mac/PlatformScreenMac.mm:
(WebCore::collectScreenProperties):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (263089 => 263090)


--- trunk/Source/WebCore/ChangeLog	2020-06-16 14:58:40 UTC (rev 263089)
+++ trunk/Source/WebCore/ChangeLog	2020-06-16 15:00:35 UTC (rev 263090)
@@ -1,3 +1,28 @@
+2020-06-16  Per Arne Vollan  <[email protected]>
+
+        [iOS] Collecting screen properties in the UI process introduced a Safari launch time regression.
+        https://bugs.webkit.org/show_bug.cgi?id=213217
+        <rdar://problem/64374461>
+
+        Reviewed by Brent Fulgham.
+
+        Calling collectScreenProperties() in WebProcessPool::platformInitializeWebProcess() introduced a Safari launch time regression on iOS.
+        It turns out that calling screenIsMonochrome on iOS is expensive, but this call can still be done in the WebContent process, since there
+        are no sandbox restrictions making that call fail in the WebContent process. Call this function in the WebContent process instead of in
+        the UI process.
+
+        No new tests, since this change should not introduce a change in behavior. It goes back to calling the screenIsMonochrome function in the
+        WebContent process.
+
+        * platform/ScreenProperties.h:
+        (WebCore::ScreenData::encode const):
+        (WebCore::ScreenData::decode):
+        * platform/ios/PlatformScreenIOS.mm:
+        (WebCore::screenIsMonochrome):
+        (WebCore::collectScreenProperties):
+        * platform/mac/PlatformScreenMac.mm:
+        (WebCore::collectScreenProperties):
+
 2020-06-16  Xabier Rodriguez Calvar  <[email protected]>
 
         [EME] Create CDMProxyFactory

Modified: trunk/Source/WebCore/platform/ScreenProperties.h (263089 => 263090)


--- trunk/Source/WebCore/platform/ScreenProperties.h	2020-06-16 14:58:40 UTC (rev 263089)
+++ trunk/Source/WebCore/platform/ScreenProperties.h	2020-06-16 15:00:35 UTC (rev 263090)
@@ -44,9 +44,9 @@
     int screenDepthPerComponent { 0 };
     bool screenSupportsExtendedColor { false };
     bool screenHasInvertedColors { false };
-    bool screenIsMonochrome { false };
     bool screenSupportsHighDynamicRange { false };
 #if PLATFORM(MAC)
+    bool screenIsMonochrome { false };
     uint32_t displayMask { 0 };
     IORegistryGPUID gpuID { 0 };
 #endif
@@ -92,10 +92,10 @@
 template<class Encoder>
 void ScreenData::encode(Encoder& encoder) const
 {
-    encoder << screenAvailableRect << screenRect << screenDepth << screenDepthPerComponent << screenSupportsExtendedColor << screenHasInvertedColors << screenIsMonochrome << screenSupportsHighDynamicRange;
+    encoder << screenAvailableRect << screenRect << screenDepth << screenDepthPerComponent << screenSupportsExtendedColor << screenHasInvertedColors << screenSupportsHighDynamicRange;
 
 #if PLATFORM(MAC)
-    encoder << displayMask << gpuID;
+    encoder << screenIsMonochrome << displayMask << gpuID;
 #endif
 
     if (colorSpace) {
@@ -154,11 +154,6 @@
     if (!screenHasInvertedColors)
         return WTF::nullopt;
 
-    Optional<bool> screenIsMonochrome;
-    decoder >> screenIsMonochrome;
-    if (!screenIsMonochrome)
-        return WTF::nullopt;
-
     Optional<bool> screenSupportsHighDynamicRange;
     decoder >> screenSupportsHighDynamicRange;
     if (!screenSupportsHighDynamicRange)
@@ -165,6 +160,11 @@
         return WTF::nullopt;
 
 #if PLATFORM(MAC)
+    Optional<bool> screenIsMonochrome;
+    decoder >> screenIsMonochrome;
+    if (!screenIsMonochrome)
+        return WTF::nullopt;
+
     Optional<uint32_t> displayMask;
     decoder >> displayMask;
     if (!displayMask)
@@ -215,9 +215,9 @@
         WTFMove(*screenDepthPerComponent),
         WTFMove(*screenSupportsExtendedColor),
         WTFMove(*screenHasInvertedColors),
-        WTFMove(*screenIsMonochrome),
         WTFMove(*screenSupportsHighDynamicRange),
 #if PLATFORM(MAC)
+        WTFMove(*screenIsMonochrome),
         WTFMove(*displayMask),
         WTFMove(*gpuID)
 #endif

Modified: trunk/Source/WebCore/platform/ios/PlatformScreenIOS.mm (263089 => 263090)


--- trunk/Source/WebCore/platform/ios/PlatformScreenIOS.mm	2020-06-16 14:58:40 UTC (rev 263089)
+++ trunk/Source/WebCore/platform/ios/PlatformScreenIOS.mm	2020-06-16 15:00:35 UTC (rev 263090)
@@ -60,9 +60,6 @@
 
 bool screenIsMonochrome(Widget*)
 {
-    if (auto data = ""
-        return data->screenIsMonochrome;
-    
     return PAL::softLinkUIKitUIAccessibilityIsGrayscaleEnabled();
 }
 
@@ -203,9 +200,8 @@
         int screenDepthPerComponent = WebCore::screenDepthPerComponent(nullptr);
         bool screenSupportsExtendedColor = WebCore::screenSupportsExtendedColor(nullptr);
         bool screenHasInvertedColors = WebCore::screenHasInvertedColors();
-        bool screenIsMonochrome = WebCore::screenIsMonochrome(nullptr);
 
-        screenProperties.screenDataMap.set(++displayID, ScreenData { screenAvailableRect, screenRect, colorSpace, screenDepth, screenDepthPerComponent, screenSupportsExtendedColor, screenHasInvertedColors, screenIsMonochrome });
+        screenProperties.screenDataMap.set(++displayID, ScreenData { screenAvailableRect, screenRect, colorSpace, screenDepth, screenDepthPerComponent, screenSupportsExtendedColor, screenHasInvertedColors });
         
         if (screen == [PAL::getUIScreenClass() mainScreen])
             screenProperties.primaryDisplayID = displayID;

Modified: trunk/Source/WebCore/platform/mac/PlatformScreenMac.mm (263089 => 263090)


--- trunk/Source/WebCore/platform/mac/PlatformScreenMac.mm	2020-06-16 14:58:40 UTC (rev 263089)
+++ trunk/Source/WebCore/platform/mac/PlatformScreenMac.mm	2020-06-16 15:00:35 UTC (rev 263090)
@@ -126,7 +126,7 @@
         if (displayMask)
             gpuID = gpuIDForDisplayMask(displayMask);
 
-        screenProperties.screenDataMap.set(displayID, ScreenData { screenAvailableRect, screenRect, colorSpace, screenDepth, screenDepthPerComponent, screenSupportsExtendedColor, screenHasInvertedColors, screenIsMonochrome, screenSupportsHighDynamicRange, displayMask, gpuID });
+        screenProperties.screenDataMap.set(displayID, ScreenData { screenAvailableRect, screenRect, colorSpace, screenDepth, screenDepthPerComponent, screenSupportsExtendedColor, screenHasInvertedColors, screenSupportsHighDynamicRange, screenIsMonochrome, displayMask, gpuID });
 
         if (!screenProperties.primaryDisplayID)
             screenProperties.primaryDisplayID = displayID;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to