Unreviewed, revert r253984 as it appears to be causing assertion leaks.
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 27 Jan 2020 23:37:49 +0000 (23:37 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 27 Jan 2020 23:37:49 +0000 (23:37 +0000)
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

19 files changed:
Source/WebKit/ChangeLog
Source/WebKit/Configurations/WebKit.xcconfig
Source/WebKit/Platform/spi/ios/RunningBoardServicesSPI.h [deleted file]
Source/WebKit/Scripts/process-entitlements.sh
Source/WebKit/Shared/DependencyProcessAssertion.cpp [deleted file]
Source/WebKit/Shared/DependencyProcessAssertion.h [deleted file]
Source/WebKit/Shared/NativeWebTouchEvent.h
Source/WebKit/Shared/ios/DependencyProcessAssertionIOS.mm [deleted file]
Source/WebKit/Sources.txt
Source/WebKit/SourcesCocoa.txt
Source/WebKit/UIProcess/Cocoa/WebProcessProxyCocoa.mm
Source/WebKit/UIProcess/WebProcessProxy.h
Source/WebKit/UIProcess/WebProcessProxy.messages.in
Source/WebKit/WebKit.xcodeproj/project.pbxproj
Source/WebKit/WebProcess/WebProcess.cpp
Source/WebKit/WebProcess/WebProcess.h
Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm
WebKitLibraries/ChangeLog
WebKitLibraries/WebKitPrivateFrameworkStubs/iOS/13/RunningBoardServices.framework/RunningBoardServices.tbd [deleted file]

index d1a58f1..77637b7 100644 (file)
@@ -1,3 +1,29 @@
+2020-01-27  Chris Dumez  <cdumez@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-27  Jiewen Tan  <jiewen_tan@apple.com>
 
         Unreviewed, a build fix after r255111
index 0ed92e3..5cfe2e8 100644 (file)
@@ -51,9 +51,6 @@ 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_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;
 
@@ -126,7 +123,7 @@ WK_AUTHKIT_LDFLAGS_IOS_SINCE_13 = -framework AuthKit;
 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_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_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__18functionIFvN7WebCore12PolicyActionEEED1Ev -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_traitsIcEENS_9allocatorIcEEEE8_NS_13basic_ostreamIcS2_EE;
diff --git a/Source/WebKit/Platform/spi/ios/RunningBoardServicesSPI.h b/Source/WebKit/Platform/spi/ios/RunningBoardServicesSPI.h
deleted file mode 100644 (file)
index 97e0cb1..0000000
+++ /dev/null
@@ -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
index 98fb5a5..61a4625 100755 (executable)
@@ -109,7 +109,6 @@ function ios_family_process_webcontent_entitlements()
     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
diff --git a/Source/WebKit/Shared/DependencyProcessAssertion.cpp b/Source/WebKit/Shared/DependencyProcessAssertion.cpp
deleted file mode 100644 (file)
index e5d5251..0000000
+++ /dev/null
@@ -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
diff --git a/Source/WebKit/Shared/DependencyProcessAssertion.h b/Source/WebKit/Shared/DependencyProcessAssertion.h
deleted file mode 100644 (file)
index aa01aa5..0000000
+++ /dev/null
@@ -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
index f5d72f8..3910a48 100644 (file)
 
 #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)
diff --git a/Source/WebKit/Shared/ios/DependencyProcessAssertionIOS.mm b/Source/WebKit/Shared/ios/DependencyProcessAssertionIOS.mm
deleted file mode 100644 (file)
index 3f5db8f..0000000
+++ /dev/null
@@ -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)
index 3da2800..1a16b1f 100644 (file)
@@ -142,7 +142,6 @@ Shared/BlobDataFileReferenceWithSandboxExtension.cpp @no-unify
 Shared/CacheModel.cpp
 Shared/ContextMenuContextData.cpp
 Shared/DebuggableInfoData.cpp
-Shared/DependencyProcessAssertion.cpp
 Shared/EditingRange.cpp
 Shared/EditorState.cpp
 Shared/FontInfo.cpp
index 6a8e2e6..494daa4 100644 (file)
@@ -173,7 +173,6 @@ Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceEntryPoint.mm
 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
index 609936d..f60d630 100644 (file)
@@ -190,4 +190,24 @@ void WebProcessProxy::releaseHighPerformanceGPU()
 }
 #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
+
 }
index 629f480..132dfb3 100644 (file)
@@ -328,6 +328,10 @@ public:
     void unblockAccessibilityServerIfNeeded();
 #endif
 
+#if PLATFORM(IOS_FAMILY)
+    void processWasResumed(CompletionHandler<void()>&&);
+#endif
+
     void webPageMediaStateDidChange(WebPageProxy&);
 
     void ref() final { ThreadSafeRefCounted::ref(); }
@@ -502,6 +506,7 @@ private:
     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;
index 6e1a4c4..3981cbb 100644 (file)
@@ -72,6 +72,10 @@ messages -> WebProcessProxy LegacyReceiver {
     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)
index 4e65fa3..9fcb86d 100644 (file)
                46C392292316EC4D008EED9B /* WebPageProxyIdentifier.h in Headers */ = {isa = PBXBuildFile; fileRef = 46C392282316EC4D008EED9B /* WebPageProxyIdentifier.h */; };
                46CE3B1123D8C8490016A96A /* WebBackForwardListCounts.h in Headers */ = {isa = PBXBuildFile; fileRef = 46CE3B1023D8C83D0016A96A /* WebBackForwardListCounts.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 */; };
                4960A3BD23C52AFD00961842 /* WebViewCategory.h in Headers */ = {isa = PBXBuildFile; fileRef = 4960A3BC23C5286400961842 /* WebViewCategory.h */; };
                49BCA19223A177660028A836 /* APIResourceLoadStatisticsFirstParty.h in Headers */ = {isa = PBXBuildFile; fileRef = 49BCA19123A177660028A836 /* APIResourceLoadStatisticsFirstParty.h */; };
                49BCA19523A18CFD0028A836 /* _WKResourceLoadStatisticsFirstPartyInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 49BCA19023A175490028A836 /* _WKResourceLoadStatisticsFirstPartyInternal.h */; };
                46CE3B1023D8C83D0016A96A /* WebBackForwardListCounts.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebBackForwardListCounts.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>"; };
                4960A3BC23C5286400961842 /* WebViewCategory.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebViewCategory.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>"; };
                                99F642D21FABE378009621E9 /* CoordinateSystem.h */,
                                99036AE823A970870000B06A /* DebuggableInfoData.cpp */,
                                99036AE723A970870000B06A /* DebuggableInfoData.h */,
-                               46F77D7F23BE63B20090B5A7 /* DependencyProcessAssertion.cpp */,
-                               46F77D7E23BE63B10090B5A7 /* DependencyProcessAssertion.h */,
                                2D7FD190223C730F007887F1 /* DocumentEditingContext.h */,
                                2D7FD191223C7310007887F1 /* DocumentEditingContext.mm */,
                                C517388012DF8F4F00EE3F47 /* DragControllerAction.h */,
                        isa = PBXGroup;
                        children = (
                                A7E93CEB192531AA00A1DC48 /* AuxiliaryProcessIOS.mm */,
-                               46F77D8123BE63DC0090B5A7 /* DependencyProcessAssertionIOS.mm */,
                                2DA6731920C754B1003CB401 /* DynamicViewportSizeUpdate.h */,
                                2DA9449D1884E4F000ED86DB /* GestureTypes.h */,
                                C5BCE5DA1C50761D00CDE3FA /* InteractionInformationAtPosition.h */,
                                A13B3DA1207F39DE0090C58D /* MobileWiFiSPI.h */,
                                3178AF9720E2A7F80074DE94 /* PDFKitSPI.h */,
                                2DC18FAF218912640025A88D /* PencilKitSPI.h */,
-                               46FDA8F623BE585900B198FA /* RunningBoardServicesSPI.h */,
                                CE1A0BD01A48E6C60054EF74 /* TCCSPI.h */,
                                CE1A0BD11A48E6C60054EF74 /* TextInputSPI.h */,
                                CEE4AE2A1A5DCF430002F49B /* UIKitSPI.h */,
                                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 */,
                                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 */,
index fee9548..67a790a 100644 (file)
@@ -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 @@ void WebProcess::initializeConnection(IPC::Connection* connection)
     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 @@ void WebProcess::initializeConnection(IPC::Connection* connection)
         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)
index 6bb0940..493b2b7 100644 (file)
 #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
@@ -101,7 +106,6 @@ struct ServiceWorkerContextData;
 
 namespace WebKit {
 
-class DependencyProcessAssertion;
 class EventDispatcher;
 class GamepadData;
 class GPUProcessConnection;
@@ -137,7 +141,11 @@ struct WebsiteDataStoreParameters;
 class LayerHostingContext;
 #endif
 
-class WebProcess : public AuxiliaryProcess
+class WebProcess
+    : public AuxiliaryProcess
+#if PLATFORM(IOS_FAMILY)
+    , ProcessTaskStateObserver::Client
+#endif
 {
     WTF_MAKE_FAST_ALLOCATED;
 public:
@@ -480,8 +488,11 @@ private:
 #endif
 
 #if PLATFORM(IOS_FAMILY)
+    void processTaskStateDidChange(ProcessTaskStateObserver::TaskState) final;
     bool shouldFreezeOnSuspension() const;
     void updateFreezerStatus();
+
+    void releaseProcessWasResumedAssertions();
 #endif
 
 #if ENABLE(VIDEO)
@@ -568,7 +579,10 @@ private:
 
 #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 { };
index 9d49fa2..98dbd4e 100644 (file)
@@ -92,7 +92,6 @@
 #if PLATFORM(IOS_FAMILY)
 #import "AccessibilitySupportSPI.h"
 #import "AssertionServicesSPI.h"
-#import "RunningBoardServicesSPI.h"
 #import "UserInterfaceIdiom.h"
 #import "WKAccessibilityWebPageObjectIOS.h"
 #import <UIKit/UIAccessibility.h>
@@ -341,6 +340,61 @@ void WebProcess::updateProcessName()
 }
 
 #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;
index a1d5a95..b1ce9aa 100644 (file)
@@ -1,3 +1,10 @@
+2020-01-27  Chris Dumez  <cdumez@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.
+
 2020-01-10  Jonathan Bedard  <jbedard@apple.com>
 
         WebKitLibraries: Remove old private framework stubs
diff --git a/WebKitLibraries/WebKitPrivateFrameworkStubs/iOS/13/RunningBoardServices.framework/RunningBoardServices.tbd b/WebKitLibraries/WebKitPrivateFrameworkStubs/iOS/13/RunningBoardServices.framework/RunningBoardServices.tbd
deleted file mode 100644 (file)
index 2cb7ffc..0000000
+++ /dev/null
@@ -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 ]
-...