Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce a <model> loading process - Part 2
https://bugs.webkit.org/show_bug.cgi?id=243874 rdar://122051588 (Create new com.apple.WebKit.Model process) Reviewed by Alex Christensen. In order to allow parsing of complex 3D model formats with a custom (tight) sandbox, introduce a separate process for loading/parsing <model>s. This is part 2 of the effort, where we hook up the new Model* classes from existing classes. ENABLE_MODEL_PROCESS is now turned on for visionOS. The new process doesn't exist yet. The actual rendering flow is not changed yet. Certain changes were to accommodate for the new plan of having a single ModelProcess across the system instead of having one ModelProcess for each WebProcess. * Source/WTF/wtf/PlatformEnableCocoa.h: Enables MODEL_PROCESS for visionOS. * Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml: * Source/WTF/wtf/PlatformEnableCocoa.h: * Source/WebCore/platform/RuntimeApplicationChecks.cpp: (WebCore::processTypeDescription): * Source/WebCore/platform/RuntimeApplicationChecks.h: * Source/WebKit/ModelProcess/EntryPoint/Cocoa/XPCService/ModelServiceEntryPoint.mm: Copied from Source/WebKit/UIProcess/WebContextClient.h. (WebKit::ModelServiceInitializerDelegate::ModelServiceInitializerDelegate): (WebKit::initializeAuxiliaryProcess<ModelProcess>): (MODEL_SERVICE_INITIALIZER): * Source/WebKit/ModelProcess/cocoa/ModelProcessCocoa.mm: Copied from Source/WebKit/Platform/ExtraPrivateSymbolsForTAPI.h. (WebKit::ModelProcess::notifyPreferencesChanged): (WebKit::ModelProcess::dispatchSimulatedNotificationsForPreferenceChange): * Source/WebKit/ModelProcess/ios/ModelProcessIOS.mm: Copied from Source/WebKit/Platform/ExtraPrivateSymbolsForTAPI.h. (WebKit::ModelProcess::initializeProcess): (WebKit::ModelProcess::initializeProcessName): (WebKit::ModelProcess::initializeSandbox): * Source/WebKit/Platform/ExtraPrivateSymbolsForTAPI.h: * Source/WebKit/Shared/Cocoa/DefaultWebBrowserChecks.mm: (WebKit::isInWebKitChildProcess): * Source/WebKit/Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceEntryPoint.h: * Source/WebKit/Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm: (WebKit::XPCServiceEventHandler): * Source/WebKit/Shared/RemoteLayerTree/DynamicContentScalingImageBufferBackend.mm: (WebKit::DynamicContentScalingImageBufferBackend::createBackendHandle const): * Source/WebKit/SourcesCocoa.txt: * Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _modelProcessIdentifier]): * Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h: * Source/WebKit/UIProcess/AuxiliaryProcessProxy.cpp: (WebKit::AuxiliaryProcessProxy::getLaunchOptions): * Source/WebKit/UIProcess/Cocoa/PageClientImplCocoa.h: * Source/WebKit/UIProcess/Cocoa/PageClientImplCocoa.mm: (WebKit::PageClientImplCocoa::modelProcessDidFinishLaunching): (WebKit::PageClientImplCocoa::modelProcessDidExit): * Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm: (WebKit::WebPageProxy::didCreateContextInModelProcessForVisibilityPropagation): * Source/WebKit/UIProcess/Launcher/ProcessLauncher.h: * Source/WebKit/UIProcess/Launcher/cocoa/ProcessLauncherCocoa.mm: (WebKit::serviceName): * Source/WebKit/UIProcess/Model/ModelProcessProxy.cpp: (WebKit::singleton): (WebKit::ModelProcessProxy::getOrCreate): (WebKit::ModelProcessProxy::singletonIfCreated): (WebKit::ModelProcessProxy::ModelProcessProxy): (WebKit::ModelProcessProxy::modelProcessExited): (WebKit::ModelProcessProxy::didFinishLaunching): (WebKit::ModelProcessProxy::updateProcessAssertion): (WebKit::ModelProcessProxy::create): Deleted. * Source/WebKit/UIProcess/Model/ModelProcessProxy.h: * Source/WebKit/UIProcess/PageClient.h: (WebKit::PageClient::didCreateContextInModelProcessForVisibilityPropagation): (WebKit::PageClient::modelProcessDidFinishLaunching): (WebKit::PageClient::modelProcessDidExit): * Source/WebKit/UIProcess/ProvisionalPageProxy.cpp: (WebKit::ProvisionalPageProxy::didCreateContextInModelProcessForVisibilityPropagation): * Source/WebKit/UIProcess/ProvisionalPageProxy.h: (WebKit::ProvisionalPageProxy::contextIDForVisibilityPropagationInModelProcess const): * Source/WebKit/UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::modelProcessID const): (WebKit::WebPageProxy::modelProcessDidFinishLaunching): (WebKit::WebPageProxy::modelProcessExited): * Source/WebKit/UIProcess/WebPageProxy.h: * Source/WebKit/UIProcess/WebProcessPool.cpp: (WebKit::m_resetModelProcessCrashCountTimer): (WebKit::WebProcessPool::ensureModelProcess): (WebKit::WebProcessPool::ensureProtectedModelProcess): (WebKit::WebProcessPool::modelProcessDidFinishLaunching): (WebKit::WebProcessPool::modelProcessExited): (WebKit::WebProcessPool::createModelProcessConnection): (WebKit::WebProcessPool::updateProcessAssertions): * Source/WebKit/UIProcess/WebProcessPool.h: * Source/WebKit/UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::createModelProcessConnection): (WebKit::WebProcessProxy::modelProcessDidFinishLaunching): (WebKit::WebProcessProxy::modelProcessExited): * Source/WebKit/UIProcess/WebProcessProxy.h: * Source/WebKit/UIProcess/ios/PageClientImplIOS.h: * Source/WebKit/UIProcess/ios/PageClientImplIOS.mm: (WebKit::PageClientImpl::didCreateContextInModelProcessForVisibilityPropagation): (WebKit::PageClientImpl::modelProcessDidExit): * Source/WebKit/UIProcess/ios/WKContentView.h: * Source/WebKit/UIProcess/ios/WKContentView.mm: (-[WKContentView _setupVisibilityPropagationViewForModelProcess]): (-[WKContentView _removeVisibilityPropagationViewForModelProcess]): (-[WKContentView _modelProcessDidExit]): (-[WKContentView _didRelaunchProcess]): (-[WKContentView _modelProcessDidCreateContextForVisibilityPropagation]): (-[WKContentView _createVisibilityPropagationView]): * Source/WebKit/WebKit.xcodeproj/project.pbxproj: * Source/WebKit/WebProcess/Model/ModelProcessConnection.h: * Source/WebKit/WebProcess/Model/ModelProcessModelPlayer.h: Added. (WebKit::ModelProcessModelPlayer::page): (WebKit::ModelProcessModelPlayer::client): * Source/WebKit/WebProcess/Model/ModelProcessModelPlayer.mm: Added. (WebKit::ModelProcessModelPlayer::create): (WebKit::ModelProcessModelPlayer::ModelProcessModelPlayer): (WebKit::ModelProcessModelPlayer::~ModelProcessModelPlayer): (WebKit::ModelProcessModelPlayer::load): (WebKit::ModelProcessModelPlayer::sizeDidChange): (WebKit::ModelProcessModelPlayer::layer): (WebKit::ModelProcessModelPlayer::handleMouseDown): (WebKit::ModelProcessModelPlayer::handleMouseMove): (WebKit::ModelProcessModelPlayer::handleMouseUp): (WebKit::ModelProcessModelPlayer::enterFullscreen): (WebKit::ModelProcessModelPlayer::getCamera): (WebKit::ModelProcessModelPlayer::setCamera): (WebKit::ModelProcessModelPlayer::isPlayingAnimation): (WebKit::ModelProcessModelPlayer::setAnimationIsPlaying): (WebKit::ModelProcessModelPlayer::isLoopingAnimation): (WebKit::ModelProcessModelPlayer::setIsLoopingAnimation): (WebKit::ModelProcessModelPlayer::animationDuration): (WebKit::ModelProcessModelPlayer::animationCurrentTime): (WebKit::ModelProcessModelPlayer::setAnimationCurrentTime): (WebKit::ModelProcessModelPlayer::hasAudio): (WebKit::ModelProcessModelPlayer::isMuted): (WebKit::ModelProcessModelPlayer::setIsMuted): (WebKit::ModelProcessModelPlayer::accessibilityChildren): * Source/WebKit/WebProcess/Model/WebModelPlayerProvider.cpp: (WebKit::WebModelPlayerProvider::createModelPlayer): * Source/WebKit/WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::modelProcessConnectionDidBecomeAvailable): (WebKit::WebPage::~WebPage): (WebKit::WebPage::updatePreferences): (WebKit::WebPage::configureLoggingChannel): * Source/WebKit/WebProcess/WebPage/WebPage.h: * Source/WebKit/WebProcess/WebProcess.cpp: (WebKit::WebProcess::ensureModelProcessConnection): (WebKit::WebProcess::modelProcessConnectionClosed): * Source/WebKit/WebProcess/WebProcess.h: (WebKit::WebProcess::existingModelProcessConnection): Canonical link: https://commits.webkit.org/274185@main
- Loading branch information
1 parent
c0b07c4
commit 48ace7f
Showing
44 changed files
with
963 additions
and
44 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
64 changes: 64 additions & 0 deletions
64
Source/WebKit/ModelProcess/EntryPoint/Cocoa/XPCService/ModelServiceEntryPoint.mm
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,64 @@ | ||
/* | ||
* Copyright (C) 2024 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 "EnvironmentUtilities.h" | ||
#import "ModelProcess.h" | ||
#import "WKBase.h" | ||
#import "XPCServiceEntryPoint.h" | ||
|
||
#if ENABLE(MODEL_PROCESS) | ||
|
||
namespace WebKit { | ||
|
||
class ModelServiceInitializerDelegate : public XPCServiceInitializerDelegate { | ||
public: | ||
ModelServiceInitializerDelegate(OSObjectPtr<xpc_connection_t> connection, xpc_object_t initializerMessage) | ||
: XPCServiceInitializerDelegate(WTFMove(connection), initializerMessage) | ||
{ | ||
} | ||
}; | ||
|
||
template<> | ||
void initializeAuxiliaryProcess<ModelProcess>(AuxiliaryProcessInitializationParameters&& parameters) | ||
{ | ||
static NeverDestroyed<ModelProcess> modelProcess(WTFMove(parameters)); | ||
} | ||
|
||
} // namespace WebKit | ||
|
||
#endif // ENABLE(MODEL_PROCESS) | ||
|
||
extern "C" WK_EXPORT void MODEL_SERVICE_INITIALIZER(xpc_connection_t connection, xpc_object_t initializerMessage); | ||
|
||
void MODEL_SERVICE_INITIALIZER(xpc_connection_t connection, xpc_object_t initializerMessage) | ||
{ | ||
WTF::initializeMainThread(); | ||
|
||
#if ENABLE(MODEL_PROCESS) | ||
WebKit::XPCServiceInitializer<WebKit::ModelProcess, WebKit::ModelServiceInitializerDelegate>(connection, initializerMessage); | ||
#endif // ENABLE(MODEL_PROCESS) | ||
} |
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,52 @@ | ||
/* | ||
* Copyright (C) 2024 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 | ||
|
||
#import "config.h" | ||
#import "ModelProcess.h" | ||
|
||
#if ENABLE(MODEL_PROCESS) | ||
|
||
#import "ModelConnectionToWebProcess.h" | ||
#import <wtf/RetainPtr.h> | ||
|
||
namespace WebKit { | ||
using namespace WebCore; | ||
|
||
#if ENABLE(CFPREFS_DIRECT_MODE) | ||
void ModelProcess::notifyPreferencesChanged(const String& domain, const String& key, const std::optional<String>& encodedValue) | ||
{ | ||
preferenceDidUpdate(domain, key, encodedValue); | ||
} | ||
|
||
void ModelProcess::dispatchSimulatedNotificationsForPreferenceChange(const String& key) | ||
{ | ||
} | ||
#endif // ENABLE(CFPREFS_DIRECT_MODE) | ||
|
||
} // namespace WebKit | ||
|
||
#endif // ENABLE(MODEL_PROCESS) |
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,56 @@ | ||
/* | ||
* Copyright (C) 2024 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 "ModelProcess.h" | ||
|
||
#if ENABLE(MODEL_PROCESS) | ||
|
||
#import "ModelProcessCreationParameters.h" | ||
#import "ModelProcessProxyMessages.h" | ||
#import "SandboxInitializationParameters.h" | ||
#import <WebCore/NotImplemented.h> | ||
#import <WebCore/WebCoreThreadSystemInterface.h> | ||
|
||
namespace WebKit { | ||
using namespace WebCore; | ||
|
||
void ModelProcess::initializeProcess(const AuxiliaryProcessInitializationParameters&) | ||
{ | ||
InitWebCoreThreadSystemInterface(); | ||
} | ||
|
||
void ModelProcess::initializeProcessName(const AuxiliaryProcessInitializationParameters&) | ||
{ | ||
notImplemented(); | ||
} | ||
|
||
void ModelProcess::initializeSandbox(const AuxiliaryProcessInitializationParameters&, SandboxInitializationParameters&) | ||
{ | ||
} | ||
|
||
} // namespace WebKit | ||
|
||
#endif // ENABLE(MODEL_PROCESS) |
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
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
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
Oops, something went wrong.