Title: [255838] branches/safari-609.1.16-branch
Revision
255838
Author
alanc...@apple.com
Date
2020-02-05 11:48:12 -0800 (Wed, 05 Feb 2020)

Log Message

Cherry-pick r255189. rdar://problem/59196094

    Unreviewed, revert r253984 as it appears to be causing assertion leaks.
    https://bugs.webkit.org/show_bug.cgi?id=205687

    Source/WebKit:

    * Configurations/WebKit.xcconfig:
    * Platform/spi/ios/RunningBoardServicesSPI.h: Removed.
    * Scripts/process-entitlements.sh:
    * Shared/DependencyProcessAssertion.cpp: Removed.
    * Shared/DependencyProcessAssertion.h: Removed.
    * Shared/NativeWebTouchEvent.h:
    * Shared/ios/DependencyProcessAssertionIOS.mm: Removed.
    * Sources.txt:
    * SourcesCocoa.txt:
    * UIProcess/Cocoa/WebProcessProxyCocoa.mm:
    (WebKit::WebProcessProxy::processWasResumed):
    * UIProcess/WebProcessProxy.h:
    * UIProcess/WebProcessProxy.messages.in:
    * WebKit.xcodeproj/project.pbxproj:
    * WebProcess/WebProcess.cpp:
    (WebKit::WebProcess::initializeConnection):
    * WebProcess/WebProcess.h:
    * WebProcess/cocoa/WebProcessCocoa.mm:
    (WebKit::WebProcess::processTaskStateDidChange):
    (WebKit::WebProcess::releaseProcessWasResumedAssertions):

    WebKitLibraries:

    * WebKitPrivateFrameworkStubs/iOS/13/RunningBoardServices.framework/RunningBoardServices.tbd: Removed.

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

Modified Paths

Removed Paths

Diff

Modified: branches/safari-609.1.16-branch/Source/WebKit/ChangeLog (255837 => 255838)


--- branches/safari-609.1.16-branch/Source/WebKit/ChangeLog	2020-02-05 19:37:08 UTC (rev 255837)
+++ branches/safari-609.1.16-branch/Source/WebKit/ChangeLog	2020-02-05 19:48:12 UTC (rev 255838)
@@ -1,3 +1,65 @@
+2020-02-05  Alan Coon  <alanc...@apple.com>
+
+        Cherry-pick r255189. rdar://problem/59196094
+
+    Unreviewed, revert r253984 as it appears to be causing assertion leaks.
+    https://bugs.webkit.org/show_bug.cgi?id=205687
+    
+    Source/WebKit:
+    
+    * Configurations/WebKit.xcconfig:
+    * Platform/spi/ios/RunningBoardServicesSPI.h: Removed.
+    * Scripts/process-entitlements.sh:
+    * Shared/DependencyProcessAssertion.cpp: Removed.
+    * Shared/DependencyProcessAssertion.h: Removed.
+    * Shared/NativeWebTouchEvent.h:
+    * Shared/ios/DependencyProcessAssertionIOS.mm: Removed.
+    * Sources.txt:
+    * SourcesCocoa.txt:
+    * UIProcess/Cocoa/WebProcessProxyCocoa.mm:
+    (WebKit::WebProcessProxy::processWasResumed):
+    * UIProcess/WebProcessProxy.h:
+    * UIProcess/WebProcessProxy.messages.in:
+    * WebKit.xcodeproj/project.pbxproj:
+    * WebProcess/WebProcess.cpp:
+    (WebKit::WebProcess::initializeConnection):
+    * WebProcess/WebProcess.h:
+    * WebProcess/cocoa/WebProcessCocoa.mm:
+    (WebKit::WebProcess::processTaskStateDidChange):
+    (WebKit::WebProcess::releaseProcessWasResumedAssertions):
+    
+    WebKitLibraries:
+    
+    * WebKitPrivateFrameworkStubs/iOS/13/RunningBoardServices.framework/RunningBoardServices.tbd: Removed.
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@255189 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2020-01-27  Chris Dumez  <cdu...@apple.com>
+
+            Unreviewed, revert r253984 as it appears to be causing assertion leaks.
+            https://bugs.webkit.org/show_bug.cgi?id=205687
+
+            * Configurations/WebKit.xcconfig:
+            * Platform/spi/ios/RunningBoardServicesSPI.h: Removed.
+            * Scripts/process-entitlements.sh:
+            * Shared/DependencyProcessAssertion.cpp: Removed.
+            * Shared/DependencyProcessAssertion.h: Removed.
+            * Shared/NativeWebTouchEvent.h:
+            * Shared/ios/DependencyProcessAssertionIOS.mm: Removed.
+            * Sources.txt:
+            * SourcesCocoa.txt:
+            * UIProcess/Cocoa/WebProcessProxyCocoa.mm:
+            (WebKit::WebProcessProxy::processWasResumed):
+            * UIProcess/WebProcessProxy.h:
+            * UIProcess/WebProcessProxy.messages.in:
+            * WebKit.xcodeproj/project.pbxproj:
+            * WebProcess/WebProcess.cpp:
+            (WebKit::WebProcess::initializeConnection):
+            * WebProcess/WebProcess.h:
+            * WebProcess/cocoa/WebProcessCocoa.mm:
+            (WebKit::WebProcess::processTaskStateDidChange):
+            (WebKit::WebProcess::releaseProcessWasResumedAssertions):
+
 2020-01-30  Alan Coon  <alanc...@apple.com>
 
         Cherry-pick r255339. rdar://problem/58936679

Modified: branches/safari-609.1.16-branch/Source/WebKit/Configurations/WebKit.xcconfig (255837 => 255838)


--- branches/safari-609.1.16-branch/Source/WebKit/Configurations/WebKit.xcconfig	2020-02-05 19:37:08 UTC (rev 255837)
+++ branches/safari-609.1.16-branch/Source/WebKit/Configurations/WebKit.xcconfig	2020-02-05 19:48:12 UTC (rev 255838)
@@ -51,9 +51,6 @@
 WK_ASSERTION_SERVICES_LDFLAGS = $(WK_ASSERTION_SERVICES_LDFLAGS_$(WK_COCOA_TOUCH));
 WK_ASSERTION_SERVICES_LDFLAGS_cocoatouch = -framework AssertionServices;
 
-WK_RUNNINGBOARD_SERVICES_LDFLAGS = $(WK_RUNNINGBOARD_SERVICES_LDFLAGS_$(WK_COCOA_TOUCH));
-WK_RUNNINGBOARD_SERVICES_LDFLAGS_cocoatouch = -framework RunningBoardServices;
-
 WK_CARBON_LDFLAGS = $(WK_CARBON_LDFLAGS_$(WK_PLATFORM_NAME));
 WK_CARBON_LDFLAGS_macosx = -framework Carbon;
 
@@ -130,7 +127,7 @@
 WK_AUTHKIT_LDFLAGS_macosx = $(WK_AUTHKIT_LDFLAGS$(WK_MACOS_1015));
 WK_AUTHKIT_LDFLAGS_MACOS_SINCE_1015 = -framework AuthKit;
 
-FRAMEWORK_AND_LIBRARY_LDFLAGS = -lobjc -framework CFNetwork -framework CoreAudio -framework CoreFoundation -framework CoreGraphics -framework CoreText -framework Foundation -framework ImageIO -framework IOKit -framework IOSurface -framework WebKitLegacy -lnetwork $(WK_ACCESSIBILITY_LDFLAGS) $(WK_APPKIT_LDFLAGS) $(WK_ASSERTION_SERVICES_LDFLAGS) $(WK_RUNNINGBOARD_SERVICES_LDFLAGS) $(WK_AUTHKIT_LDFLAGS) $(WK_CARBON_LDFLAGS) $(WK_CORE_PDF_LDFLAGS) $(WK_CORE_PREDICTION_LDFLAGS) $(WK_CORE_SERVICES_LDFLAGS) $(WK_DEVICE_IDENTITY_LDFLAGS) $(WK_GRAPHICS_SERVICES_LDFLAGS) $(WK_LIBSANDBOX_LDFLAGS) $(WK_LIBWEBRTC_LDFLAGS) $(WK_MOBILE_CORE_SERVICES_LDFLAGS) $(WK_MOBILE_GESTALT_LDFLAGS) $(WK_OPENGL_LDFLAGS) $(WK_PDFKIT_LDFLAGS) $(WK_SAFE_BROWSING_LDFLAGS) $(WK_SECURITY_INTERFACE_LDFLAGS) $(WK_UIKIT_LDFLAGS) $(WK_URL_FORMATTING_LDFLAGS) $(WK_WEBINSPECTORUI_LDFLAGS);
+FRAMEWORK_AND_LIBRARY_LDFLAGS = -lobjc -framework CFNetwork -framework CoreAudio -framework CoreFoundation -framework CoreGraphics -framework CoreText -framework Foundation -framework ImageIO -framework IOKit -framework IOSurface -framework WebKitLegacy -lnetwork $(WK_ACCESSIBILITY_LDFLAGS) $(WK_APPKIT_LDFLAGS) $(WK_ASSERTION_SERVICES_LDFLAGS) $(WK_AUTHKIT_LDFLAGS) $(WK_CARBON_LDFLAGS) $(WK_CORE_PDF_LDFLAGS) $(WK_CORE_PREDICTION_LDFLAGS) $(WK_CORE_SERVICES_LDFLAGS) $(WK_DEVICE_IDENTITY_LDFLAGS) $(WK_GRAPHICS_SERVICES_LDFLAGS) $(WK_LIBSANDBOX_LDFLAGS) $(WK_LIBWEBRTC_LDFLAGS) $(WK_MOBILE_CORE_SERVICES_LDFLAGS) $(WK_MOBILE_GESTALT_LDFLAGS) $(WK_OPENGL_LDFLAGS) $(WK_PDFKIT_LDFLAGS) $(WK_SAFE_BROWSING_LDFLAGS) $(WK_SECURITY_INTERFACE_LDFLAGS) $(WK_UIKIT_LDFLAGS) $(WK_URL_FORMATTING_LDFLAGS) $(WK_WEBINSPECTORUI_LDFLAGS);
 
 // Prevent C++ standard library basic_stringstream, operator new, delete and their related exception types from being exported as weak symbols.
 UNEXPORTED_SYMBOL_LDFLAGS = -Wl,-unexported_symbol -Wl,__ZTISt9bad_alloc -Wl,-unexported_symbol -Wl,__ZTISt9exception -Wl,-unexported_symbol -Wl,__ZTSSt9bad_alloc -Wl,-unexported_symbol -Wl,__ZTSSt9exception -Wl,-unexported_symbol -Wl,__ZdlPvS_ -Wl,-unexported_symbol -Wl,__ZnwmPv -Wl,-unexported_symbol -Wl,__Znwm -Wl,-unexported_symbol -Wl,__ZNSt3__18functionIFvN7WebCore12PolicyActionEEEC2EOS4_ -Wl,-unexported_symbol -Wl,__ZNSt3__18functionIFvN7WebCore12PolicyActionEEEC1EOS4_ -Wl,-unexported_symbol -Wl,__ZNSt3__18functionIFvN7WebCore12PolicyActionEEEaSEDn -Wl,-unexported_symbol -Wl,__ZNKSt3__18functionIFvN7WebCore12PolicyActionEEEclES2_ -Wl,-unexported_symbol -Wl,__ZNSt3__18functionIFvN7WebCore12PolicyActionEEE4swapERS4_ -Wl,-unexported_symbol -Wl,__ZNSt3__18functionIFvN7WebCore12PolicyActionEEEC1ERKS4_ -Wl,-unexported_symbol -Wl,__ZNSt3__18functionIFvN7WebCore12PolicyActionEEEC2ERKS4_ -Wl,-unexported_symbol -Wl,__ZNSt3__18functionIFvN7WebCore12PolicyActionEE
 ED1Ev -Wl,-unexported_symbol -Wl,__ZNSt3__18functionIFvN7WebCore12PolicyActionEEED2Ev -Wl,-unexported_symbol -Wl,__ZNSt3__18functionIFvN7WebCore12PolicyActionEEEaSERKS4_ -Wl,-unexported_symbol -Wl,__ZTVNSt3__117bad_function_callE -Wl,-unexported_symbol -Wl,__ZTCNSt3__118basic_stringstreamIcNS_11char_traitsIcEENS_9allocatorIcEEEE0_NS_13basic_istreamIcS2_EE -Wl,-unexported_symbol -Wl,__ZTCNSt3__118basic_stringstreamIcNS_11char_traitsIcEENS_9allocatorIcEEEE0_NS_14basic_iostreamIcS2_EE -Wl,-unexported_symbol -Wl,__ZTCNSt3__118basic_stringstreamIcNS_11char_traitsIcEENS_9allocatorIcEEEE16_NS_13basic_ostreamIcS2_EE -Wl,-unexported_symbol -Wl,__ZTTNSt3__118basic_stringstreamIcNS_11char_traitsIcEENS_9allocatorIcEEEE -Wl,-unexported_symbol -Wl,__ZTVNSt3__115basic_stringbufIcNS_11char_traitsIcEENS_9allocatorIcEEEE -Wl,-unexported_symbol -Wl,__ZTVNSt3__118basic_stringstreamIcNS_11char_traitsIcEENS_9allocatorIcEEEE -Wl,-unexported_symbol -Wl,__ZTCNSt3__118basic_stringstreamIcNS_11char_traitsIcEE
 NS_9allocatorIcEEEE8_NS_13basic_ostreamIcS2_EE;

Deleted: branches/safari-609.1.16-branch/Source/WebKit/Platform/spi/ios/RunningBoardServicesSPI.h (255837 => 255838)


--- branches/safari-609.1.16-branch/Source/WebKit/Platform/spi/ios/RunningBoardServicesSPI.h	2020-02-05 19:37:08 UTC (rev 255837)
+++ branches/safari-609.1.16-branch/Source/WebKit/Platform/spi/ios/RunningBoardServicesSPI.h	2020-02-05 19:48:12 UTC (rev 255838)
@@ -1,51 +0,0 @@
-/*
- * Copyright (C) 2020 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#import <Foundation/Foundation.h>
-
-#if USE(APPLE_INTERNAL_SDK)
-
-#import <RunningBoardServices/RunningBoardServices.h>
-
-#else
-
-@interface RBSAttribute : NSObject
-@end
-
-@interface RBSDomainAttribute : RBSAttribute
-+ (instancetype)attributeWithDomain:(NSString *)domain name:(NSString *)name;
-@end
-
-@interface RBSTarget : NSObject
-+ (RBSTarget *)targetWithPid:(pid_t)pid;
-@end
-
-@interface RBSAssertion : NSObject
-- (instancetype)initWithExplanation:(NSString *)explanation target:(RBSTarget *)target attributes:(NSArray <RBSAttribute *> *)attributes;
-- (BOOL)acquireWithError:(NSError **)error;
-- (void)invalidate;
-@end
-
-#endif

Modified: branches/safari-609.1.16-branch/Source/WebKit/Scripts/process-entitlements.sh (255837 => 255838)


--- branches/safari-609.1.16-branch/Source/WebKit/Scripts/process-entitlements.sh	2020-02-05 19:37:08 UTC (rev 255837)
+++ branches/safari-609.1.16-branch/Source/WebKit/Scripts/process-entitlements.sh	2020-02-05 19:48:12 UTC (rev 255838)
@@ -111,7 +111,6 @@
     plistbuddy Add :com.apple.private.network.socket-delegate bool YES
     plistbuddy Add :com.apple.private.webinspector.allow-remote-inspection bool YES
     plistbuddy Add :com.apple.private.webinspector.proxy-application bool YES
-    plistbuddy Add :com.apple.runningboard.assertions.webkit bool YES
     plistbuddy Add :dynamic-codesigning bool YES
 
     plistbuddy Add :com.apple.tcc.delegated-services array

Deleted: branches/safari-609.1.16-branch/Source/WebKit/Shared/DependencyProcessAssertion.cpp (255837 => 255838)


--- branches/safari-609.1.16-branch/Source/WebKit/Shared/DependencyProcessAssertion.cpp	2020-02-05 19:37:08 UTC (rev 255837)
+++ branches/safari-609.1.16-branch/Source/WebKit/Shared/DependencyProcessAssertion.cpp	2020-02-05 19:48:12 UTC (rev 255838)
@@ -1,44 +0,0 @@
-/*
- * Copyright (C) 2020 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "DependencyProcessAssertion.h"
-
-#if !PLATFORM(IOS_FAMILY)
-
-namespace WebKit {
-
-DependencyProcessAssertion::DependencyProcessAssertion(ProcessID, ASCIILiteral description)
-{
-    UNUSED_PARAM(description);
-}
-
-DependencyProcessAssertion::~DependencyProcessAssertion()
-{
-}
-
-} // namespace WebKit
-
-#endif

Deleted: branches/safari-609.1.16-branch/Source/WebKit/Shared/DependencyProcessAssertion.h (255837 => 255838)


--- branches/safari-609.1.16-branch/Source/WebKit/Shared/DependencyProcessAssertion.h	2020-02-05 19:37:08 UTC (rev 255837)
+++ branches/safari-609.1.16-branch/Source/WebKit/Shared/DependencyProcessAssertion.h	2020-02-05 19:48:12 UTC (rev 255838)
@@ -1,50 +0,0 @@
-/*
- * Copyright (C) 2020 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#pragma once
-
-#include <wtf/ProcessID.h>
-#include <wtf/RetainPtr.h>
-#include <wtf/text/ASCIILiteral.h>
-
-#if PLATFORM(IOS_FAMILY)
-OBJC_CLASS RBSAssertion;
-#endif
-
-namespace WebKit {
-
-class DependencyProcessAssertion {
-    WTF_MAKE_FAST_ALLOCATED;
-public:
-    DependencyProcessAssertion(ProcessID targetPID, ASCIILiteral description);
-    ~DependencyProcessAssertion();
-
-private:
-#if PLATFORM(IOS_FAMILY)
-    RetainPtr<RBSAssertion> m_assertion;
-#endif
-};
-
-} // namespace WebKit

Modified: branches/safari-609.1.16-branch/Source/WebKit/Shared/NativeWebTouchEvent.h (255837 => 255838)


--- branches/safari-609.1.16-branch/Source/WebKit/Shared/NativeWebTouchEvent.h	2020-02-05 19:37:08 UTC (rev 255837)
+++ branches/safari-609.1.16-branch/Source/WebKit/Shared/NativeWebTouchEvent.h	2020-02-05 19:48:12 UTC (rev 255838)
@@ -27,14 +27,11 @@
 
 #include "WebEvent.h"
 
-#if PLATFORM(IOS_FAMILY) && defined(__OBJC__)
-#include <UIKit/UIKit.h>
-#endif
-
 #if ENABLE(TOUCH_EVENTS)
 
 #if PLATFORM(IOS_FAMILY)
 #if defined(__OBJC__)
+#include <UIKit/UIKit.h>
 struct _UIWebTouchEvent;
 #endif
 #elif PLATFORM(GTK)

Deleted: branches/safari-609.1.16-branch/Source/WebKit/Shared/ios/DependencyProcessAssertionIOS.mm (255837 => 255838)


--- branches/safari-609.1.16-branch/Source/WebKit/Shared/ios/DependencyProcessAssertionIOS.mm	2020-02-05 19:37:08 UTC (rev 255837)
+++ branches/safari-609.1.16-branch/Source/WebKit/Shared/ios/DependencyProcessAssertionIOS.mm	2020-02-05 19:48:12 UTC (rev 255838)
@@ -1,54 +0,0 @@
-/*
- * Copyright (C) 2020 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#import "config.h"
-#import "DependencyProcessAssertion.h"
-
-#if PLATFORM(IOS_FAMILY)
-
-#import "RunningBoardServicesSPI.h"
-
-namespace WebKit {
-
-DependencyProcessAssertion::DependencyProcessAssertion(ProcessID targetPID, ASCIILiteral description)
-{
-    RBSTarget *target = [RBSTarget targetWithPid:targetPID];
-    RBSDomainAttribute *domainAttribute = [RBSDomainAttribute attributeWithDomain:@"com.apple.webkit" name:@"DependentProcessLink"];
-    m_assertion = adoptNS([[RBSAssertion alloc] initWithExplanation:String { description } target:target attributes:@[domainAttribute]]);
-    NSError *acquisitionError = nil;
-    if (![m_assertion acquireWithError:&acquisitionError])
-        RELEASE_LOG_ERROR(Process, "DependencyProcessAssertion::DependencyProcessAssertion: Failed to acquire dependency process assertion '%{public}s', error: %{public}@", description.characters(), acquisitionError);
-    else
-        RELEASE_LOG(Process, "DependencyProcessAssertion::DependencyProcessAssertion: Successfully took a dependency process assertion '%{public}s' for target process with PID %d", description.characters(), targetPID);
-}
-
-DependencyProcessAssertion::~DependencyProcessAssertion()
-{
-    [m_assertion invalidate];
-}
-
-} // namespace WebKit
-
-#endif // PLATFORM(IOS_FAMILY)

Modified: branches/safari-609.1.16-branch/Source/WebKit/Sources.txt (255837 => 255838)


--- branches/safari-609.1.16-branch/Source/WebKit/Sources.txt	2020-02-05 19:37:08 UTC (rev 255837)
+++ branches/safari-609.1.16-branch/Source/WebKit/Sources.txt	2020-02-05 19:48:12 UTC (rev 255838)
@@ -134,7 +134,6 @@
 Shared/CacheModel.cpp
 Shared/ContextMenuContextData.cpp
 Shared/DebuggableInfoData.cpp
-Shared/DependencyProcessAssertion.cpp
 Shared/EditingRange.cpp
 Shared/EditorState.cpp
 Shared/FontInfo.cpp

Modified: branches/safari-609.1.16-branch/Source/WebKit/SourcesCocoa.txt (255837 => 255838)


--- branches/safari-609.1.16-branch/Source/WebKit/SourcesCocoa.txt	2020-02-05 19:37:08 UTC (rev 255837)
+++ branches/safari-609.1.16-branch/Source/WebKit/SourcesCocoa.txt	2020-02-05 19:48:12 UTC (rev 255838)
@@ -173,7 +173,6 @@
 Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm
 
 Shared/ios/AuxiliaryProcessIOS.mm
-Shared/ios/DependencyProcessAssertionIOS.mm
 Shared/ios/InteractionInformationAtPosition.mm
 Shared/ios/InteractionInformationRequest.cpp
 Shared/ios/NativeWebKeyboardEventIOS.mm

Modified: branches/safari-609.1.16-branch/Source/WebKit/UIProcess/Cocoa/WebProcessProxyCocoa.mm (255837 => 255838)


--- branches/safari-609.1.16-branch/Source/WebKit/UIProcess/Cocoa/WebProcessProxyCocoa.mm	2020-02-05 19:37:08 UTC (rev 255837)
+++ branches/safari-609.1.16-branch/Source/WebKit/UIProcess/Cocoa/WebProcessProxyCocoa.mm	2020-02-05 19:48:12 UTC (rev 255838)
@@ -190,4 +190,24 @@
 }
 #endif
 
+#if PLATFORM(IOS_FAMILY)
+void WebProcessProxy::processWasResumed(CompletionHandler<void()>&& completionHandler)
+{
+    CompletionHandlerCallingScope exitScope(WTFMove(completionHandler));
+
+    if (m_throttler.shouldBeRunnable()) {
+        // The process becoming unsuspended was not unexpected.
+        return;
+    }
+
+    // The WebProcess was awakened by something other than the UIProcess. Take out an assertion for a
+    // limited duration to allow whatever task needs to be accomplished time to complete.
+    RELEASE_LOG(ProcessSuspension, "%p - WebProcessProxy::processWasResumed() Process was unexpectedly resumed, starting background activity", this);
+    auto backgroundActivityTimeoutHandler = [activity = m_throttler.backgroundActivity("WebProcess was unexpectedly resumed"_s), weakThis = makeWeakPtr(this)] {
+        RELEASE_LOG(ProcessSuspension, "%p - WebProcessProxy::processWasResumed() - lambda, background activity timed out", weakThis.get());
+    };
+    m_unexpectedActivityTimer = makeUnique<WebCore::DeferrableOneShotTimer>(WTFMove(backgroundActivityTimeoutHandler), unexpectedActivityDuration);
 }
+#endif
+
+}

Modified: branches/safari-609.1.16-branch/Source/WebKit/UIProcess/WebProcessProxy.h (255837 => 255838)


--- branches/safari-609.1.16-branch/Source/WebKit/UIProcess/WebProcessProxy.h	2020-02-05 19:37:08 UTC (rev 255837)
+++ branches/safari-609.1.16-branch/Source/WebKit/UIProcess/WebProcessProxy.h	2020-02-05 19:48:12 UTC (rev 255838)
@@ -325,6 +325,10 @@
     void unblockAccessibilityServerIfNeeded();
 #endif
 
+#if PLATFORM(IOS_FAMILY)
+    void processWasResumed(CompletionHandler<void()>&&);
+#endif
+
     void webPageMediaStateDidChange(WebPageProxy&);
 
     void ref() final { ThreadSafeRefCounted::ref(); }
@@ -497,6 +501,7 @@
     BackgroundWebProcessToken m_backgroundToken;
 #if PLATFORM(IOS_FAMILY)
     bool m_hasSentMessageToUnblockAccessibilityServer { false };
+    std::unique_ptr<WebCore::DeferrableOneShotTimer> m_unexpectedActivityTimer;
 #endif
 
     HashMap<String, uint64_t> m_pageURLRetainCountMap;

Modified: branches/safari-609.1.16-branch/Source/WebKit/UIProcess/WebProcessProxy.messages.in (255837 => 255838)


--- branches/safari-609.1.16-branch/Source/WebKit/UIProcess/WebProcessProxy.messages.in	2020-02-05 19:37:08 UTC (rev 255837)
+++ branches/safari-609.1.16-branch/Source/WebKit/UIProcess/WebProcessProxy.messages.in	2020-02-05 19:48:12 UTC (rev 255838)
@@ -72,6 +72,10 @@
     StopDisplayLink(unsigned observerID, uint32_t displayID)
 #endif
 
+#if PLATFORM(IOS_FAMILY)
+    ProcessWasResumed() -> () Async
+#endif
+
     # Plug-in messages.
     void AddPlugInAutoStartOriginHash(String pageOrigin, uint32_t hash)
     void PlugInDidReceiveUserInteraction(uint32_t hash)

Modified: branches/safari-609.1.16-branch/Source/WebKit/WebKit.xcodeproj/project.pbxproj (255837 => 255838)


--- branches/safari-609.1.16-branch/Source/WebKit/WebKit.xcodeproj/project.pbxproj	2020-02-05 19:37:08 UTC (rev 255837)
+++ branches/safari-609.1.16-branch/Source/WebKit/WebKit.xcodeproj/project.pbxproj	2020-02-05 19:48:12 UTC (rev 255838)
@@ -956,9 +956,7 @@
 		46BEB6E322FBB21A00269867 /* TransientLocalStorageNamespace.h in Headers */ = {isa = PBXBuildFile; fileRef = 46BEB6E122FBB21A00269867 /* TransientLocalStorageNamespace.h */; };
 		46C392292316EC4D008EED9B /* WebPageProxyIdentifier.h in Headers */ = {isa = PBXBuildFile; fileRef = 46C392282316EC4D008EED9B /* WebPageProxyIdentifier.h */; };
 		46DF063C1F3905F8001980BB /* NetworkCORSPreflightChecker.h in Headers */ = {isa = PBXBuildFile; fileRef = 46DF063A1F3905E5001980BB /* NetworkCORSPreflightChecker.h */; };
-		46F77D8023BE63BE0090B5A7 /* DependencyProcessAssertion.h in Headers */ = {isa = PBXBuildFile; fileRef = 46F77D7E23BE63B10090B5A7 /* DependencyProcessAssertion.h */; };
 		46F9B26323526EF3006FE5FA /* WebBackForwardCacheEntry.h in Headers */ = {isa = PBXBuildFile; fileRef = 46F9B26223526ED0006FE5FA /* WebBackForwardCacheEntry.h */; };
-		46FDA8F723BE586900B198FA /* RunningBoardServicesSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 46FDA8F623BE585900B198FA /* RunningBoardServicesSPI.h */; };
 		49BCA19223A177660028A836 /* APIResourceLoadStatisticsFirstParty.h in Headers */ = {isa = PBXBuildFile; fileRef = 49BCA19123A177660028A836 /* APIResourceLoadStatisticsFirstParty.h */; };
 		49BCA19523A18CFD0028A836 /* _WKResourceLoadStatisticsFirstPartyInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 49BCA19023A175490028A836 /* _WKResourceLoadStatisticsFirstPartyInternal.h */; };
 		49BCA19723A1930D0028A836 /* APIResourceLoadStatisticsThirdParty.h in Headers */ = {isa = PBXBuildFile; fileRef = 49BCA19623A18F620028A836 /* APIResourceLoadStatisticsThirdParty.h */; };
@@ -3424,11 +3422,7 @@
 		46C392282316EC4D008EED9B /* WebPageProxyIdentifier.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebPageProxyIdentifier.h; sourceTree = "<group>"; };
 		46DF06391F3905E5001980BB /* NetworkCORSPreflightChecker.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NetworkCORSPreflightChecker.cpp; sourceTree = "<group>"; };
 		46DF063A1F3905E5001980BB /* NetworkCORSPreflightChecker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NetworkCORSPreflightChecker.h; sourceTree = "<group>"; };
-		46F77D7E23BE63B10090B5A7 /* DependencyProcessAssertion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DependencyProcessAssertion.h; sourceTree = "<group>"; };
-		46F77D7F23BE63B20090B5A7 /* DependencyProcessAssertion.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DependencyProcessAssertion.cpp; sourceTree = "<group>"; };
-		46F77D8123BE63DC0090B5A7 /* DependencyProcessAssertionIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = DependencyProcessAssertionIOS.mm; path = ios/DependencyProcessAssertionIOS.mm; sourceTree = "<group>"; };
 		46F9B26223526ED0006FE5FA /* WebBackForwardCacheEntry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebBackForwardCacheEntry.h; sourceTree = "<group>"; };
-		46FDA8F623BE585900B198FA /* RunningBoardServicesSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RunningBoardServicesSPI.h; sourceTree = "<group>"; };
 		49BCA19023A175490028A836 /* _WKResourceLoadStatisticsFirstPartyInternal.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = _WKResourceLoadStatisticsFirstPartyInternal.h; sourceTree = "<group>"; };
 		49BCA19123A177660028A836 /* APIResourceLoadStatisticsFirstParty.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = APIResourceLoadStatisticsFirstParty.h; sourceTree = "<group>"; };
 		49BCA19623A18F620028A836 /* APIResourceLoadStatisticsThirdParty.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = APIResourceLoadStatisticsThirdParty.h; sourceTree = "<group>"; };
@@ -5576,8 +5570,6 @@
 				99F642D21FABE378009621E9 /* CoordinateSystem.h */,
 				99036AE823A970870000B06A /* DebuggableInfoData.cpp */,
 				99036AE723A970870000B06A /* DebuggableInfoData.h */,
-				46F77D7F23BE63B20090B5A7 /* DependencyProcessAssertion.cpp */,
-				46F77D7E23BE63B10090B5A7 /* DependencyProcessAssertion.h */,
 				2D7FD190223C730F007887F1 /* DocumentEditingContext.h */,
 				2D7FD191223C7310007887F1 /* DocumentEditingContext.mm */,
 				C517388012DF8F4F00EE3F47 /* DragControllerAction.h */,
@@ -6463,7 +6455,6 @@
 			isa = PBXGroup;
 			children = (
 				A7E93CEB192531AA00A1DC48 /* AuxiliaryProcessIOS.mm */,
-				46F77D8123BE63DC0090B5A7 /* DependencyProcessAssertionIOS.mm */,
 				2DA6731920C754B1003CB401 /* DynamicViewportSizeUpdate.h */,
 				2DA9449D1884E4F000ED86DB /* GestureTypes.h */,
 				C5BCE5DA1C50761D00CDE3FA /* InteractionInformationAtPosition.h */,
@@ -9615,7 +9606,6 @@
 				A13B3DA1207F39DE0090C58D /* MobileWiFiSPI.h */,
 				3178AF9720E2A7F80074DE94 /* PDFKitSPI.h */,
 				2DC18FAF218912640025A88D /* PencilKitSPI.h */,
-				46FDA8F623BE585900B198FA /* RunningBoardServicesSPI.h */,
 				CE1A0BD01A48E6C60054EF74 /* TCCSPI.h */,
 				CE1A0BD11A48E6C60054EF74 /* TextInputSPI.h */,
 				CEE4AE2A1A5DCF430002F49B /* UIKitSPI.h */,
@@ -9984,7 +9974,6 @@
 				1AC75380183BE50F0072CB15 /* DataReference.h in Headers */,
 				99036AE923A970870000B06A /* DebuggableInfoData.h in Headers */,
 				BC032DA610F437D10058C15A /* Decoder.h in Headers */,
-				46F77D8023BE63BE0090B5A7 /* DependencyProcessAssertion.h in Headers */,
 				57DCEDAB214C60090016B847 /* DeviceIdentitySPI.h in Headers */,
 				07297F9F1C17BBEA015F0735 /* DeviceIdHashSaltStorage.h in Headers */,
 				2D0C56FD229F1DEA00BD33E7 /* DeviceManagementSoftLink.h in Headers */,
@@ -10281,7 +10270,6 @@
 				7AFBD36A21E542F1005DBACB /* ResourceLoadStatisticsPersistentStorage.h in Headers */,
 				1A30066E1110F4F70031937C /* ResponsivenessTimer.h in Headers */,
 				410482CE1DDD324F00F006D0 /* RTCNetwork.h in Headers */,
-				46FDA8F723BE586900B198FA /* RunningBoardServicesSPI.h in Headers */,
 				0E97D74D200E900400BF6643 /* SafeBrowsingSPI.h in Headers */,
 				5CA9854A210BEB640057EB6B /* SafeBrowsingWarning.h in Headers */,
 				BC2D021712AC41CB00E732A3 /* SameDocumentNavigationType.h in Headers */,

Modified: branches/safari-609.1.16-branch/Source/WebKit/WebProcess/WebProcess.cpp (255837 => 255838)


--- branches/safari-609.1.16-branch/Source/WebKit/WebProcess/WebProcess.cpp	2020-02-05 19:37:08 UTC (rev 255837)
+++ branches/safari-609.1.16-branch/Source/WebKit/WebProcess/WebProcess.cpp	2020-02-05 19:48:12 UTC (rev 255838)
@@ -31,7 +31,6 @@
 #include "APIPageHandle.h"
 #include "AuthenticationManager.h"
 #include "AuxiliaryProcessMessages.h"
-#include "DependencyProcessAssertion.h"
 #include "DrawingArea.h"
 #include "EventDispatcher.h"
 #include "InjectedBundle.h"
@@ -275,11 +274,7 @@
     m_eventDispatcher->initializeConnection(connection);
 #if PLATFORM(IOS_FAMILY)
     m_viewUpdateDispatcher->initializeConnection(connection);
-
-    ASSERT(!m_uiProcessDependencyProcessAssertion);
-    m_uiProcessDependencyProcessAssertion = makeUnique<DependencyProcessAssertion>(connection->remoteProcessID(), "WebContent process dependency on UIProcess"_s);
 #endif // PLATFORM(IOS_FAMILY)
-
     m_webInspectorInterruptDispatcher->initializeConnection(connection);
 
 #if ENABLE(NETSCAPE_PLUGIN_API)
@@ -290,6 +285,12 @@
         supplement->initializeConnection(connection);
 
     m_webConnection = WebConnectionToUIProcess::create(this);
+
+#if PLATFORM(IOS_FAMILY)
+    // Make sure we have an IPC::Connection before creating the ProcessTaskStateObserver since it may call
+    // WebProcess::processTaskStateDidChange() on a background thread and deference the IPC connection.
+    m_taskStateObserver = ProcessTaskStateObserver::create(*this);
+#endif
 }
 
 void WebProcess::initializeWebProcess(WebProcessCreationParameters&& parameters)

Modified: branches/safari-609.1.16-branch/Source/WebKit/WebProcess/WebProcess.h (255837 => 255838)


--- branches/safari-609.1.16-branch/Source/WebKit/WebProcess/WebProcess.h	2020-02-05 19:37:08 UTC (rev 255837)
+++ branches/safari-609.1.16-branch/Source/WebKit/WebProcess/WebProcess.h	2020-02-05 19:48:12 UTC (rev 255838)
@@ -65,6 +65,11 @@
 #include <wtf/MachSendRight.h>
 #endif
 
+#if PLATFORM(IOS_FAMILY)
+#include "ProcessTaskStateObserver.h"
+OBJC_CLASS BKSProcessAssertion;
+#endif
+
 #if PLATFORM(WAYLAND) && USE(WPE_RENDERER)
 #include <WebCore/PlatformDisplayLibWPE.h>
 #endif
@@ -100,7 +105,6 @@
 
 namespace WebKit {
 
-class DependencyProcessAssertion;
 class EventDispatcher;
 class GamepadData;
 class GPUProcessConnection;
@@ -136,7 +140,11 @@
 class LayerHostingContext;
 #endif
 
-class WebProcess : public AuxiliaryProcess
+class WebProcess
+    : public AuxiliaryProcess
+#if PLATFORM(IOS_FAMILY)
+    , ProcessTaskStateObserver::Client
+#endif
 {
     WTF_MAKE_FAST_ALLOCATED;
 public:
@@ -466,8 +474,11 @@
 #endif
 
 #if PLATFORM(IOS_FAMILY)
+    void processTaskStateDidChange(ProcessTaskStateObserver::TaskState) final;
     bool shouldFreezeOnSuspension() const;
     void updateFreezerStatus();
+
+    void releaseProcessWasResumedAssertions();
 #endif
 
 #if ENABLE(VIDEO)
@@ -554,7 +565,10 @@
 
 #if PLATFORM(IOS_FAMILY)
     WebSQLiteDatabaseTracker m_webSQLiteDatabaseTracker;
-    std::unique_ptr<DependencyProcessAssertion> m_uiProcessDependencyProcessAssertion;
+    RefPtr<ProcessTaskStateObserver> m_taskStateObserver;
+    Lock m_processWasResumedAssertionsLock;
+    RetainPtr<BKSProcessAssertion> m_processWasResumedUIAssertion;
+    RetainPtr<BKSProcessAssertion> m_processWasResumedOwnAssertion;
 #endif
 
     enum PageMarkingLayersAsVolatileCounterType { };

Modified: branches/safari-609.1.16-branch/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm (255837 => 255838)


--- branches/safari-609.1.16-branch/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm	2020-02-05 19:37:08 UTC (rev 255837)
+++ branches/safari-609.1.16-branch/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm	2020-02-05 19:48:12 UTC (rev 255838)
@@ -91,7 +91,6 @@
 #if PLATFORM(IOS_FAMILY)
 #import "AccessibilitySupportSPI.h"
 #import "AssertionServicesSPI.h"
-#import "RunningBoardServicesSPI.h"
 #import "UserInterfaceIdiom.h"
 #import "WKAccessibilityWebPageObjectIOS.h"
 #import <UIKit/UIAccessibility.h>
@@ -328,6 +327,61 @@
 }
 
 #if PLATFORM(IOS_FAMILY)
+void WebProcess::processTaskStateDidChange(ProcessTaskStateObserver::TaskState taskState)
+{
+    // NOTE: This will be called from a background thread.
+    RELEASE_LOG(ProcessSuspension, "%p - WebProcess::processTaskStateDidChange() - taskState(%d)", this, taskState);
+    if (taskState != ProcessTaskStateObserver::Running)
+        return;
+
+    LockHolder holder(m_processWasResumedAssertionsLock);
+    if (m_processWasResumedUIAssertion && m_processWasResumedOwnAssertion)
+        return;
+
+    // We were awakened from suspension unexpectedly. Notify the WebProcessProxy, but take a process assertion on our parent PID
+    // to ensure that it too is awakened.
+    RELEASE_LOG(ProcessSuspension, "%p - WebProcess::processTaskStateChanged() Taking 'WebProcess was resumed' assertion on behalf on UIProcess", this);
+    m_processWasResumedUIAssertion = adoptNS([[BKSProcessAssertion alloc] initWithPID:parentProcessConnection()->remoteProcessID() flags:BKSProcessAssertionPreventTaskSuspend reason:BKSProcessAssertionReasonFinishTask name:@"WebProcess was resumed" withHandler:^(BOOL acquired) {
+        if (!acquired)
+            RELEASE_LOG_ERROR(ProcessSuspension, "%p - WebProcess::processTaskStateDidChange() failed to take 'WebProcess was resumed' assertion for parent process", this);
+    }]);
+    m_processWasResumedUIAssertion.get().invalidationHandler = [this] {
+        RELEASE_LOG_ERROR(ProcessSuspension, "%p - WebProcess::processTaskStateChanged() Releasing 'WebProcess was resumed' assertion on behalf on UIProcess due to invalidation", this);
+        releaseProcessWasResumedAssertions();
+    };
+    m_processWasResumedOwnAssertion = adoptNS([[BKSProcessAssertion alloc] initWithPID:getpid() flags:BKSProcessAssertionPreventTaskSuspend reason:BKSProcessAssertionReasonFinishTask name:@"WebProcess was resumed" withHandler:^(BOOL acquired) {
+        if (!acquired)
+            RELEASE_LOG_ERROR(ProcessSuspension, "%p - WebProcess::processTaskStateDidChange() failed to take 'WebProcess was resumed' assertion for WebContent process", this);
+    }]);
+    m_processWasResumedOwnAssertion.get().invalidationHandler = [this] {
+        RELEASE_LOG_ERROR(ProcessSuspension, "%p - WebProcess::processTaskStateChanged() Releasing 'WebProcess was resumed' assertion on behalf on WebContent process due to invalidation", this);
+        releaseProcessWasResumedAssertions();
+    };
+
+    parentProcessConnection()->sendWithAsyncReply(Messages::WebProcessProxy::ProcessWasResumed(), [this] {
+        RELEASE_LOG(ProcessSuspension, "%p - WebProcess::processTaskStateDidChange() Parent process handled ProcessWasResumed IPC, releasing our assertions", this);
+        releaseProcessWasResumedAssertions();
+    });
+}
+
+void WebProcess::releaseProcessWasResumedAssertions()
+{
+    LockHolder holder(m_processWasResumedAssertionsLock);
+    if (m_processWasResumedUIAssertion) {
+        RELEASE_LOG(ProcessSuspension, "%p - WebProcess::releaseProcessWasResumedAssertions() Releasing parent process 'WebProcess was resumed' assertion", this);
+        [m_processWasResumedUIAssertion invalidate];
+        m_processWasResumedUIAssertion = nullptr;
+    }
+    if (m_processWasResumedOwnAssertion) {
+        RELEASE_LOG(ProcessSuspension, "%p - WebProcess::releaseProcessWasResumedAssertions() Releasing WebContent process 'WebProcess was resumed' assertion", this);
+        [m_processWasResumedOwnAssertion invalidate];
+        m_processWasResumedOwnAssertion = nullptr;
+    }
+}
+
+#endif
+
+#if PLATFORM(IOS_FAMILY)
 static NSString *webProcessLoaderAccessibilityBundlePath()
 {
     NSString *accessibilityBundlesPath = nil;

Modified: branches/safari-609.1.16-branch/WebKitLibraries/ChangeLog (255837 => 255838)


--- branches/safari-609.1.16-branch/WebKitLibraries/ChangeLog	2020-02-05 19:37:08 UTC (rev 255837)
+++ branches/safari-609.1.16-branch/WebKitLibraries/ChangeLog	2020-02-05 19:48:12 UTC (rev 255838)
@@ -1,3 +1,46 @@
+2020-02-05  Alan Coon  <alanc...@apple.com>
+
+        Cherry-pick r255189. rdar://problem/59196094
+
+    Unreviewed, revert r253984 as it appears to be causing assertion leaks.
+    https://bugs.webkit.org/show_bug.cgi?id=205687
+    
+    Source/WebKit:
+    
+    * Configurations/WebKit.xcconfig:
+    * Platform/spi/ios/RunningBoardServicesSPI.h: Removed.
+    * Scripts/process-entitlements.sh:
+    * Shared/DependencyProcessAssertion.cpp: Removed.
+    * Shared/DependencyProcessAssertion.h: Removed.
+    * Shared/NativeWebTouchEvent.h:
+    * Shared/ios/DependencyProcessAssertionIOS.mm: Removed.
+    * Sources.txt:
+    * SourcesCocoa.txt:
+    * UIProcess/Cocoa/WebProcessProxyCocoa.mm:
+    (WebKit::WebProcessProxy::processWasResumed):
+    * UIProcess/WebProcessProxy.h:
+    * UIProcess/WebProcessProxy.messages.in:
+    * WebKit.xcodeproj/project.pbxproj:
+    * WebProcess/WebProcess.cpp:
+    (WebKit::WebProcess::initializeConnection):
+    * WebProcess/WebProcess.h:
+    * WebProcess/cocoa/WebProcessCocoa.mm:
+    (WebKit::WebProcess::processTaskStateDidChange):
+    (WebKit::WebProcess::releaseProcessWasResumedAssertions):
+    
+    WebKitLibraries:
+    
+    * WebKitPrivateFrameworkStubs/iOS/13/RunningBoardServices.framework/RunningBoardServices.tbd: Removed.
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@255189 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2020-01-27  Chris Dumez  <cdu...@apple.com>
+
+            Unreviewed, revert r253984 as it appears to be causing assertion leaks.
+            https://bugs.webkit.org/show_bug.cgi?id=205687
+
+            * WebKitPrivateFrameworkStubs/iOS/13/RunningBoardServices.framework/RunningBoardServices.tbd: Removed.
+
 2019-12-22  Jeff Miller  <je...@apple.com>
 
         Update user-visible copyright strings to include 2020

Deleted: branches/safari-609.1.16-branch/WebKitLibraries/WebKitPrivateFrameworkStubs/iOS/13/RunningBoardServices.framework/RunningBoardServices.tbd (255837 => 255838)


--- branches/safari-609.1.16-branch/WebKitLibraries/WebKitPrivateFrameworkStubs/iOS/13/RunningBoardServices.framework/RunningBoardServices.tbd	2020-02-05 19:37:08 UTC (rev 255837)
+++ branches/safari-609.1.16-branch/WebKitLibraries/WebKitPrivateFrameworkStubs/iOS/13/RunningBoardServices.framework/RunningBoardServices.tbd	2020-02-05 19:48:12 UTC (rev 255838)
@@ -1,9 +0,0 @@
---- !tapi-tbd-v3
-archs:           [ x86_64, arm64, arm64e ]
-install-name:    '/System/Library/PrivateFrameworks/RunningBoardServices.framework/RunningBoardServices'
-objc-constraint: none
-platform: ios
-exports:
-  - archs:           [ x86_64, arm64, arm64e ]
-    objc-classes:    [ RBSAttribute, RBSDomainAttribute, RBSTarget, RBSAssertion ]
-...
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to