| Differences between
and this patch
- a/Source/WebKit/ChangeLog +34 lines
Lines 1-3 a/Source/WebKit/ChangeLog_sec1
1
2020-01-02  Chris Dumez  <cdumez@apple.com>
2
3
        [iOS] Replace "unexpectedly resumed" observer with RunningBoard suspendible assertions
4
        https://bugs.webkit.org/show_bug.cgi?id=205687
5
        <rdar://problem/57890246>
6
7
        Reviewed by NOBODY (OOPS!).
8
9
        Adopt new RunningBoard process assertion to indicate that WebContent processes depend on their
10
        UIProcess (and therefore, the UIProcess must be running if the WebContent process is). This
11
        replaces our "Unexpectedly resumed" assertion which was causing unexpected terminations in some
12
        cases.
13
14
        * Configurations/WebKit.xcconfig:
15
        * Platform/spi/ios/RunningBoardServicesSPI.h: Added.
16
        * Scripts/process-entitlements.sh:
17
        * Shared/DependencyProcessAssertion.cpp: Added.
18
        (WebKit::DependencyProcessAssertion::DependencyProcessAssertion):
19
        (WebKit::DependencyProcessAssertion::~DependencyProcessAssertion):
20
        * Shared/DependencyProcessAssertion.h: Added.
21
        * Shared/ios/DependencyProcessAssertionIOS.mm: Added.
22
        (WebKit::DependencyProcessAssertion::DependencyProcessAssertion):
23
        (WebKit::DependencyProcessAssertion::~DependencyProcessAssertion):
24
        * Sources.txt:
25
        * SourcesCocoa.txt:
26
        * UIProcess/Cocoa/WebProcessProxyCocoa.mm:
27
        * UIProcess/WebProcessProxy.h:
28
        * UIProcess/WebProcessProxy.messages.in:
29
        * WebKit.xcodeproj/project.pbxproj:
30
        * WebProcess/WebProcess.cpp:
31
        (WebKit::WebProcess::initializeConnection):
32
        * WebProcess/WebProcess.h:
33
        * WebProcess/cocoa/WebProcessCocoa.mm:
34
1
2020-01-02  Carlos Garcia Campos  <cgarcia@igalia.com>
35
2020-01-02  Carlos Garcia Campos  <cgarcia@igalia.com>
2
36
3
        [GTK] Make ondemand hardware acceleration policy never leave AC mode
37
        [GTK] Make ondemand hardware acceleration policy never leave AC mode
- a/Source/WebKit/Configurations/WebKit.xcconfig -1 / +4 lines
Lines 51-56 WK_APPKIT_LDFLAGS_maccatalyst = -framework AppKit; a/Source/WebKit/Configurations/WebKit.xcconfig_sec1
51
WK_ASSERTION_SERVICES_LDFLAGS = $(WK_ASSERTION_SERVICES_LDFLAGS_$(WK_COCOA_TOUCH));
51
WK_ASSERTION_SERVICES_LDFLAGS = $(WK_ASSERTION_SERVICES_LDFLAGS_$(WK_COCOA_TOUCH));
52
WK_ASSERTION_SERVICES_LDFLAGS_cocoatouch = -framework AssertionServices;
52
WK_ASSERTION_SERVICES_LDFLAGS_cocoatouch = -framework AssertionServices;
53
53
54
WK_RUNNINGBOARD_SERVICES_LDFLAGS = $(WK_RUNNINGBOARD_SERVICES_LDFLAGS_$(WK_COCOA_TOUCH));
55
WK_RUNNINGBOARD_SERVICES_LDFLAGS_cocoatouch = -framework RunningBoardServices;
56
54
WK_CARBON_LDFLAGS = $(WK_CARBON_LDFLAGS_$(WK_PLATFORM_NAME));
57
WK_CARBON_LDFLAGS = $(WK_CARBON_LDFLAGS_$(WK_PLATFORM_NAME));
55
WK_CARBON_LDFLAGS_macosx = -framework Carbon;
58
WK_CARBON_LDFLAGS_macosx = -framework Carbon;
56
59
Lines 127-133 WK_AUTHKIT_LDFLAGS_IOS_SINCE_13 = -framework AuthKit; a/Source/WebKit/Configurations/WebKit.xcconfig_sec2
127
WK_AUTHKIT_LDFLAGS_macosx = $(WK_AUTHKIT_LDFLAGS$(WK_MACOS_1015));
130
WK_AUTHKIT_LDFLAGS_macosx = $(WK_AUTHKIT_LDFLAGS$(WK_MACOS_1015));
128
WK_AUTHKIT_LDFLAGS_MACOS_SINCE_1015 = -framework AuthKit;
131
WK_AUTHKIT_LDFLAGS_MACOS_SINCE_1015 = -framework AuthKit;
129
132
130
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);
133
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);
131
134
132
// Prevent C++ standard library basic_stringstream, operator new, delete and their related exception types from being exported as weak symbols.
135
// Prevent C++ standard library basic_stringstream, operator new, delete and their related exception types from being exported as weak symbols.
133
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;
136
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;
- a/Source/WebKit/Platform/spi/ios/RunningBoardServicesSPI.h +51 lines
Line 0 a/Source/WebKit/Platform/spi/ios/RunningBoardServicesSPI.h_sec1
1
/*
2
 * Copyright (C) 2020 Apple Inc. All rights reserved.
3
 *
4
 * Redistribution and use in source and binary forms, with or without
5
 * modification, are permitted provided that the following conditions
6
 * are met:
7
 * 1. Redistributions of source code must retain the above copyright
8
 *    notice, this list of conditions and the following disclaimer.
9
 * 2. Redistributions in binary form must reproduce the above copyright
10
 *    notice, this list of conditions and the following disclaimer in the
11
 *    documentation and/or other materials provided with the distribution.
12
 *
13
 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
14
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
17
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21
 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
25
26
#import <Foundation/Foundation.h>
27
28
#if USE(APPLE_INTERNAL_SDK)
29
30
#import <RunningBoardServices/RunningBoardServices.h>
31
32
#else
33
34
@interface RBSAttribute : NSObject
35
@end
36
37
@interface RBSDomainAttribute : RBSAttribute
38
+ (instancetype)attributeWithDomain:(NSString *)domain name:(NSString *)name;
39
@end
40
41
@interface RBSTarget : NSObject
42
+ (RBSTarget *)targetWithPid:(pid_t)pid;
43
@end
44
45
@interface RBSAssertion : NSObject
46
- (instancetype)initWithExplanation:(NSString *)explanation target:(RBSTarget *)target attributes:(NSArray <RBSAttribute *> *)attributes;
47
- (BOOL)acquireWithError:(out NSError * _Nullable * _Nullable)error;
48
- (void)invalidate;
49
@end
50
51
#endif
- a/Source/WebKit/Scripts/process-entitlements.sh +1 lines
Lines 110-115 function ios_family_process_webcontent_entitlements() a/Source/WebKit/Scripts/process-entitlements.sh_sec1
110
    plistbuddy Add :com.apple.private.network.socket-delegate bool YES
110
    plistbuddy Add :com.apple.private.network.socket-delegate bool YES
111
    plistbuddy Add :com.apple.private.webinspector.allow-remote-inspection bool YES
111
    plistbuddy Add :com.apple.private.webinspector.allow-remote-inspection bool YES
112
    plistbuddy Add :com.apple.private.webinspector.proxy-application bool YES
112
    plistbuddy Add :com.apple.private.webinspector.proxy-application bool YES
113
    plistbuddy Add :com.apple.runningboard.assertions.webkit bool YES
113
    plistbuddy Add :dynamic-codesigning bool YES
114
    plistbuddy Add :dynamic-codesigning bool YES
114
115
115
    plistbuddy Add :com.apple.tcc.delegated-services array
116
    plistbuddy Add :com.apple.tcc.delegated-services array
- a/Source/WebKit/Shared/DependencyProcessAssertion.cpp +44 lines
Line 0 a/Source/WebKit/Shared/DependencyProcessAssertion.cpp_sec1
1
/*
2
 * Copyright (C) 2020 Apple Inc. All rights reserved.
3
 *
4
 * Redistribution and use in source and binary forms, with or without
5
 * modification, are permitted provided that the following conditions
6
 * are met:
7
 * 1. Redistributions of source code must retain the above copyright
8
 *    notice, this list of conditions and the following disclaimer.
9
 * 2. Redistributions in binary form must reproduce the above copyright
10
 *    notice, this list of conditions and the following disclaimer in the
11
 *    documentation and/or other materials provided with the distribution.
12
 *
13
 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16
 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17
 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23
 * THE POSSIBILITY OF SUCH DAMAGE.
24
 */
25
26
#include "config.h"
27
#include "DependencyProcessAssertion.h"
28
29
#if !PLATFORM(IOS_FAMILY)
30
31
namespace WebKit {
32
33
DependencyProcessAssertion::DependencyProcessAssertion(ProcessID, ASCIILiteral description)
34
{
35
    UNUSED_PARAM(description);
36
}
37
38
DependencyProcessAssertion::~DependencyProcessAssertion()
39
{
40
}
41
42
} // namespace WebKit
43
44
#endif
- a/Source/WebKit/Shared/DependencyProcessAssertion.h +50 lines
Line 0 a/Source/WebKit/Shared/DependencyProcessAssertion.h_sec1
1
/*
2
 * Copyright (C) 2020 Apple Inc. All rights reserved.
3
 *
4
 * Redistribution and use in source and binary forms, with or without
5
 * modification, are permitted provided that the following conditions
6
 * are met:
7
 * 1. Redistributions of source code must retain the above copyright
8
 *    notice, this list of conditions and the following disclaimer.
9
 * 2. Redistributions in binary form must reproduce the above copyright
10
 *    notice, this list of conditions and the following disclaimer in the
11
 *    documentation and/or other materials provided with the distribution.
12
 *
13
 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16
 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17
 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23
 * THE POSSIBILITY OF SUCH DAMAGE.
24
 */
25
26
#pragma once
27
28
#include <wtf/ProcessID.h>
29
#include <wtf/RetainPtr.h>
30
#include <wtf/text/ASCIILiteral.h>
31
32
#if PLATFORM(IOS_FAMILY)
33
OBJC_CLASS RBSAssertion;
34
#endif
35
36
namespace WebKit {
37
38
class DependencyProcessAssertion {
39
    WTF_MAKE_FAST_ALLOCATED;
40
public:
41
    DependencyProcessAssertion(ProcessID targetPID, ASCIILiteral description);
42
    ~DependencyProcessAssertion();
43
44
private:
45
#if PLATFORM(IOS_FAMILY)
46
    RetainPtr<RBSAssertion> m_assertion;
47
#endif
48
};
49
50
} // namespace WebKit
- a/Source/WebKit/Shared/NativeWebTouchEvent.h +1 lines
Lines 26-31 a/Source/WebKit/Shared/NativeWebTouchEvent.h_sec1
26
#pragma once
26
#pragma once
27
27
28
#include "WebEvent.h"
28
#include "WebEvent.h"
29
#include <pal/spi/ios/UIKitSPI.h>
29
30
30
#if ENABLE(TOUCH_EVENTS)
31
#if ENABLE(TOUCH_EVENTS)
31
32
- a/Source/WebKit/Shared/ios/DependencyProcessAssertionIOS.mm +55 lines
Line 0 a/Source/WebKit/Shared/ios/DependencyProcessAssertionIOS.mm_sec1
1
/*
2
 * Copyright (C) 2020 Apple Inc. All rights reserved.
3
 *
4
 * Redistribution and use in source and binary forms, with or without
5
 * modification, are permitted provided that the following conditions
6
 * are met:
7
 * 1. Redistributions of source code must retain the above copyright
8
 *    notice, this list of conditions and the following disclaimer.
9
 * 2. Redistributions in binary form must reproduce the above copyright
10
 *    notice, this list of conditions and the following disclaimer in the
11
 *    documentation and/or other materials provided with the distribution.
12
 *
13
 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16
 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17
 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23
 * THE POSSIBILITY OF SUCH DAMAGE.
24
 */
25
26
#import "config.h"
27
#import "DependencyProcessAssertion.h"
28
29
#if PLATFORM(IOS_FAMILY)
30
31
#import "RunningBoardServicesSPI.h"
32
33
namespace WebKit {
34
35
DependencyProcessAssertion::DependencyProcessAssertion(ProcessID targetPID, ASCIILiteral description)
36
{
37
    RBSTarget *target = [RBSTarget targetWithPid:targetPID];
38
    RBSDomainAttribute *domainAttribute = [RBSDomainAttribute attributeWithDomain: @"com.apple.webkit" name:@"DependentProcessLink"];
39
    m_assertion = adoptNS([[RBSAssertion alloc] initWithExplanation:String { description } target:target attributes:@[domainAttribute]]);
40
    NSError *acquisitionError = nil;
41
    if (![m_assertion acquireWithError:&acquisitionError]) {
42
        RELEASE_LOG_ERROR(Process, "DependencyProcessAssertion::DependencyProcessAssertion: Failed to acquire dependency process assertion '%{public}s', error: %{public}@", description.characters(), acquisitionError);
43
        ASSERT_NOT_REACHED();
44
    } else
45
        RELEASE_LOG(Process, "DependencyProcessAssertion::DependencyProcessAssertion: Successfully took a dependency process assertion '%{public}s' for target process with PID %d", description.characters(), targetPID);
46
}
47
48
DependencyProcessAssertion::~DependencyProcessAssertion()
49
{
50
    [m_assertion invalidate];
51
}
52
53
} // namespace WebKit
54
55
#endif // PLATFORM(IOS_FAMILY)
- a/Source/WebKit/Sources.txt +1 lines
Lines 134-139 Shared/BlobDataFileReferenceWithSandboxExtension.cpp @no-unify a/Source/WebKit/Sources.txt_sec1
134
Shared/CacheModel.cpp
134
Shared/CacheModel.cpp
135
Shared/ContextMenuContextData.cpp
135
Shared/ContextMenuContextData.cpp
136
Shared/DebuggableInfoData.cpp
136
Shared/DebuggableInfoData.cpp
137
Shared/DependencyProcessAssertion.cpp
137
Shared/EditingRange.cpp
138
Shared/EditingRange.cpp
138
Shared/EditorState.cpp
139
Shared/EditorState.cpp
139
Shared/FontInfo.cpp
140
Shared/FontInfo.cpp
- a/Source/WebKit/SourcesCocoa.txt +1 lines
Lines 173-178 Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceEntryPoint.mm a/Source/WebKit/SourcesCocoa.txt_sec1
173
Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm
173
Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm
174
174
175
Shared/ios/AuxiliaryProcessIOS.mm
175
Shared/ios/AuxiliaryProcessIOS.mm
176
Shared/ios/DependencyProcessAssertionIOS.mm
176
Shared/ios/InteractionInformationAtPosition.mm
177
Shared/ios/InteractionInformationAtPosition.mm
177
Shared/ios/InteractionInformationRequest.cpp
178
Shared/ios/InteractionInformationRequest.cpp
178
Shared/ios/NativeWebKeyboardEventIOS.mm
179
Shared/ios/NativeWebKeyboardEventIOS.mm
- a/Source/WebKit/UIProcess/Cocoa/WebProcessProxyCocoa.mm -20 lines
Lines 190-213 void WebProcessProxy::releaseHighPerformanceGPU() a/Source/WebKit/UIProcess/Cocoa/WebProcessProxyCocoa.mm_sec1
190
}
190
}
191
#endif
191
#endif
192
192
193
#if PLATFORM(IOS_FAMILY)
194
void WebProcessProxy::processWasResumed(CompletionHandler<void()>&& completionHandler)
195
{
196
    CompletionHandlerCallingScope exitScope(WTFMove(completionHandler));
197
198
    if (m_throttler.shouldBeRunnable()) {
199
        // The process becoming unsuspended was not unexpected.
200
        return;
201
    }
202
203
    // The WebProcess was awakened by something other than the UIProcess. Take out an assertion for a
204
    // limited duration to allow whatever task needs to be accomplished time to complete.
205
    RELEASE_LOG(ProcessSuspension, "%p - WebProcessProxy::processWasResumed() Process was unexpectedly resumed, starting background activity", this);
206
    auto backgroundActivityTimeoutHandler = [activity = m_throttler.backgroundActivity("WebProcess was unexpectedly resumed"_s), weakThis = makeWeakPtr(this)] {
207
        RELEASE_LOG(ProcessSuspension, "%p - WebProcessProxy::processWasResumed() - lambda, background activity timed out", weakThis.get());
208
    };
209
    m_unexpectedActivityTimer = makeUnique<WebCore::DeferrableOneShotTimer>(WTFMove(backgroundActivityTimeoutHandler), unexpectedActivityDuration);
210
}
211
#endif
212
213
}
193
}
- a/Source/WebKit/UIProcess/WebProcessProxy.h -5 lines
Lines 325-334 public: a/Source/WebKit/UIProcess/WebProcessProxy.h_sec1
325
    void unblockAccessibilityServerIfNeeded();
325
    void unblockAccessibilityServerIfNeeded();
326
#endif
326
#endif
327
327
328
#if PLATFORM(IOS_FAMILY)
329
    void processWasResumed(CompletionHandler<void()>&&);
330
#endif
331
332
    void webPageMediaStateDidChange(WebPageProxy&);
328
    void webPageMediaStateDidChange(WebPageProxy&);
333
329
334
    void ref() final { ThreadSafeRefCounted::ref(); }
330
    void ref() final { ThreadSafeRefCounted::ref(); }
Lines 501-507 private: a/Source/WebKit/UIProcess/WebProcessProxy.h_sec2
501
    BackgroundWebProcessToken m_backgroundToken;
497
    BackgroundWebProcessToken m_backgroundToken;
502
#if PLATFORM(IOS_FAMILY)
498
#if PLATFORM(IOS_FAMILY)
503
    bool m_hasSentMessageToUnblockAccessibilityServer { false };
499
    bool m_hasSentMessageToUnblockAccessibilityServer { false };
504
    std::unique_ptr<WebCore::DeferrableOneShotTimer> m_unexpectedActivityTimer;
505
#endif
500
#endif
506
501
507
    HashMap<String, uint64_t> m_pageURLRetainCountMap;
502
    HashMap<String, uint64_t> m_pageURLRetainCountMap;
- a/Source/WebKit/UIProcess/WebProcessProxy.messages.in -4 lines
Lines 72-81 messages -> WebProcessProxy LegacyReceiver { a/Source/WebKit/UIProcess/WebProcessProxy.messages.in_sec1
72
    StopDisplayLink(unsigned observerID, uint32_t displayID)
72
    StopDisplayLink(unsigned observerID, uint32_t displayID)
73
#endif
73
#endif
74
74
75
#if PLATFORM(IOS_FAMILY)
76
    ProcessWasResumed() -> () Async
77
#endif
78
79
    # Plug-in messages.
75
    # Plug-in messages.
80
    void AddPlugInAutoStartOriginHash(String pageOrigin, uint32_t hash)
76
    void AddPlugInAutoStartOriginHash(String pageOrigin, uint32_t hash)
81
    void PlugInDidReceiveUserInteraction(uint32_t hash)
77
    void PlugInDidReceiveUserInteraction(uint32_t hash)
- a/Source/WebKit/WebKit.xcodeproj/project.pbxproj +12 lines
Lines 956-962 a/Source/WebKit/WebKit.xcodeproj/project.pbxproj_sec1
956
		46BEB6E322FBB21A00269867 /* TransientLocalStorageNamespace.h in Headers */ = {isa = PBXBuildFile; fileRef = 46BEB6E122FBB21A00269867 /* TransientLocalStorageNamespace.h */; };
956
		46BEB6E322FBB21A00269867 /* TransientLocalStorageNamespace.h in Headers */ = {isa = PBXBuildFile; fileRef = 46BEB6E122FBB21A00269867 /* TransientLocalStorageNamespace.h */; };
957
		46C392292316EC4D008EED9B /* WebPageProxyIdentifier.h in Headers */ = {isa = PBXBuildFile; fileRef = 46C392282316EC4D008EED9B /* WebPageProxyIdentifier.h */; };
957
		46C392292316EC4D008EED9B /* WebPageProxyIdentifier.h in Headers */ = {isa = PBXBuildFile; fileRef = 46C392282316EC4D008EED9B /* WebPageProxyIdentifier.h */; };
958
		46DF063C1F3905F8001980BB /* NetworkCORSPreflightChecker.h in Headers */ = {isa = PBXBuildFile; fileRef = 46DF063A1F3905E5001980BB /* NetworkCORSPreflightChecker.h */; };
958
		46DF063C1F3905F8001980BB /* NetworkCORSPreflightChecker.h in Headers */ = {isa = PBXBuildFile; fileRef = 46DF063A1F3905E5001980BB /* NetworkCORSPreflightChecker.h */; };
959
		46F77D8023BE63BE0090B5A7 /* DependencyProcessAssertion.h in Headers */ = {isa = PBXBuildFile; fileRef = 46F77D7E23BE63B10090B5A7 /* DependencyProcessAssertion.h */; };
959
		46F9B26323526EF3006FE5FA /* WebBackForwardCacheEntry.h in Headers */ = {isa = PBXBuildFile; fileRef = 46F9B26223526ED0006FE5FA /* WebBackForwardCacheEntry.h */; };
960
		46F9B26323526EF3006FE5FA /* WebBackForwardCacheEntry.h in Headers */ = {isa = PBXBuildFile; fileRef = 46F9B26223526ED0006FE5FA /* WebBackForwardCacheEntry.h */; };
961
		46FDA8F723BE586900B198FA /* RunningBoardServicesSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 46FDA8F623BE585900B198FA /* RunningBoardServicesSPI.h */; };
960
		49BCA19223A177660028A836 /* APIResourceLoadStatisticsFirstParty.h in Headers */ = {isa = PBXBuildFile; fileRef = 49BCA19123A177660028A836 /* APIResourceLoadStatisticsFirstParty.h */; };
962
		49BCA19223A177660028A836 /* APIResourceLoadStatisticsFirstParty.h in Headers */ = {isa = PBXBuildFile; fileRef = 49BCA19123A177660028A836 /* APIResourceLoadStatisticsFirstParty.h */; };
961
		49BCA19523A18CFD0028A836 /* _WKResourceLoadStatisticsFirstPartyInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 49BCA19023A175490028A836 /* _WKResourceLoadStatisticsFirstPartyInternal.h */; };
963
		49BCA19523A18CFD0028A836 /* _WKResourceLoadStatisticsFirstPartyInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 49BCA19023A175490028A836 /* _WKResourceLoadStatisticsFirstPartyInternal.h */; };
962
		49BCA19723A1930D0028A836 /* APIResourceLoadStatisticsThirdParty.h in Headers */ = {isa = PBXBuildFile; fileRef = 49BCA19623A18F620028A836 /* APIResourceLoadStatisticsThirdParty.h */; };
964
		49BCA19723A1930D0028A836 /* APIResourceLoadStatisticsThirdParty.h in Headers */ = {isa = PBXBuildFile; fileRef = 49BCA19623A18F620028A836 /* APIResourceLoadStatisticsThirdParty.h */; };
Lines 3422-3428 a/Source/WebKit/WebKit.xcodeproj/project.pbxproj_sec2
3422
		46C392282316EC4D008EED9B /* WebPageProxyIdentifier.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebPageProxyIdentifier.h; sourceTree = "<group>"; };
3424
		46C392282316EC4D008EED9B /* WebPageProxyIdentifier.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebPageProxyIdentifier.h; sourceTree = "<group>"; };
3423
		46DF06391F3905E5001980BB /* NetworkCORSPreflightChecker.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NetworkCORSPreflightChecker.cpp; sourceTree = "<group>"; };
3425
		46DF06391F3905E5001980BB /* NetworkCORSPreflightChecker.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NetworkCORSPreflightChecker.cpp; sourceTree = "<group>"; };
3424
		46DF063A1F3905E5001980BB /* NetworkCORSPreflightChecker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NetworkCORSPreflightChecker.h; sourceTree = "<group>"; };
3426
		46DF063A1F3905E5001980BB /* NetworkCORSPreflightChecker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NetworkCORSPreflightChecker.h; sourceTree = "<group>"; };
3427
		46F77D7E23BE63B10090B5A7 /* DependencyProcessAssertion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DependencyProcessAssertion.h; sourceTree = "<group>"; };
3428
		46F77D7F23BE63B20090B5A7 /* DependencyProcessAssertion.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DependencyProcessAssertion.cpp; sourceTree = "<group>"; };
3429
		46F77D8123BE63DC0090B5A7 /* DependencyProcessAssertionIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = DependencyProcessAssertionIOS.mm; path = ios/DependencyProcessAssertionIOS.mm; sourceTree = "<group>"; };
3425
		46F9B26223526ED0006FE5FA /* WebBackForwardCacheEntry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebBackForwardCacheEntry.h; sourceTree = "<group>"; };
3430
		46F9B26223526ED0006FE5FA /* WebBackForwardCacheEntry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebBackForwardCacheEntry.h; sourceTree = "<group>"; };
3431
		46FDA8F623BE585900B198FA /* RunningBoardServicesSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RunningBoardServicesSPI.h; sourceTree = "<group>"; };
3426
		49BCA19023A175490028A836 /* _WKResourceLoadStatisticsFirstPartyInternal.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = _WKResourceLoadStatisticsFirstPartyInternal.h; sourceTree = "<group>"; };
3432
		49BCA19023A175490028A836 /* _WKResourceLoadStatisticsFirstPartyInternal.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = _WKResourceLoadStatisticsFirstPartyInternal.h; sourceTree = "<group>"; };
3427
		49BCA19123A177660028A836 /* APIResourceLoadStatisticsFirstParty.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = APIResourceLoadStatisticsFirstParty.h; sourceTree = "<group>"; };
3433
		49BCA19123A177660028A836 /* APIResourceLoadStatisticsFirstParty.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = APIResourceLoadStatisticsFirstParty.h; sourceTree = "<group>"; };
3428
		49BCA19623A18F620028A836 /* APIResourceLoadStatisticsThirdParty.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = APIResourceLoadStatisticsThirdParty.h; sourceTree = "<group>"; };
3434
		49BCA19623A18F620028A836 /* APIResourceLoadStatisticsThirdParty.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = APIResourceLoadStatisticsThirdParty.h; sourceTree = "<group>"; };
Lines 5570-5575 a/Source/WebKit/WebKit.xcodeproj/project.pbxproj_sec3
5570
				99F642D21FABE378009621E9 /* CoordinateSystem.h */,
5576
				99F642D21FABE378009621E9 /* CoordinateSystem.h */,
5571
				99036AE823A970870000B06A /* DebuggableInfoData.cpp */,
5577
				99036AE823A970870000B06A /* DebuggableInfoData.cpp */,
5572
				99036AE723A970870000B06A /* DebuggableInfoData.h */,
5578
				99036AE723A970870000B06A /* DebuggableInfoData.h */,
5579
				46F77D7F23BE63B20090B5A7 /* DependencyProcessAssertion.cpp */,
5580
				46F77D7E23BE63B10090B5A7 /* DependencyProcessAssertion.h */,
5573
				2D7FD190223C730F007887F1 /* DocumentEditingContext.h */,
5581
				2D7FD190223C730F007887F1 /* DocumentEditingContext.h */,
5574
				2D7FD191223C7310007887F1 /* DocumentEditingContext.mm */,
5582
				2D7FD191223C7310007887F1 /* DocumentEditingContext.mm */,
5575
				C517388012DF8F4F00EE3F47 /* DragControllerAction.h */,
5583
				C517388012DF8F4F00EE3F47 /* DragControllerAction.h */,
Lines 6455-6460 a/Source/WebKit/WebKit.xcodeproj/project.pbxproj_sec4
6455
			isa = PBXGroup;
6463
			isa = PBXGroup;
6456
			children = (
6464
			children = (
6457
				A7E93CEB192531AA00A1DC48 /* AuxiliaryProcessIOS.mm */,
6465
				A7E93CEB192531AA00A1DC48 /* AuxiliaryProcessIOS.mm */,
6466
				46F77D8123BE63DC0090B5A7 /* DependencyProcessAssertionIOS.mm */,
6458
				2DA6731920C754B1003CB401 /* DynamicViewportSizeUpdate.h */,
6467
				2DA6731920C754B1003CB401 /* DynamicViewportSizeUpdate.h */,
6459
				2DA9449D1884E4F000ED86DB /* GestureTypes.h */,
6468
				2DA9449D1884E4F000ED86DB /* GestureTypes.h */,
6460
				C5BCE5DA1C50761D00CDE3FA /* InteractionInformationAtPosition.h */,
6469
				C5BCE5DA1C50761D00CDE3FA /* InteractionInformationAtPosition.h */,
Lines 9606-9611 a/Source/WebKit/WebKit.xcodeproj/project.pbxproj_sec5
9606
				A13B3DA1207F39DE0090C58D /* MobileWiFiSPI.h */,
9615
				A13B3DA1207F39DE0090C58D /* MobileWiFiSPI.h */,
9607
				3178AF9720E2A7F80074DE94 /* PDFKitSPI.h */,
9616
				3178AF9720E2A7F80074DE94 /* PDFKitSPI.h */,
9608
				2DC18FAF218912640025A88D /* PencilKitSPI.h */,
9617
				2DC18FAF218912640025A88D /* PencilKitSPI.h */,
9618
				46FDA8F623BE585900B198FA /* RunningBoardServicesSPI.h */,
9609
				CE1A0BD01A48E6C60054EF74 /* TCCSPI.h */,
9619
				CE1A0BD01A48E6C60054EF74 /* TCCSPI.h */,
9610
				CE1A0BD11A48E6C60054EF74 /* TextInputSPI.h */,
9620
				CE1A0BD11A48E6C60054EF74 /* TextInputSPI.h */,
9611
				CEE4AE2A1A5DCF430002F49B /* UIKitSPI.h */,
9621
				CEE4AE2A1A5DCF430002F49B /* UIKitSPI.h */,
Lines 9974-9979 a/Source/WebKit/WebKit.xcodeproj/project.pbxproj_sec6
9974
				1AC75380183BE50F0072CB15 /* DataReference.h in Headers */,
9984
				1AC75380183BE50F0072CB15 /* DataReference.h in Headers */,
9975
				99036AE923A970870000B06A /* DebuggableInfoData.h in Headers */,
9985
				99036AE923A970870000B06A /* DebuggableInfoData.h in Headers */,
9976
				BC032DA610F437D10058C15A /* Decoder.h in Headers */,
9986
				BC032DA610F437D10058C15A /* Decoder.h in Headers */,
9987
				46F77D8023BE63BE0090B5A7 /* DependencyProcessAssertion.h in Headers */,
9977
				57DCEDAB214C60090016B847 /* DeviceIdentitySPI.h in Headers */,
9988
				57DCEDAB214C60090016B847 /* DeviceIdentitySPI.h in Headers */,
9978
				07297F9F1C17BBEA015F0735 /* DeviceIdHashSaltStorage.h in Headers */,
9989
				07297F9F1C17BBEA015F0735 /* DeviceIdHashSaltStorage.h in Headers */,
9979
				2D0C56FD229F1DEA00BD33E7 /* DeviceManagementSoftLink.h in Headers */,
9990
				2D0C56FD229F1DEA00BD33E7 /* DeviceManagementSoftLink.h in Headers */,
Lines 10270-10275 a/Source/WebKit/WebKit.xcodeproj/project.pbxproj_sec7
10270
				7AFBD36A21E542F1005DBACB /* ResourceLoadStatisticsPersistentStorage.h in Headers */,
10281
				7AFBD36A21E542F1005DBACB /* ResourceLoadStatisticsPersistentStorage.h in Headers */,
10271
				1A30066E1110F4F70031937C /* ResponsivenessTimer.h in Headers */,
10282
				1A30066E1110F4F70031937C /* ResponsivenessTimer.h in Headers */,
10272
				410482CE1DDD324F00F006D0 /* RTCNetwork.h in Headers */,
10283
				410482CE1DDD324F00F006D0 /* RTCNetwork.h in Headers */,
10284
				46FDA8F723BE586900B198FA /* RunningBoardServicesSPI.h in Headers */,
10273
				0E97D74D200E900400BF6643 /* SafeBrowsingSPI.h in Headers */,
10285
				0E97D74D200E900400BF6643 /* SafeBrowsingSPI.h in Headers */,
10274
				5CA9854A210BEB640057EB6B /* SafeBrowsingWarning.h in Headers */,
10286
				5CA9854A210BEB640057EB6B /* SafeBrowsingWarning.h in Headers */,
10275
				BC2D021712AC41CB00E732A3 /* SameDocumentNavigationType.h in Headers */,
10287
				BC2D021712AC41CB00E732A3 /* SameDocumentNavigationType.h in Headers */,
- a/Source/WebKit/WebProcess/WebProcess.cpp -6 / +5 lines
Lines 31-36 a/Source/WebKit/WebProcess/WebProcess.cpp_sec1
31
#include "APIPageHandle.h"
31
#include "APIPageHandle.h"
32
#include "AuthenticationManager.h"
32
#include "AuthenticationManager.h"
33
#include "AuxiliaryProcessMessages.h"
33
#include "AuxiliaryProcessMessages.h"
34
#include "DependencyProcessAssertion.h"
34
#include "DrawingArea.h"
35
#include "DrawingArea.h"
35
#include "EventDispatcher.h"
36
#include "EventDispatcher.h"
36
#include "InjectedBundle.h"
37
#include "InjectedBundle.h"
Lines 271-277 void WebProcess::initializeConnection(IPC::Connection* connection) a/Source/WebKit/WebProcess/WebProcess.cpp_sec2
271
    m_eventDispatcher->initializeConnection(connection);
272
    m_eventDispatcher->initializeConnection(connection);
272
#if PLATFORM(IOS_FAMILY)
273
#if PLATFORM(IOS_FAMILY)
273
    m_viewUpdateDispatcher->initializeConnection(connection);
274
    m_viewUpdateDispatcher->initializeConnection(connection);
275
276
    ASSERT(!m_uiProcessDependencyProcessAssertion);
277
    m_uiProcessDependencyProcessAssertion = makeUnique<DependencyProcessAssertion>(connection->remoteProcessID(), "WebContent process dependency on UIProcess"_s);
274
#endif // PLATFORM(IOS_FAMILY)
278
#endif // PLATFORM(IOS_FAMILY)
279
275
    m_webInspectorInterruptDispatcher->initializeConnection(connection);
280
    m_webInspectorInterruptDispatcher->initializeConnection(connection);
276
281
277
#if ENABLE(NETSCAPE_PLUGIN_API)
282
#if ENABLE(NETSCAPE_PLUGIN_API)
Lines 282-293 void WebProcess::initializeConnection(IPC::Connection* connection) a/Source/WebKit/WebProcess/WebProcess.cpp_sec3
282
        supplement->initializeConnection(connection);
287
        supplement->initializeConnection(connection);
283
288
284
    m_webConnection = WebConnectionToUIProcess::create(this);
289
    m_webConnection = WebConnectionToUIProcess::create(this);
285
286
#if PLATFORM(IOS_FAMILY)
287
    // Make sure we have an IPC::Connection before creating the ProcessTaskStateObserver since it may call
288
    // WebProcess::processTaskStateDidChange() on a background thread and deference the IPC connection.
289
    m_taskStateObserver = ProcessTaskStateObserver::create(*this);
290
#endif
291
}
290
}
292
291
293
void WebProcess::initializeWebProcess(WebProcessCreationParameters&& parameters)
292
void WebProcess::initializeWebProcess(WebProcessCreationParameters&& parameters)
- a/Source/WebKit/WebProcess/WebProcess.h -17 / +3 lines
Lines 65-75 a/Source/WebKit/WebProcess/WebProcess.h_sec1
65
#include <wtf/MachSendRight.h>
65
#include <wtf/MachSendRight.h>
66
#endif
66
#endif
67
67
68
#if PLATFORM(IOS_FAMILY)
69
#include "ProcessTaskStateObserver.h"
70
OBJC_CLASS BKSProcessAssertion;
71
#endif
72
73
#if PLATFORM(WAYLAND) && USE(WPE_RENDERER)
68
#if PLATFORM(WAYLAND) && USE(WPE_RENDERER)
74
#include <WebCore/PlatformDisplayLibWPE.h>
69
#include <WebCore/PlatformDisplayLibWPE.h>
75
#endif
70
#endif
Lines 105-110 struct ServiceWorkerContextData; a/Source/WebKit/WebProcess/WebProcess.h_sec2
105
100
106
namespace WebKit {
101
namespace WebKit {
107
102
103
class DependencyProcessAssertion;
108
class EventDispatcher;
104
class EventDispatcher;
109
class GamepadData;
105
class GamepadData;
110
class GPUProcessConnection;
106
class GPUProcessConnection;
Lines 140-150 struct WebsiteDataStoreParameters; a/Source/WebKit/WebProcess/WebProcess.h_sec3
140
class LayerHostingContext;
136
class LayerHostingContext;
141
#endif
137
#endif
142
138
143
class WebProcess
139
class WebProcess : public AuxiliaryProcess
144
    : public AuxiliaryProcess
145
#if PLATFORM(IOS_FAMILY)
146
    , ProcessTaskStateObserver::Client
147
#endif
148
{
140
{
149
    WTF_MAKE_FAST_ALLOCATED;
141
    WTF_MAKE_FAST_ALLOCATED;
150
public:
142
public:
Lines 474-484 private: a/Source/WebKit/WebProcess/WebProcess.h_sec4
474
#endif
466
#endif
475
467
476
#if PLATFORM(IOS_FAMILY)
468
#if PLATFORM(IOS_FAMILY)
477
    void processTaskStateDidChange(ProcessTaskStateObserver::TaskState) final;
478
    bool shouldFreezeOnSuspension() const;
469
    bool shouldFreezeOnSuspension() const;
479
    void updateFreezerStatus();
470
    void updateFreezerStatus();
480
481
    void releaseProcessWasResumedAssertions();
482
#endif
471
#endif
483
472
484
#if ENABLE(VIDEO)
473
#if ENABLE(VIDEO)
Lines 563-572 private: a/Source/WebKit/WebProcess/WebProcess.h_sec5
563
552
564
#if PLATFORM(IOS_FAMILY)
553
#if PLATFORM(IOS_FAMILY)
565
    WebSQLiteDatabaseTracker m_webSQLiteDatabaseTracker;
554
    WebSQLiteDatabaseTracker m_webSQLiteDatabaseTracker;
566
    RefPtr<ProcessTaskStateObserver> m_taskStateObserver;
555
    std::unique_ptr<DependencyProcessAssertion> m_uiProcessDependencyProcessAssertion;
567
    Lock m_processWasResumedAssertionsLock;
568
    RetainPtr<BKSProcessAssertion> m_processWasResumedUIAssertion;
569
    RetainPtr<BKSProcessAssertion> m_processWasResumedOwnAssertion;
570
#endif
556
#endif
571
557
572
    enum PageMarkingLayersAsVolatileCounterType { };
558
    enum PageMarkingLayersAsVolatileCounterType { };
- a/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm -55 / +1 lines
Lines 91-96 a/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm_sec1
91
#if PLATFORM(IOS_FAMILY)
91
#if PLATFORM(IOS_FAMILY)
92
#import "AccessibilitySupportSPI.h"
92
#import "AccessibilitySupportSPI.h"
93
#import "AssertionServicesSPI.h"
93
#import "AssertionServicesSPI.h"
94
#import "RunningBoardServicesSPI.h"
94
#import "UserInterfaceIdiom.h"
95
#import "UserInterfaceIdiom.h"
95
#import "WKAccessibilityWebPageObjectIOS.h"
96
#import "WKAccessibilityWebPageObjectIOS.h"
96
#import <UIKit/UIAccessibility.h>
97
#import <UIKit/UIAccessibility.h>
Lines 322-382 void WebProcess::updateProcessName() a/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm_sec2
322
#endif // PLATFORM(MAC)
323
#endif // PLATFORM(MAC)
323
}
324
}
324
325
325
#if PLATFORM(IOS_FAMILY)
326
void WebProcess::processTaskStateDidChange(ProcessTaskStateObserver::TaskState taskState)
327
{
328
    // NOTE: This will be called from a background thread.
329
    RELEASE_LOG(ProcessSuspension, "%p - WebProcess::processTaskStateDidChange() - taskState(%d)", this, taskState);
330
    if (taskState != ProcessTaskStateObserver::Running)
331
        return;
332
333
    LockHolder holder(m_processWasResumedAssertionsLock);
334
    if (m_processWasResumedUIAssertion && m_processWasResumedOwnAssertion)
335
        return;
336
337
    // We were awakened from suspension unexpectedly. Notify the WebProcessProxy, but take a process assertion on our parent PID
338
    // to ensure that it too is awakened.
339
    RELEASE_LOG(ProcessSuspension, "%p - WebProcess::processTaskStateChanged() Taking 'WebProcess was resumed' assertion on behalf on UIProcess", this);
340
    m_processWasResumedUIAssertion = adoptNS([[BKSProcessAssertion alloc] initWithPID:parentProcessConnection()->remoteProcessID() flags:BKSProcessAssertionPreventTaskSuspend reason:BKSProcessAssertionReasonFinishTask name:@"WebProcess was resumed" withHandler:^(BOOL acquired) {
341
        if (!acquired)
342
            RELEASE_LOG_ERROR(ProcessSuspension, "%p - WebProcess::processTaskStateDidChange() failed to take 'WebProcess was resumed' assertion for parent process", this);
343
    }]);
344
    m_processWasResumedUIAssertion.get().invalidationHandler = [this] {
345
        RELEASE_LOG_ERROR(ProcessSuspension, "%p - WebProcess::processTaskStateChanged() Releasing 'WebProcess was resumed' assertion on behalf on UIProcess due to invalidation", this);
346
        releaseProcessWasResumedAssertions();
347
    };
348
    m_processWasResumedOwnAssertion = adoptNS([[BKSProcessAssertion alloc] initWithPID:getpid() flags:BKSProcessAssertionPreventTaskSuspend reason:BKSProcessAssertionReasonFinishTask name:@"WebProcess was resumed" withHandler:^(BOOL acquired) {
349
        if (!acquired)
350
            RELEASE_LOG_ERROR(ProcessSuspension, "%p - WebProcess::processTaskStateDidChange() failed to take 'WebProcess was resumed' assertion for WebContent process", this);
351
    }]);
352
    m_processWasResumedOwnAssertion.get().invalidationHandler = [this] {
353
        RELEASE_LOG_ERROR(ProcessSuspension, "%p - WebProcess::processTaskStateChanged() Releasing 'WebProcess was resumed' assertion on behalf on WebContent process due to invalidation", this);
354
        releaseProcessWasResumedAssertions();
355
    };
356
357
    parentProcessConnection()->sendWithAsyncReply(Messages::WebProcessProxy::ProcessWasResumed(), [this] {
358
        RELEASE_LOG(ProcessSuspension, "%p - WebProcess::processTaskStateDidChange() Parent process handled ProcessWasResumed IPC, releasing our assertions", this);
359
        releaseProcessWasResumedAssertions();
360
    });
361
}
362
363
void WebProcess::releaseProcessWasResumedAssertions()
364
{
365
    LockHolder holder(m_processWasResumedAssertionsLock);
366
    if (m_processWasResumedUIAssertion) {
367
        RELEASE_LOG(ProcessSuspension, "%p - WebProcess::releaseProcessWasResumedAssertions() Releasing parent process 'WebProcess was resumed' assertion", this);
368
        [m_processWasResumedUIAssertion invalidate];
369
        m_processWasResumedUIAssertion = nullptr;
370
    }
371
    if (m_processWasResumedOwnAssertion) {
372
        RELEASE_LOG(ProcessSuspension, "%p - WebProcess::releaseProcessWasResumedAssertions() Releasing WebContent process 'WebProcess was resumed' assertion", this);
373
        [m_processWasResumedOwnAssertion invalidate];
374
        m_processWasResumedOwnAssertion = nullptr;
375
    }
376
}
377
378
#endif
379
380
#if PLATFORM(IOS_FAMILY)
326
#if PLATFORM(IOS_FAMILY)
381
static NSString *webProcessLoaderAccessibilityBundlePath()
327
static NSString *webProcessLoaderAccessibilityBundlePath()
382
{
328
{

Return to Bug 205687