-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move some WebKit code to WebKit framework
https://bugs.webkit.org/show_bug.cgi?id=265324 rdar://118776213 Reviewed by Brent Fulgham. Move some WebKit code related to WebKit process extensions to WebKit framework. This change enables us to use new assertion API to take out an assertion on the Networking process when holding locked files, which is also included in this patch. * Source/WebKit/NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::setIsHoldingLockedFiles): * Source/WebKit/NetworkProcess/NetworkProcess.h: * Source/WebKit/NetworkProcess/cocoa/NetworkProcessCocoa.mm: (WebKit::NetworkProcess::aqcuireLockedFileGrant): (WebKit::NetworkProcess::invalidateGrant): (WebKit::NetworkProcess::hasAcquiredGrant const): * Source/WebKit/Shared/AuxiliaryProcessExtensions/NetworkingProcessExtension.swift: (NetworkingProcessExtension.handle(_:)): * Source/WebKit/Shared/AuxiliaryProcessExtensions/WebKitProcessExtension.swift: Copied from Source/WebKit/Shared/AuxiliaryProcessExtensions/NetworkingProcessExtension.swift. (WKProcessExtension.sharedInstance): (WKNetworkingProcessExtension.handle(_:)): (WKNetworkingProcessExtension.grant(_:name:)): * Source/WebKit/WebKit.xcodeproj/project.pbxproj: Canonical link: https://commits.webkit.org/271326@main
- Loading branch information
Showing
8 changed files
with
172 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
Source/WebKit/Shared/AuxiliaryProcessExtensions/WebKitProcessExtension.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/* | ||
* Copyright (C) 2023 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 ServiceExtensions | ||
@_spi(Private) import ServiceExtensions | ||
|
||
@objc | ||
@_spi(Private) | ||
open class Grant: NSObject { | ||
let inner : _Capabilities.Grant | ||
|
||
init(inner: _Capabilities.Grant) { | ||
self.inner = inner | ||
} | ||
|
||
@objc(invalidateWithError:) | ||
open func invalidate() throws { | ||
try self.inner.invalidate() | ||
} | ||
} | ||
|
||
@_spi(Private) | ||
@objc(WKNetworkingProcessExtension) | ||
open class WKNetworkingProcessExtension : NSObject { | ||
@objc(sharedInstance) | ||
static public var sharedInstance: WKNetworkingProcessExtension? = nil | ||
required public override init() { | ||
super.init() | ||
WKNetworkingProcessExtension.sharedInstance = self | ||
} | ||
} | ||
|
||
extension WKNetworkingProcessExtension: NetworkingServiceExtension { | ||
@objc(handle:) | ||
open func handle(xpcConnection: xpc_connection_t) { | ||
} | ||
|
||
@objc(grant:name:error:) | ||
open func grant(domain: String, name: String) throws -> Any { | ||
let grant = try self._request(capabilities: _Capabilities.assertion(domain, name)) | ||
return Grant(inner: grant) | ||
} | ||
} |
Oops, something went wrong.