Title: [233973] branches/safari-606-branch/Source
Revision
233973
Author
[email protected]
Date
2018-07-18 19:01:13 -0700 (Wed, 18 Jul 2018)

Log Message

Cherry-pick r233932. rdar://problem/42353789

    The WebContent process does not suspend when MiniBrowser is minimized.
    https://bugs.webkit.org/show_bug.cgi?id=187708

    Reviewed by Chris Dumez.

    Source/WebCore/PAL:

    Add function for enabling App nap.

    * pal/spi/cf/CFUtilitiesSPI.h:

    Source/WebKit:

    Using the NSRunLoop runloop type prevents the WebContent process from suspending. Instead, use the new
    _WebKit runloop type. Also do not leak a boost to the WebContent process, since this also prevents the
    WebContent process from going to sleep. Calling SetApplicationIsDaemon prevents the WebContent process
    from being assigned the application process priority level. To block WindowServer connections, call
    CGSSetDenyWindowServerConnections(true) instead. Finally, App nap must be manually enabled, since the
    WebContent process is no longer a NSApplication.

    * Configurations/WebContentService.xcconfig:
    * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
    (WebKit::shouldLeakBoost):
    * WebProcess/WebPage/WebPage.cpp:
    (WebKit::WebPage::updateThrottleState):
    * WebProcess/cocoa/WebProcessCocoa.mm:
    (WebKit::WebProcess::platformInitializeProcess):

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233932 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Diff

Modified: branches/safari-606-branch/Source/WebCore/PAL/ChangeLog (233972 => 233973)


--- branches/safari-606-branch/Source/WebCore/PAL/ChangeLog	2018-07-19 02:01:09 UTC (rev 233972)
+++ branches/safari-606-branch/Source/WebCore/PAL/ChangeLog	2018-07-19 02:01:13 UTC (rev 233973)
@@ -1,5 +1,51 @@
 2018-07-18  Babak Shafiei  <[email protected]>
 
+        Cherry-pick r233932. rdar://problem/42353789
+
+    The WebContent process does not suspend when MiniBrowser is minimized.
+    https://bugs.webkit.org/show_bug.cgi?id=187708
+    
+    Reviewed by Chris Dumez.
+    
+    Source/WebCore/PAL:
+    
+    Add function for enabling App nap.
+    
+    * pal/spi/cf/CFUtilitiesSPI.h:
+    
+    Source/WebKit:
+    
+    Using the NSRunLoop runloop type prevents the WebContent process from suspending. Instead, use the new
+    _WebKit runloop type. Also do not leak a boost to the WebContent process, since this also prevents the
+    WebContent process from going to sleep. Calling SetApplicationIsDaemon prevents the WebContent process
+    from being assigned the application process priority level. To block WindowServer connections, call
+    CGSSetDenyWindowServerConnections(true) instead. Finally, App nap must be manually enabled, since the
+    WebContent process is no longer a NSApplication.
+    
+    * Configurations/WebContentService.xcconfig:
+    * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
+    (WebKit::shouldLeakBoost):
+    * WebProcess/WebPage/WebPage.cpp:
+    (WebKit::WebPage::updateThrottleState):
+    * WebProcess/cocoa/WebProcessCocoa.mm:
+    (WebKit::WebProcess::platformInitializeProcess):
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233932 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2018-07-18  Per Arne Vollan  <[email protected]>
+
+            The WebContent process does not suspend when MiniBrowser is minimized.
+            https://bugs.webkit.org/show_bug.cgi?id=187708
+
+            Reviewed by Chris Dumez.
+
+            Add function for enabling App nap.
+
+            * pal/spi/cf/CFUtilitiesSPI.h:
+
+2018-07-18  Babak Shafiei  <[email protected]>
+
         Cherry-pick r233926. rdar://problem/42354941
 
     PiP from Element Fullscreen should match AVKit's behavior

Modified: branches/safari-606-branch/Source/WebCore/PAL/pal/spi/cf/CFUtilitiesSPI.h (233972 => 233973)


--- branches/safari-606-branch/Source/WebCore/PAL/pal/spi/cf/CFUtilitiesSPI.h	2018-07-19 02:01:09 UTC (rev 233972)
+++ branches/safari-606-branch/Source/WebCore/PAL/pal/spi/cf/CFUtilitiesSPI.h	2018-07-19 02:01:13 UTC (rev 233973)
@@ -38,6 +38,10 @@
     CFSystemVersionMountainLion = 8,
 };
 
+typedef CF_OPTIONS(uint64_t, __CFRunLoopOptions) {
+    __CFRunLoopOptionsEnableAppNap = 0x3b000000
+};
+
 #endif
 
 WTF_EXTERN_C_BEGIN
@@ -52,4 +56,6 @@
 CFDictionaryRef _CFCopySystemVersionDictionary();
 CFDictionaryRef _CFWebServicesCopyProviderInfo(CFStringRef serviceType, Boolean* outIsUserSelection);
 
+void __CFRunLoopSetOptionsReason(__CFRunLoopOptions opts, CFStringRef reason);
+
 WTF_EXTERN_C_END

Modified: branches/safari-606-branch/Source/WebKit/ChangeLog (233972 => 233973)


--- branches/safari-606-branch/Source/WebKit/ChangeLog	2018-07-19 02:01:09 UTC (rev 233972)
+++ branches/safari-606-branch/Source/WebKit/ChangeLog	2018-07-19 02:01:13 UTC (rev 233973)
@@ -1,5 +1,62 @@
 2018-07-18  Babak Shafiei  <[email protected]>
 
+        Cherry-pick r233932. rdar://problem/42353789
+
+    The WebContent process does not suspend when MiniBrowser is minimized.
+    https://bugs.webkit.org/show_bug.cgi?id=187708
+    
+    Reviewed by Chris Dumez.
+    
+    Source/WebCore/PAL:
+    
+    Add function for enabling App nap.
+    
+    * pal/spi/cf/CFUtilitiesSPI.h:
+    
+    Source/WebKit:
+    
+    Using the NSRunLoop runloop type prevents the WebContent process from suspending. Instead, use the new
+    _WebKit runloop type. Also do not leak a boost to the WebContent process, since this also prevents the
+    WebContent process from going to sleep. Calling SetApplicationIsDaemon prevents the WebContent process
+    from being assigned the application process priority level. To block WindowServer connections, call
+    CGSSetDenyWindowServerConnections(true) instead. Finally, App nap must be manually enabled, since the
+    WebContent process is no longer a NSApplication.
+    
+    * Configurations/WebContentService.xcconfig:
+    * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
+    (WebKit::shouldLeakBoost):
+    * WebProcess/WebPage/WebPage.cpp:
+    (WebKit::WebPage::updateThrottleState):
+    * WebProcess/cocoa/WebProcessCocoa.mm:
+    (WebKit::WebProcess::platformInitializeProcess):
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233932 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2018-07-18  Per Arne Vollan  <[email protected]>
+
+            The WebContent process does not suspend when MiniBrowser is minimized.
+            https://bugs.webkit.org/show_bug.cgi?id=187708
+
+            Reviewed by Chris Dumez.
+
+            Using the NSRunLoop runloop type prevents the WebContent process from suspending. Instead, use the new
+            _WebKit runloop type. Also do not leak a boost to the WebContent process, since this also prevents the
+            WebContent process from going to sleep. Calling SetApplicationIsDaemon prevents the WebContent process
+            from being assigned the application process priority level. To block WindowServer connections, call
+            CGSSetDenyWindowServerConnections(true) instead. Finally, App nap must be manually enabled, since the
+            WebContent process is no longer a NSApplication.
+
+            * Configurations/WebContentService.xcconfig:
+            * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
+            (WebKit::shouldLeakBoost):
+            * WebProcess/WebPage/WebPage.cpp:
+            (WebKit::WebPage::updateThrottleState):
+            * WebProcess/cocoa/WebProcessCocoa.mm:
+            (WebKit::WebProcess::platformInitializeProcess):
+
+2018-07-18  Babak Shafiei  <[email protected]>
+
         Cherry-pick r233927. rdar://problem/42354954
 
     -_beginAnimatedResizeWithUpdates: can leave view in bad state if called during an existing animation

Modified: branches/safari-606-branch/Source/WebKit/Configurations/WebContentService.xcconfig (233972 => 233973)


--- branches/safari-606-branch/Source/WebKit/Configurations/WebContentService.xcconfig	2018-07-19 02:01:09 UTC (rev 233972)
+++ branches/safari-606-branch/Source/WebKit/Configurations/WebContentService.xcconfig	2018-07-19 02:01:13 UTC (rev 233973)
@@ -61,4 +61,4 @@
 
 RUNLOOP_TYPE = $(RUNLOOP_TYPE$(WK_MACOS_1014));
 RUNLOOP_TYPE_MACOS_BEFORE_1014 = _NSApplicationMain;
-RUNLOOP_TYPE_MACOS_SINCE_1014 = NSRunLoop;
+RUNLOOP_TYPE_MACOS_SINCE_1014 = _WebKit;

Modified: branches/safari-606-branch/Source/WebKit/UIProcess/Launcher/mac/ProcessLauncherMac.mm (233972 => 233973)


--- branches/safari-606-branch/Source/WebKit/UIProcess/Launcher/mac/ProcessLauncherMac.mm	2018-07-19 02:01:09 UTC (rev 233972)
+++ branches/safari-606-branch/Source/WebKit/UIProcess/Launcher/mac/ProcessLauncherMac.mm	2018-07-19 02:01:13 UTC (rev 233973)
@@ -78,11 +78,6 @@
     UNUSED_PARAM(launchOptions);
     return true;
 #else
-#if ENABLE(WEBPROCESS_NSRUNLOOP)
-    // Boost the WebContent process if the NSApplication run loop is not used.
-    if (launchOptions.processType == ProcessLauncher::ProcessType::Web)
-        return true;
-#endif
     // On Mac, leak a boost onto the NetworkProcess.
     return launchOptions.processType == ProcessLauncher::ProcessType::Network;
 #endif

Modified: branches/safari-606-branch/Source/WebKit/WebProcess/WebPage/WebPage.cpp (233972 => 233973)


--- branches/safari-606-branch/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2018-07-19 02:01:09 UTC (rev 233972)
+++ branches/safari-606-branch/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2018-07-19 02:01:13 UTC (rev 233973)
@@ -261,6 +261,7 @@
 
 #if PLATFORM(MAC)
 #include <WebCore/LocalDefaultSystemAppearance.h>
+#include <pal/spi/cf/CFUtilitiesSPI.h>
 #endif
 
 #ifndef NDEBUG
@@ -671,6 +672,15 @@
     bool windowIsActive = m_activityState & ActivityState::WindowIsActive;
     bool pageSuppressed = !windowIsActive && !isLoading && !isPlayingAudio && !isCapturingMedia && m_processSuppressionEnabled && isVisuallyIdle;
 
+#if PLATFORM(MAC) && ENABLE(WEBPROCESS_WINDOWSERVER_BLOCKING)
+    if (!pageSuppressed) {
+        // App nap must be manually enabled when not running the NSApplication run loop.
+        static std::once_flag onceKey;
+        std::call_once(onceKey, [] {
+            __CFRunLoopSetOptionsReason(__CFRunLoopOptionsEnableAppNap, CFSTR("Finished checkin as application - enable app nap"));
+        });
+    }
+#endif
     // The UserActivity keeps the processes runnable. So if the page should be suppressed, stop the activity.
     // If the page should not be supressed, start it.
     if (pageSuppressed)

Modified: branches/safari-606-branch/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm (233972 => 233973)


--- branches/safari-606-branch/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm	2018-07-19 02:01:09 UTC (rev 233972)
+++ branches/safari-606-branch/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm	2018-07-19 02:01:13 UTC (rev 233973)
@@ -316,7 +316,7 @@
 #if ENABLE(WEBPROCESS_WINDOWSERVER_BLOCKING)
     // Deny the WebContent process access to the WindowServer.
     // This call will not succeed if there are open WindowServer connections at this point.
-    setApplicationIsDaemon();
+    CGSSetDenyWindowServerConnections(true);
     // Make sure that we close any WindowServer connections after checking in with Launch Services.
     CGSShutdownServerConnections();
 #else
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to