Title: [261860] trunk/Source/WebKit
Revision
261860
Author
cdu...@apple.com
Date
2020-05-19 08:31:38 -0700 (Tue, 19 May 2020)

Log Message

[iOS] Port Foreground process assertion to RunningBoard
https://bugs.webkit.org/show_bug.cgi?id=211795
<rdar://problem/61831863>

Reviewed by Geoffrey Garen.

Port Foreground process assertion to RunningBoard now that <rdar://problem/62614429>
has been fixed.

* Configurations/WebKit.xcconfig:
* UIProcess/ProcessAssertion.h:
* UIProcess/ios/ProcessAssertionIOS.mm:
(WebKit::runningBoardNameForAssertionType):
(WebKit::ProcessAssertion::ProcessAssertion):
(WebKit::ProcessAssertion::~ProcessAssertion):
(WebKit::ProcessAssertion::isValid const):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (261859 => 261860)


--- trunk/Source/WebKit/ChangeLog	2020-05-19 14:51:58 UTC (rev 261859)
+++ trunk/Source/WebKit/ChangeLog	2020-05-19 15:31:38 UTC (rev 261860)
@@ -1,3 +1,22 @@
+2020-05-19  Chris Dumez  <cdu...@apple.com>
+
+        [iOS] Port Foreground process assertion to RunningBoard
+        https://bugs.webkit.org/show_bug.cgi?id=211795
+        <rdar://problem/61831863>
+
+        Reviewed by Geoffrey Garen.
+
+        Port Foreground process assertion to RunningBoard now that <rdar://problem/62614429>
+        has been fixed.
+
+        * Configurations/WebKit.xcconfig:
+        * UIProcess/ProcessAssertion.h:
+        * UIProcess/ios/ProcessAssertionIOS.mm:
+        (WebKit::runningBoardNameForAssertionType):
+        (WebKit::ProcessAssertion::ProcessAssertion):
+        (WebKit::ProcessAssertion::~ProcessAssertion):
+        (WebKit::ProcessAssertion::isValid const):
+
 2020-05-19  Andy Estes  <aes...@apple.com>
 
         [Apple Pay] Add testing and logging for ApplePaySetup

Modified: trunk/Source/WebKit/Configurations/WebKit.xcconfig (261859 => 261860)


--- trunk/Source/WebKit/Configurations/WebKit.xcconfig	2020-05-19 14:51:58 UTC (rev 261859)
+++ trunk/Source/WebKit/Configurations/WebKit.xcconfig	2020-05-19 15:31:38 UTC (rev 261860)
@@ -48,8 +48,16 @@
 WK_APPKIT_LDFLAGS_macosx = -framework AppKit;
 WK_APPKIT_LDFLAGS_maccatalyst = -framework AppKit;
 
-WK_ASSERTION_SERVICES_LDFLAGS = $(WK_ASSERTION_SERVICES_LDFLAGS_$(WK_COCOA_TOUCH));
-WK_ASSERTION_SERVICES_LDFLAGS_cocoatouch = -framework AssertionServices;
+WK_ASSERTION_SERVICES_LDFLAGS = $(WK_ASSERTION_SERVICES_LDFLAGS_$(WK_PLATFORM_NAME));
+WK_ASSERTION_SERVICES_LDFLAGS_iphoneos = $(WK_ASSERTION_SERVICES_LDFLAGS$(WK_IOS_14));
+WK_ASSERTION_SERVICES_LDFLAGS_iphonesimulator = $(WK_ASSERTION_SERVICES_LDFLAGS$(WK_IOS_14));
+WK_ASSERTION_SERVICES_LDFLAGS_IOS_BEFORE_14 = -framework AssertionServices;
+// FIXME: It is unnecessary to link against AssertionServices with the latest SDK for the following platforms too.
+WK_ASSERTION_SERVICES_LDFLAGS_watchos = -framework AssertionServices;
+WK_ASSERTION_SERVICES_LDFLAGS_watchsimulator = -framework AssertionServices;
+WK_ASSERTION_SERVICES_LDFLAGS_appletvos = -framework AssertionServices;
+WK_ASSERTION_SERVICES_LDFLAGS_appletvsimulator = -framework AssertionServices;
+WK_ASSERTION_SERVICES_LDFLAGS_maccatalyst = -framework AssertionServices;
 
 WK_RUNNINGBOARD_SERVICES_LDFLAGS = $(WK_RUNNINGBOARD_SERVICES_LDFLAGS_$(WK_COCOA_TOUCH));
 WK_RUNNINGBOARD_SERVICES_LDFLAGS_cocoatouch = -framework RunningBoardServices;

Modified: trunk/Source/WebKit/UIProcess/ProcessAssertion.h (261859 => 261860)


--- trunk/Source/WebKit/UIProcess/ProcessAssertion.h	2020-05-19 14:51:58 UTC (rev 261859)
+++ trunk/Source/WebKit/UIProcess/ProcessAssertion.h	2020-05-19 15:31:38 UTC (rev 261860)
@@ -39,7 +39,10 @@
 
 OBJC_CLASS RBSAssertion;
 OBJC_CLASS WKRBSAssertionDelegate;
+
+#if !HAVE(RUNNINGBOARD_VISIBILITY_ASSERTIONS)
 OBJC_CLASS BKSProcessAssertion;
+#endif
 #endif // PLATFORM(IOS_FAMILY)
 
 namespace WebKit {
@@ -86,8 +89,10 @@
 #if PLATFORM(IOS_FAMILY)
     RetainPtr<RBSAssertion> m_rbsAssertion;
     RetainPtr<WKRBSAssertionDelegate> m_delegate;
+#if !HAVE(RUNNINGBOARD_VISIBILITY_ASSERTIONS)
     RetainPtr<BKSProcessAssertion> m_bksAssertion; // Legacy.
 #endif
+#endif
     Client* m_client { nullptr };
 };
 

Modified: trunk/Source/WebKit/UIProcess/ios/ProcessAssertionIOS.mm (261859 => 261860)


--- trunk/Source/WebKit/UIProcess/ios/ProcessAssertionIOS.mm	2020-05-19 14:51:58 UTC (rev 261859)
+++ trunk/Source/WebKit/UIProcess/ios/ProcessAssertionIOS.mm	2020-05-19 15:31:38 UTC (rev 261860)
@@ -28,7 +28,6 @@
 
 #if PLATFORM(IOS_FAMILY)
 
-#import "AssertionServicesSPI.h"
 #import "Logging.h"
 #import "RunningBoardServicesSPI.h"
 #import "WebProcessPool.h"
@@ -38,6 +37,10 @@
 #import <wtf/Vector.h>
 #import <wtf/WeakHashSet.h>
 
+#if !HAVE(RUNNINGBOARD_VISIBILITY_ASSERTIONS)
+#import "AssertionServicesSPI.h"
+#endif
+
 using WebKit::ProcessAndUIAssertion;
 
 // This gives some time to our child processes to process the ProcessWillSuspendImminently IPC but makes sure we release
@@ -309,7 +312,7 @@
     case ProcessAssertionType::UnboundedNetworking:
         return @"UnboundedNetworking";
     case ProcessAssertionType::Foreground:
-        return nil; // We are not using RunningBoard for the Foreground assertion yet due to <rdar://problem/62535822>.
+        return @"Foreground";
     case ProcessAssertionType::DependentProcessLink:
         return @"DependentProcessLink";
     case ProcessAssertionType::MediaPlayback:
@@ -322,6 +325,8 @@
 #endif
 }
 
+#if !HAVE(RUNNINGBOARD_VISIBILITY_ASSERTIONS)
+
 const BKSProcessAssertionFlags suspendedTabFlags = (BKSProcessAssertionAllowIdleSleep);
 const BKSProcessAssertionFlags backgroundTabFlags = (BKSProcessAssertionPreventTaskSuspend);
 const BKSProcessAssertionFlags foregroundTabFlags = (BKSProcessAssertionPreventTaskSuspend | BKSProcessAssertionWantsForegroundResourcePriority | BKSProcessAssertionPreventTaskThrottleDown);
@@ -360,6 +365,8 @@
     }
 }
 
+#endif // !HAVE(RUNNINGBOARD_VISIBILITY_ASSERTIONS)
+
 ProcessAssertion::ProcessAssertion(pid_t pid, const String& reason, ProcessAssertionType assertionType)
     : m_assertionType(assertionType)
     , m_pid(pid)
@@ -367,6 +374,7 @@
     auto weakThis = makeWeakPtr(*this);
     NSString *runningBoardAssertionName = runningBoardNameForAssertionType(assertionType);
 
+#if !HAVE(RUNNINGBOARD_VISIBILITY_ASSERTIONS)
     if (!runningBoardAssertionName) {
         // Legacy code path.
         BKSProcessAssertionAcquisitionHandler handler = ^(BOOL acquired) {
@@ -391,6 +399,7 @@
         };
         return;
     }
+#endif // !HAVE(RUNNINGBOARD_VISIBILITY_ASSERTIONS)
 
     ASSERT(runningBoardAssertionName);
     if (!pid) {
@@ -431,10 +440,12 @@
         [m_rbsAssertion invalidate];
     }
 
+#if !HAVE(RUNNINGBOARD_VISIBILITY_ASSERTIONS)
     if (m_bksAssertion) {
         m_bksAssertion.get().invalidationHandler = nil;
         [m_bksAssertion invalidate];
     }
+#endif
 }
 
 void ProcessAssertion::processAssertionWasInvalidated()
@@ -451,8 +462,10 @@
     if (m_rbsAssertion)
         return m_rbsAssertion.get().valid;
 
+#if !HAVE(RUNNINGBOARD_VISIBILITY_ASSERTIONS)
     if (m_bksAssertion)
         return m_bksAssertion.get().valid;
+#endif
 
     return false;
 }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to