WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Patch
bug-226919-20210611181140.patch (text/plain), 104.14 KB, created by
Imanol Fernandez
on 2021-06-11 09:11:42 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Imanol Fernandez
Created:
2021-06-11 09:11:42 PDT
Size:
104.14 KB
patch
obsolete
>Subversion Revision: 278756 >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index 8e14785533b6ad4575d38da1bdd4435bfcf46fe8..79b6bfbe77a5527ff819cc68060242f5c3e8ff99 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,48 @@ >+2021-06-11 Imanol Fernandez <ifernandez@igalia.com> >+ >+ Cross platform compilation of PlatformXRSystem and PlatformXRSystemProxy >+ https://bugs.webkit.org/show_bug.cgi?id=226919 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ PlatformXRSystem and PlatformXRSystemProxy are only compiled in Cocoa platform while WPE uses OpenXR, >+ which only has code in WebCore. In order to run WebKit based WebXR on non-cocoa VR Standalone devices >+ we also need to split the code and IPC messages between UIProcess/WebProcess. >+ >+ The existing PlatformXRSystem/PlatformXRSystemProxy pattern fits very well to the VR standalone scenario. >+ This patch ensures that the existing code can be used in more platforms other than Cocoa. >+ >+ Tested by WebXR WPT. >+ >+ * CMakeLists.txt: >+ * DerivedSources.make: >+ * PlatformMac.cmake: >+ * Shared/XR/XRDeviceIdentifier.h: Renamed from Source/WebKit/Shared/Cocoa/XRDeviceIdentifier.h. >+ * Shared/XR/XRDeviceInfo.cpp: Renamed from Source/WebKit/Shared/Cocoa/XRDeviceInfo.mm. >+ * Shared/XR/XRDeviceInfo.h: Renamed from Source/WebKit/Shared/Cocoa/XRDeviceInfo.h. >+ * Shared/XR/XRDeviceProxy.cpp: Renamed from Source/WebKit/Shared/Cocoa/XRDeviceProxy.mm. >+ * Shared/XR/XRDeviceProxy.h: Renamed from Source/WebKit/Shared/Cocoa/XRDeviceProxy.h. >+ * Sources.txt: >+ * SourcesCocoa.txt: >+ * UIProcess/Cocoa/PlatformXRCoordinator.mm: Copied from Source/WebKit/WebProcess/cocoa/PlatformXRSystemProxy.messages.in. >+ * UIProcess/WebPageProxy.cpp: >+ (WebKit::WebPageProxy::didAttachToRunningProcess): >+ (WebKit::WebPageProxy::resetState): >+ * UIProcess/WebPageProxy.h: >+ * UIProcess/XR/PlatformXRCoordinator.h: Renamed from Source/WebKit/UIProcess/Cocoa/PlatformXRCoordinator.h. >+ * UIProcess/XR/PlatformXRSystem.cpp: Renamed from Source/WebKit/UIProcess/Cocoa/PlatformXRSystem.mm. >+ * UIProcess/XR/PlatformXRSystem.h: Renamed from Source/WebKit/UIProcess/Cocoa/PlatformXRSystem.h. >+ * UIProcess/XR/PlatformXRSystem.messages.in: Renamed from Source/WebKit/UIProcess/Cocoa/PlatformXRSystem.messages.in. >+ * WebProcess/WebCoreSupport/WebChromeClient.cpp: >+ * WebProcess/WebCoreSupport/WebChromeClient.h: >+ * WebProcess/WebPage/Cocoa/WebPageCocoa.mm: >+ * WebProcess/WebPage/WebPage.cpp: >+ (WebKit::WebPage::xrSystemProxy): >+ * WebProcess/WebPage/WebPage.h: >+ * WebProcess/XR/PlatformXRSystemProxy.cpp: Renamed from Source/WebKit/WebProcess/cocoa/PlatformXRSystemProxy.mm. >+ * WebProcess/XR/PlatformXRSystemProxy.h: Renamed from Source/WebKit/WebProcess/cocoa/PlatformXRSystemProxy.h. >+ * WebProcess/XR/PlatformXRSystemProxy.messages.in: Renamed from Source/WebKit/WebProcess/cocoa/PlatformXRSystemProxy.messages.in. >+ > 2021-06-10 Said Abou-Hallawa <said@apple.com> > > takeSnapshotWithConfiguration() should wait for the next flush before it does callSnapshotRect() >diff --git a/Source/WebKit/CMakeLists.txt b/Source/WebKit/CMakeLists.txt >index f631283859b877bd9688671289080ca29517137a..699996f836ad7daaf21b0535df2517a6330cfba5 100644 >--- a/Source/WebKit/CMakeLists.txt >+++ b/Source/WebKit/CMakeLists.txt >@@ -46,6 +46,7 @@ set(WebKit_INCLUDE_DIRECTORIES > "${WEBKIT_DIR}/Shared/Plugins/Netscape/x11" > "${WEBKIT_DIR}/Shared/RemoteLayerTree" > "${WEBKIT_DIR}/Shared/WebsiteData" >+ "${WEBKIT_DIR}/Shared/XR" > "${WEBKIT_DIR}/UIProcess" > "${WEBKIT_DIR}/UIProcess/API" > "${WEBKIT_DIR}/UIProcess/API/C" >@@ -68,6 +69,7 @@ set(WebKit_INCLUDE_DIRECTORIES > "${WEBKIT_DIR}/UIProcess/WebAuthentication" > "${WEBKIT_DIR}/UIProcess/WebAuthentication/Mock" > "${WEBKIT_DIR}/UIProcess/WebsiteData" >+ "${WEBKIT_DIR}/UIProcess/XR" > "${WEBKIT_DIR}/WebAuthnProcess" > "${WEBKIT_DIR}/WebProcess" > "${WEBKIT_DIR}/WebProcess/ApplePay" >@@ -108,6 +110,7 @@ set(WebKit_INCLUDE_DIRECTORIES > "${WEBKIT_DIR}/WebProcess/WebPage" > "${WEBKIT_DIR}/WebProcess/WebPage/RemoteLayerTree" > "${WEBKIT_DIR}/WebProcess/WebStorage" >+ "${WEBKIT_DIR}/WebProcess/XR" > "${CMAKE_SOURCE_DIR}/Source" > "${CMAKE_SOURCE_DIR}/WebKitLibraries" > ) >@@ -216,6 +219,8 @@ set(WebKit_MESSAGES_IN_FILES > > UIProcess/UserContent/WebUserContentControllerProxy > >+ UIProcess/XR/PlatformXRSystem >+ > WebProcess/WebProcess > > WebProcess/Automation/WebAutomationSessionProxy >@@ -285,6 +290,8 @@ set(WebKit_MESSAGES_IN_FILES > WebProcess/WebPage/WebPage > > WebProcess/WebStorage/StorageAreaMap >+ >+ WebProcess/XR/PlatformXRSystemProxy > ) > > set(WebKit_FRAMEWORKS >diff --git a/Source/WebKit/DerivedSources-input.xcfilelist b/Source/WebKit/DerivedSources-input.xcfilelist >index 0621e0341545dfca69e438d326b797fb8080af05..0358688d31fdfeef92b189422c62ca82be1368c4 100644 >--- a/Source/WebKit/DerivedSources-input.xcfilelist >+++ b/Source/WebKit/DerivedSources-input.xcfilelist >@@ -100,7 +100,6 @@ $(PROJECT_DIR)/Shared/Plugins/NPObjectMessageReceiver.messages.in > $(PROJECT_DIR)/Shared/WebConnection.messages.in > $(PROJECT_DIR)/UIProcess/Automation/Automation.json > $(PROJECT_DIR)/UIProcess/Automation/WebAutomationSession.messages.in >-$(PROJECT_DIR)/UIProcess/Cocoa/PlatformXRSystem.messages.in > $(PROJECT_DIR)/UIProcess/Cocoa/PlaybackSessionManagerProxy.messages.in > $(PROJECT_DIR)/UIProcess/Cocoa/UserMediaCaptureManagerProxy.messages.in > $(PROJECT_DIR)/UIProcess/Cocoa/VideoFullscreenManagerProxy.messages.in >@@ -130,6 +129,7 @@ $(PROJECT_DIR)/UIProcess/WebPageProxy.messages.in > $(PROJECT_DIR)/UIProcess/WebPasteboardProxy.messages.in > $(PROJECT_DIR)/UIProcess/WebProcessPool.messages.in > $(PROJECT_DIR)/UIProcess/WebProcessProxy.messages.in >+$(PROJECT_DIR)/UIProcess/XR/PlatformXRSystem.messages.in > $(PROJECT_DIR)/UIProcess/ios/EditableImageController.messages.in > $(PROJECT_DIR)/UIProcess/ios/SmartMagnificationController.messages.in > $(PROJECT_DIR)/UIProcess/ios/WebDeviceOrientationUpdateProviderProxy.messages.in >@@ -200,8 +200,8 @@ $(PROJECT_DIR)/WebProcess/WebPage/VisitedLinkTableController.messages.in > $(PROJECT_DIR)/WebProcess/WebPage/WebPage.messages.in > $(PROJECT_DIR)/WebProcess/WebProcess.messages.in > $(PROJECT_DIR)/WebProcess/WebStorage/StorageAreaMap.messages.in >+$(PROJECT_DIR)/WebProcess/XR/PlatformXRSystemProxy.messages.in > $(PROJECT_DIR)/WebProcess/cocoa/AudioCaptureSampleManager.messages.in >-$(PROJECT_DIR)/WebProcess/cocoa/PlatformXRSystemProxy.messages.in > $(PROJECT_DIR)/WebProcess/cocoa/PlaybackSessionManager.messages.in > $(PROJECT_DIR)/WebProcess/cocoa/RemoteCaptureSampleManager.messages.in > $(PROJECT_DIR)/WebProcess/cocoa/UserMediaCaptureManager.messages.in >diff --git a/Source/WebKit/DerivedSources.make b/Source/WebKit/DerivedSources.make >index da83bb2c5bd11fd01e5393a1df35c249de76de81..b9936307732f4bec47b3c609b209aad721163897 100644 >--- a/Source/WebKit/DerivedSources.make >+++ b/Source/WebKit/DerivedSources.make >@@ -162,7 +162,6 @@ MESSAGE_RECEIVERS = \ > UIProcess/ios/SmartMagnificationController \ > UIProcess/mac/SecItemShimProxy \ > UIProcess/WebGeolocationManagerProxy \ >- UIProcess/Cocoa/PlatformXRSystem \ > UIProcess/Cocoa/PlaybackSessionManagerProxy \ > UIProcess/Cocoa/UserMediaCaptureManagerProxy \ > UIProcess/Cocoa/VideoFullscreenManagerProxy \ >@@ -176,6 +175,7 @@ MESSAGE_RECEIVERS = \ > UIProcess/Media/RemoteMediaSessionCoordinatorProxy \ > UIProcess/SpeechRecognitionRemoteRealtimeMediaSourceManager \ > UIProcess/SpeechRecognitionServer \ >+ UIProcess/XR/PlatformXRSystem \ > WebProcess/Databases/IndexedDB/WebIDBConnectionToServer \ > WebProcess/GPU/GPUProcessConnection \ > WebProcess/GPU/graphics/RemoteRenderingBackendProxy \ >@@ -220,7 +220,6 @@ MESSAGE_RECEIVERS = \ > WebProcess/Storage/WebSWContextManagerConnection \ > WebProcess/Storage/WebSWClientConnection \ > WebProcess/WebProcess \ >- WebProcess/cocoa/PlatformXRSystemProxy \ > WebProcess/cocoa/PlaybackSessionManager \ > WebProcess/cocoa/RemoteCaptureSampleManager \ > WebProcess/cocoa/UserMediaCaptureManager \ >@@ -239,6 +238,7 @@ MESSAGE_RECEIVERS = \ > WebProcess/WebPage/Cocoa/TextCheckingControllerProxy \ > WebProcess/WebPage/ViewUpdateDispatcher \ > WebProcess/WebAuthentication/WebAuthnProcessConnection \ >+ WebProcess/XR/PlatformXRSystemProxy \ > PluginProcess/WebProcessConnection \ > PluginProcess/PluginControllerProxy \ > PluginProcess/PluginProcess \ >diff --git a/Source/WebKit/PlatformMac.cmake b/Source/WebKit/PlatformMac.cmake >index 650487a310abcb7577665b9fa771f106c4b333fa..e121312ad1ef3c03d0d1107e3e47ad08c892ad8c 100644 >--- a/Source/WebKit/PlatformMac.cmake >+++ b/Source/WebKit/PlatformMac.cmake >@@ -217,7 +217,6 @@ list(APPEND WebKit_MESSAGES_IN_FILES > > UIProcess/ViewGestureController > >- UIProcess/Cocoa/PlatformXRSystem > UIProcess/Cocoa/PlaybackSessionManagerProxy > UIProcess/Cocoa/UserMediaCaptureManagerProxy > UIProcess/Cocoa/VideoFullscreenManagerProxy >@@ -255,7 +254,6 @@ list(APPEND WebKit_MESSAGES_IN_FILES > > WebProcess/WebPage/RemoteLayerTree/RemoteScrollingCoordinator > >- WebProcess/cocoa/PlatformXRSystemProxy > WebProcess/cocoa/PlaybackSessionManager > WebProcess/cocoa/RemoteCaptureSampleManager > WebProcess/cocoa/UserMediaCaptureManager >diff --git a/Source/WebKit/Shared/Cocoa/XRDeviceIdentifier.h b/Source/WebKit/Shared/Cocoa/XRDeviceIdentifier.h >deleted file mode 100644 >index c818bb2badccea433afdba85ed0b68cdee99d164..0000000000000000000000000000000000000000 >--- a/Source/WebKit/Shared/Cocoa/XRDeviceIdentifier.h >+++ /dev/null >@@ -1,39 +0,0 @@ >-/* >- * Copyright (C) 2021 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 >- >-#if ENABLE(WEBXR) >- >-#include <wtf/ObjectIdentifier.h> >- >-namespace WebKit { >- >-enum XRDeviceIdentifierType { }; >-using XRDeviceIdentifier = ObjectIdentifier<XRDeviceIdentifierType>; >- >-} >- >-#endif // ENABLE(WEBXR) >diff --git a/Source/WebKit/Shared/Cocoa/XRDeviceInfo.h b/Source/WebKit/Shared/Cocoa/XRDeviceInfo.h >deleted file mode 100644 >index 308bb73e975b9db1d5f7431617755024c99b7b7d..0000000000000000000000000000000000000000 >--- a/Source/WebKit/Shared/Cocoa/XRDeviceInfo.h >+++ /dev/null >@@ -1,53 +0,0 @@ >-/* >- * Copyright (C) 2021 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 >- >-#if ENABLE(WEBXR) >- >-#include "XRDeviceIdentifier.h" >-#include <WebCore/PlatformXR.h> >- >-namespace IPC { >-class Decoder; >-class Encoder; >-} >- >-namespace WebKit { >- >-struct XRDeviceInfo { >- XRDeviceIdentifier identifier; >- bool supportsOrientationTracking { false }; >- bool supportsStereoRendering { false }; >- PlatformXR::Device::FeatureList features; >- WebCore::IntSize recommendedResolution { 0, 0 }; >- >- void encode(IPC::Encoder&) const; >- static std::optional<XRDeviceInfo> decode(IPC::Decoder&); >-}; >- >-} // namespace WebKit >- >-#endif // ENABLE(WEBXR) >diff --git a/Source/WebKit/Shared/Cocoa/XRDeviceInfo.mm b/Source/WebKit/Shared/Cocoa/XRDeviceInfo.mm >deleted file mode 100644 >index a90b8ddcb312e24220c54a830e7e687d419976a1..0000000000000000000000000000000000000000 >--- a/Source/WebKit/Shared/Cocoa/XRDeviceInfo.mm >+++ /dev/null >@@ -1,63 +0,0 @@ >-/* >- * Copyright (C) 2021 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 "XRDeviceInfo.h" >- >-#if ENABLE(WEBXR) >- >-#import "WebCoreArgumentCoders.h" >- >-namespace WebKit { >- >-void XRDeviceInfo::encode(IPC::Encoder& encoder) const >-{ >- encoder << identifier << supportsOrientationTracking << supportsStereoRendering << features << recommendedResolution; >-} >- >-std::optional<XRDeviceInfo> XRDeviceInfo::decode(IPC::Decoder& decoder) >-{ >- XRDeviceInfo deviceFeatures; >- if (!decoder.decode(deviceFeatures.identifier)) >- return std::nullopt; >- >- if (!decoder.decode(deviceFeatures.supportsOrientationTracking)) >- return std::nullopt; >- >- if (!decoder.decode(deviceFeatures.supportsStereoRendering)) >- return std::nullopt; >- >- if (!decoder.decode(deviceFeatures.features)) >- return std::nullopt; >- >- if (!decoder.decode(deviceFeatures.recommendedResolution)) >- return std::nullopt; >- >- return deviceFeatures; >-} >- >-} >- >-#endif // ENABLE(WEBXR) >diff --git a/Source/WebKit/Shared/Cocoa/XRDeviceProxy.h b/Source/WebKit/Shared/Cocoa/XRDeviceProxy.h >deleted file mode 100644 >index 46e4639466869a5e3d079f7acc7fa5582e69637d..0000000000000000000000000000000000000000 >--- a/Source/WebKit/Shared/Cocoa/XRDeviceProxy.h >+++ /dev/null >@@ -1,71 +0,0 @@ >-/* >- * Copyright (C) 2021 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 >- >-#if ENABLE(WEBXR) >- >-#include "XRDeviceIdentifier.h" >-#include <WebCore/PlatformXR.h> >-#include <wtf/Ref.h> >-#include <wtf/Vector.h> >-#include <wtf/WeakPtr.h> >- >-namespace WebKit { >- >-class PlatformXRSystemProxy; >- >-struct XRDeviceInfo; >- >-class XRDeviceProxy final : public PlatformXR::Device { >-public: >- static Ref<XRDeviceProxy> create(XRDeviceInfo&&, PlatformXRSystemProxy&); >- XRDeviceIdentifier identifier() const { return m_identifier; } >- >- void sessionDidEnd(); >- >-private: >- XRDeviceProxy(XRDeviceInfo&&, PlatformXRSystemProxy&); >- >- WebCore::IntSize recommendedResolution(PlatformXR::SessionMode) final { return m_recommendedResolution; } >- void initializeTrackingAndRendering(PlatformXR::SessionMode) final; >- void shutDownTrackingAndRendering() final; >- bool supportsSessionShutdownNotification() const final { return true; } >- void initializeReferenceSpace(PlatformXR::ReferenceSpaceType) final { } >- Vector<PlatformXR::Device::ViewData> views(PlatformXR::SessionMode) const final; >- void requestFrame(PlatformXR::Device::RequestFrameCallback&&) final; >- std::optional<PlatformXR::LayerHandle> createLayerProjection(uint32_t, uint32_t, bool) final; >- void deleteLayer(PlatformXR::LayerHandle) override { }; >- void submitFrame(Vector<PlatformXR::Device::Layer>&&) final; >- >- XRDeviceIdentifier m_identifier; >- WeakPtr<PlatformXRSystemProxy> m_xrSystem; >- bool m_supportsStereoRendering { false }; >- WebCore::IntSize m_recommendedResolution { 0, 0 }; >-}; >- >-} // namespace WebKit >- >-#endif // ENABLE(WEBXR) >diff --git a/Source/WebKit/Shared/Cocoa/XRDeviceProxy.mm b/Source/WebKit/Shared/Cocoa/XRDeviceProxy.mm >deleted file mode 100644 >index 5bfcb40ba650ab924367bb4774b719ccbc38cff6..0000000000000000000000000000000000000000 >--- a/Source/WebKit/Shared/Cocoa/XRDeviceProxy.mm >+++ /dev/null >@@ -1,105 +0,0 @@ >-/* >- * Copyright (C) 2021 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 "XRDeviceProxy.h" >- >-#if ENABLE(WEBXR) >- >-#import "PlatformXRSystemProxy.h" >-#import "XRDeviceInfo.h" >- >-using namespace PlatformXR; >- >-namespace WebKit { >- >-Ref<XRDeviceProxy> XRDeviceProxy::create(XRDeviceInfo&& deviceInfo, PlatformXRSystemProxy& xrSystem) >-{ >- return adoptRef(*new XRDeviceProxy(WTFMove(deviceInfo), xrSystem)); >-} >- >-XRDeviceProxy::XRDeviceProxy(XRDeviceInfo&& deviceInfo, PlatformXRSystemProxy& xrSystem) >- : m_xrSystem(makeWeakPtr(xrSystem)) >-{ >- m_identifier = deviceInfo.identifier; >- m_supportsStereoRendering = deviceInfo.supportsStereoRendering; >- m_supportsOrientationTracking = deviceInfo.supportsOrientationTracking; >- m_recommendedResolution = deviceInfo.recommendedResolution; >- if (!deviceInfo.features.isEmpty()) >- setEnabledFeatures(SessionMode::ImmersiveVr, deviceInfo.features); >-} >- >-void XRDeviceProxy::sessionDidEnd() >-{ >- if (trackingAndRenderingClient()) >- trackingAndRenderingClient()->sessionDidEnd(); >-} >- >-void XRDeviceProxy::initializeTrackingAndRendering(PlatformXR::SessionMode sessionMode) >-{ >- if (sessionMode != PlatformXR::SessionMode::ImmersiveVr) >- return; >- >- if (m_xrSystem) >- m_xrSystem->initializeTrackingAndRendering(); >-} >- >-void XRDeviceProxy::shutDownTrackingAndRendering() >-{ >- if (m_xrSystem) >- m_xrSystem->shutDownTrackingAndRendering(); >-} >- >-Vector<PlatformXR::Device::ViewData> XRDeviceProxy::views(SessionMode mode) const >-{ >- Vector<Device::ViewData> views; >- if (m_supportsStereoRendering && mode == SessionMode::ImmersiveVr) { >- views.append({ .active = true, Eye::Left }); >- views.append({ .active = true, Eye::Right }); >- } else >- views.append({ .active = true, Eye::None }); >- return views; >-} >- >-void XRDeviceProxy::requestFrame(PlatformXR::Device::RequestFrameCallback&& callback) >-{ >- if (m_xrSystem) >- m_xrSystem->requestFrame(WTFMove(callback)); >-} >- >-std::optional<PlatformXR::LayerHandle> XRDeviceProxy::createLayerProjection(uint32_t width, uint32_t height, bool alpha) >-{ >- return m_xrSystem ? m_xrSystem->createLayerProjection(width, height, alpha) : std::nullopt; >-} >- >-void XRDeviceProxy::submitFrame(Vector<PlatformXR::Device::Layer>&&) >-{ >- if (m_xrSystem) >- m_xrSystem->submitFrame(); >-} >- >-} // namespace WebKit >- >-#endif // ENABLE(WEBXR) >diff --git a/Source/WebKit/Shared/XR/XRDeviceIdentifier.h b/Source/WebKit/Shared/XR/XRDeviceIdentifier.h >new file mode 100644 >index 0000000000000000000000000000000000000000..c818bb2badccea433afdba85ed0b68cdee99d164 >--- /dev/null >+++ b/Source/WebKit/Shared/XR/XRDeviceIdentifier.h >@@ -0,0 +1,39 @@ >+/* >+ * Copyright (C) 2021 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 >+ >+#if ENABLE(WEBXR) >+ >+#include <wtf/ObjectIdentifier.h> >+ >+namespace WebKit { >+ >+enum XRDeviceIdentifierType { }; >+using XRDeviceIdentifier = ObjectIdentifier<XRDeviceIdentifierType>; >+ >+} >+ >+#endif // ENABLE(WEBXR) >diff --git a/Source/WebKit/Shared/XR/XRDeviceInfo.cpp b/Source/WebKit/Shared/XR/XRDeviceInfo.cpp >new file mode 100644 >index 0000000000000000000000000000000000000000..d0eb05d8f9bff4fea3093d6b588ba97e33c0aa26 >--- /dev/null >+++ b/Source/WebKit/Shared/XR/XRDeviceInfo.cpp >@@ -0,0 +1,63 @@ >+/* >+ * Copyright (C) 2021 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 "XRDeviceInfo.h" >+ >+#if ENABLE(WEBXR) >+ >+#include "WebCoreArgumentCoders.h" >+ >+namespace WebKit { >+ >+void XRDeviceInfo::encode(IPC::Encoder& encoder) const >+{ >+ encoder << identifier << supportsOrientationTracking << supportsStereoRendering << features << recommendedResolution; >+} >+ >+std::optional<XRDeviceInfo> XRDeviceInfo::decode(IPC::Decoder& decoder) >+{ >+ XRDeviceInfo deviceFeatures; >+ if (!decoder.decode(deviceFeatures.identifier)) >+ return std::nullopt; >+ >+ if (!decoder.decode(deviceFeatures.supportsOrientationTracking)) >+ return std::nullopt; >+ >+ if (!decoder.decode(deviceFeatures.supportsStereoRendering)) >+ return std::nullopt; >+ >+ if (!decoder.decode(deviceFeatures.features)) >+ return std::nullopt; >+ >+ if (!decoder.decode(deviceFeatures.recommendedResolution)) >+ return std::nullopt; >+ >+ return deviceFeatures; >+} >+ >+} >+ >+#endif // ENABLE(WEBXR) >diff --git a/Source/WebKit/Shared/XR/XRDeviceInfo.h b/Source/WebKit/Shared/XR/XRDeviceInfo.h >new file mode 100644 >index 0000000000000000000000000000000000000000..308bb73e975b9db1d5f7431617755024c99b7b7d >--- /dev/null >+++ b/Source/WebKit/Shared/XR/XRDeviceInfo.h >@@ -0,0 +1,53 @@ >+/* >+ * Copyright (C) 2021 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 >+ >+#if ENABLE(WEBXR) >+ >+#include "XRDeviceIdentifier.h" >+#include <WebCore/PlatformXR.h> >+ >+namespace IPC { >+class Decoder; >+class Encoder; >+} >+ >+namespace WebKit { >+ >+struct XRDeviceInfo { >+ XRDeviceIdentifier identifier; >+ bool supportsOrientationTracking { false }; >+ bool supportsStereoRendering { false }; >+ PlatformXR::Device::FeatureList features; >+ WebCore::IntSize recommendedResolution { 0, 0 }; >+ >+ void encode(IPC::Encoder&) const; >+ static std::optional<XRDeviceInfo> decode(IPC::Decoder&); >+}; >+ >+} // namespace WebKit >+ >+#endif // ENABLE(WEBXR) >diff --git a/Source/WebKit/Shared/XR/XRDeviceProxy.cpp b/Source/WebKit/Shared/XR/XRDeviceProxy.cpp >new file mode 100644 >index 0000000000000000000000000000000000000000..da708e9f044d3fec8f8bb2419e4d83309d87f359 >--- /dev/null >+++ b/Source/WebKit/Shared/XR/XRDeviceProxy.cpp >@@ -0,0 +1,105 @@ >+/* >+ * Copyright (C) 2021 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 "XRDeviceProxy.h" >+ >+#if ENABLE(WEBXR) >+ >+#include "PlatformXRSystemProxy.h" >+#include "XRDeviceInfo.h" >+ >+using namespace PlatformXR; >+ >+namespace WebKit { >+ >+Ref<XRDeviceProxy> XRDeviceProxy::create(XRDeviceInfo&& deviceInfo, PlatformXRSystemProxy& xrSystem) >+{ >+ return adoptRef(*new XRDeviceProxy(WTFMove(deviceInfo), xrSystem)); >+} >+ >+XRDeviceProxy::XRDeviceProxy(XRDeviceInfo&& deviceInfo, PlatformXRSystemProxy& xrSystem) >+ : m_xrSystem(makeWeakPtr(xrSystem)) >+{ >+ m_identifier = deviceInfo.identifier; >+ m_supportsStereoRendering = deviceInfo.supportsStereoRendering; >+ m_supportsOrientationTracking = deviceInfo.supportsOrientationTracking; >+ m_recommendedResolution = deviceInfo.recommendedResolution; >+ if (!deviceInfo.features.isEmpty()) >+ setEnabledFeatures(SessionMode::ImmersiveVr, deviceInfo.features); >+} >+ >+void XRDeviceProxy::sessionDidEnd() >+{ >+ if (trackingAndRenderingClient()) >+ trackingAndRenderingClient()->sessionDidEnd(); >+} >+ >+void XRDeviceProxy::initializeTrackingAndRendering(PlatformXR::SessionMode sessionMode) >+{ >+ if (sessionMode != PlatformXR::SessionMode::ImmersiveVr) >+ return; >+ >+ if (m_xrSystem) >+ m_xrSystem->initializeTrackingAndRendering(); >+} >+ >+void XRDeviceProxy::shutDownTrackingAndRendering() >+{ >+ if (m_xrSystem) >+ m_xrSystem->shutDownTrackingAndRendering(); >+} >+ >+Vector<PlatformXR::Device::ViewData> XRDeviceProxy::views(SessionMode mode) const >+{ >+ Vector<Device::ViewData> views; >+ if (m_supportsStereoRendering && mode == SessionMode::ImmersiveVr) { >+ views.append({ .active = true, Eye::Left }); >+ views.append({ .active = true, Eye::Right }); >+ } else >+ views.append({ .active = true, Eye::None }); >+ return views; >+} >+ >+void XRDeviceProxy::requestFrame(PlatformXR::Device::RequestFrameCallback&& callback) >+{ >+ if (m_xrSystem) >+ m_xrSystem->requestFrame(WTFMove(callback)); >+} >+ >+std::optional<PlatformXR::LayerHandle> XRDeviceProxy::createLayerProjection(uint32_t width, uint32_t height, bool alpha) >+{ >+ return m_xrSystem ? m_xrSystem->createLayerProjection(width, height, alpha) : std::nullopt; >+} >+ >+void XRDeviceProxy::submitFrame(Vector<PlatformXR::Device::Layer>&&) >+{ >+ if (m_xrSystem) >+ m_xrSystem->submitFrame(); >+} >+ >+} // namespace WebKit >+ >+#endif // ENABLE(WEBXR) >diff --git a/Source/WebKit/Shared/XR/XRDeviceProxy.h b/Source/WebKit/Shared/XR/XRDeviceProxy.h >new file mode 100644 >index 0000000000000000000000000000000000000000..46e4639466869a5e3d079f7acc7fa5582e69637d >--- /dev/null >+++ b/Source/WebKit/Shared/XR/XRDeviceProxy.h >@@ -0,0 +1,71 @@ >+/* >+ * Copyright (C) 2021 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 >+ >+#if ENABLE(WEBXR) >+ >+#include "XRDeviceIdentifier.h" >+#include <WebCore/PlatformXR.h> >+#include <wtf/Ref.h> >+#include <wtf/Vector.h> >+#include <wtf/WeakPtr.h> >+ >+namespace WebKit { >+ >+class PlatformXRSystemProxy; >+ >+struct XRDeviceInfo; >+ >+class XRDeviceProxy final : public PlatformXR::Device { >+public: >+ static Ref<XRDeviceProxy> create(XRDeviceInfo&&, PlatformXRSystemProxy&); >+ XRDeviceIdentifier identifier() const { return m_identifier; } >+ >+ void sessionDidEnd(); >+ >+private: >+ XRDeviceProxy(XRDeviceInfo&&, PlatformXRSystemProxy&); >+ >+ WebCore::IntSize recommendedResolution(PlatformXR::SessionMode) final { return m_recommendedResolution; } >+ void initializeTrackingAndRendering(PlatformXR::SessionMode) final; >+ void shutDownTrackingAndRendering() final; >+ bool supportsSessionShutdownNotification() const final { return true; } >+ void initializeReferenceSpace(PlatformXR::ReferenceSpaceType) final { } >+ Vector<PlatformXR::Device::ViewData> views(PlatformXR::SessionMode) const final; >+ void requestFrame(PlatformXR::Device::RequestFrameCallback&&) final; >+ std::optional<PlatformXR::LayerHandle> createLayerProjection(uint32_t, uint32_t, bool) final; >+ void deleteLayer(PlatformXR::LayerHandle) override { }; >+ void submitFrame(Vector<PlatformXR::Device::Layer>&&) final; >+ >+ XRDeviceIdentifier m_identifier; >+ WeakPtr<PlatformXRSystemProxy> m_xrSystem; >+ bool m_supportsStereoRendering { false }; >+ WebCore::IntSize m_recommendedResolution { 0, 0 }; >+}; >+ >+} // namespace WebKit >+ >+#endif // ENABLE(WEBXR) >diff --git a/Source/WebKit/Sources.txt b/Source/WebKit/Sources.txt >index d54a1549aa78709dd5e6ee1cbaba4b570a6cfed8..b118f8c6919043fc302adb90107da8433bfecb7b 100644 >--- a/Source/WebKit/Sources.txt >+++ b/Source/WebKit/Sources.txt >@@ -289,6 +289,9 @@ Shared/Plugins/Netscape/PluginInformation.cpp @no-unify > > Shared/WebsiteData/WebsiteData.cpp > >+Shared/XR/XRDeviceInfo.cpp >+Shared/XR/XRDeviceProxy.cpp >+ > UIProcess/AuxiliaryProcessProxy.cpp > UIProcess/BackgroundProcessResponsivenessTimer.cpp > UIProcess/DeviceIdHashSaltStorage.cpp >@@ -505,6 +508,8 @@ UIProcess/WebsiteData/WebsiteDataRecord.cpp > UIProcess/WebsiteData/WebsiteDataStore.cpp > UIProcess/WebsiteData/WebsiteDataStoreConfiguration.cpp > >+UIProcess/XR/PlatformXRSystem.cpp >+ > WebAuthnProcess/WebAuthnConnectionToWebProcess.cpp > WebAuthnProcess/WebAuthnProcess.cpp > WebAuthnProcess/WebAuthnProcessCreationParameters.cpp >@@ -724,8 +729,12 @@ WebProcess/WebStorage/StorageAreaMap.cpp > WebProcess/WebStorage/StorageNamespaceImpl.cpp > WebProcess/WebStorage/WebStorageNamespaceProvider.cpp > >+WebProcess/XR/PlatformXRSystemProxy.cpp >+ > RTCDataChannelRemoteManagerMessageReceiver.cpp > RTCDataChannelRemoteManagerProxyMessageReceiver.cpp > RemoteAudioMediaStreamTrackRendererInternalUnitManagerMessageReceiver.cpp > RemoteGraphicsContextGLMessageReceiver.cpp > RemoteGraphicsContextGLProxyMessageReceiver.cpp >+PlatformXRSystemMessageReceiver.cpp >+PlatformXRSystemProxyMessageReceiver.cpp >diff --git a/Source/WebKit/SourcesCocoa.txt b/Source/WebKit/SourcesCocoa.txt >index 8cfc6074d0562aa582c5c0d23488ee636b2c9a9c..01f00a64a0cf57d03791a0883806ac078f34fe64 100644 >--- a/Source/WebKit/SourcesCocoa.txt >+++ b/Source/WebKit/SourcesCocoa.txt >@@ -184,8 +184,6 @@ Shared/Cocoa/WKNSURLExtras.mm > Shared/Cocoa/WKNSURLRequest.mm > Shared/Cocoa/WKObject.mm > Shared/Cocoa/WebPreferencesDefaultValuesCocoa.mm >-Shared/Cocoa/XRDeviceInfo.mm >-Shared/Cocoa/XRDeviceProxy.mm > > Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceEntryPoint.mm > Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm >@@ -398,7 +396,7 @@ UIProcess/Cocoa/MediaUtilities.mm > UIProcess/Cocoa/MediaPermissionUtilities.mm > UIProcess/Cocoa/NavigationState.mm > UIProcess/Cocoa/PageClientImplCocoa.mm >-UIProcess/Cocoa/PlatformXRSystem.mm >+UIProcess/Cocoa/PlatformXRCoordinator.mm > UIProcess/Cocoa/PlaybackSessionManagerProxy.mm > UIProcess/Cocoa/ResourceLoadDelegate.mm > UIProcess/Cocoa/SafeBrowsingWarningCocoa.mm >@@ -594,7 +592,6 @@ WebProcess/ApplePay/WebPaymentCoordinator.cpp > > WebProcess/ApplePay/cocoa/WebPaymentCoordinatorCocoa.mm > >-WebProcess/cocoa/PlatformXRSystemProxy.mm > WebProcess/cocoa/PlaybackSessionManager.mm > WebProcess/cocoa/RemoteCaptureSampleManager.cpp > WebProcess/cocoa/RemoteRealtimeAudioSource.cpp >@@ -711,8 +708,6 @@ GPUProcessMessageReceiver.cpp > LibWebRTCCodecsProxyMessageReceiver.cpp > LibWebRTCCodecsMessageReceiver.cpp > MessageNames.cpp >-PlatformXRSystemMessageReceiver.cpp >-PlatformXRSystemProxyMessageReceiver.cpp > RemoteAudioDestinationManagerMessageReceiver.cpp > RemoteAudioHardwareListenerMessageReceiver.cpp > RemoteAudioSessionMessageReceiver.cpp >diff --git a/Source/WebKit/UIProcess/Cocoa/PlatformXRCoordinator.h b/Source/WebKit/UIProcess/Cocoa/PlatformXRCoordinator.h >deleted file mode 100644 >index 0316118fcf6f71e45d9dc5ed466ac748707a3cc0..0000000000000000000000000000000000000000 >--- a/Source/WebKit/UIProcess/Cocoa/PlatformXRCoordinator.h >+++ /dev/null >@@ -1,61 +0,0 @@ >-/* >- * Copyright (C) 2021 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 >- >-#if ENABLE(WEBXR) >- >-#include "XRDeviceIdentifier.h" >-#include "XRDeviceInfo.h" >-#include <WebCore/PlatformXR.h> >-#include <wtf/Function.h> >- >-namespace WebKit { >- >-class WebPageProxy; >- >-class PlatformXRCoordinator { >-public: >- virtual ~PlatformXRCoordinator() = default; >- >- // FIXME: Temporary and will be fixed later. >- static PlatformXR::LayerHandle defaultLayerHandle() { return 1; } >- >- using DeviceInfoCallback = Function<void(std::optional<XRDeviceInfo>)>; >- virtual void getPrimaryDeviceInfo(DeviceInfoCallback&&) = 0; >- >- // Session creation/termination. >- using OnSessionEndCallback = Function<void(XRDeviceIdentifier)>; >- virtual void startSession(WebPageProxy&, OnSessionEndCallback&&) = 0; >- virtual void endSessionIfExists(WebPageProxy&) = 0; >- >- // Session display loop. >- virtual void scheduleAnimationFrame(WebPageProxy&, PlatformXR::Device::RequestFrameCallback&&) = 0; >- virtual void submitFrame(WebPageProxy&) { } >-}; >- >-} // namespace WebKit >- >-#endif // ENABLE(WEBXR) >diff --git a/Source/WebKit/UIProcess/Cocoa/PlatformXRCoordinator.mm b/Source/WebKit/UIProcess/Cocoa/PlatformXRCoordinator.mm >new file mode 100644 >index 0000000000000000000000000000000000000000..5dd5a55d04cbd6f0b99035f10fcbb5dc42b7b995 >--- /dev/null >+++ b/Source/WebKit/UIProcess/Cocoa/PlatformXRCoordinator.mm >@@ -0,0 +1,33 @@ >+/* >+ * Copyright (C) 2017 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 "PlatformXRCoordinator.h" >+ >+#if ENABLE(WEBXR) && USE(APPLE_INTERNAL_SDK) >+ >+#import <WebKitAdditions/PlatformXRSystemAdditions.mm> >+ >+#endif // ENABLE(WEBXR) && USE(APPLE_INTERNAL_SDK) >diff --git a/Source/WebKit/UIProcess/Cocoa/PlatformXRSystem.h b/Source/WebKit/UIProcess/Cocoa/PlatformXRSystem.h >deleted file mode 100644 >index b044ad16e994b9763ee5d6eceee08583da17affa..0000000000000000000000000000000000000000 >--- a/Source/WebKit/UIProcess/Cocoa/PlatformXRSystem.h >+++ /dev/null >@@ -1,66 +0,0 @@ >-/* >- * Copyright (C) 2021 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 >- >-#if ENABLE(WEBXR) >- >-#include "MessageReceiver.h" >-#include <WebCore/PlatformXR.h> >- >-namespace WebKit { >- >-class PlatformXRCoordinator; >-class WebPageProxy; >- >-struct XRDeviceInfo; >- >-class PlatformXRSystem : public IPC::MessageReceiver { >- WTF_MAKE_FAST_ALLOCATED; >-public: >- PlatformXRSystem(WebPageProxy&); >- virtual ~PlatformXRSystem(); >- >- void invalidate(); >- >-private: >- static PlatformXRCoordinator* xrCoordinator(); >- >- // IPC::MessageReceiver >- void didReceiveMessage(IPC::Connection&, IPC::Decoder&) final; >- >- // Message handlers >- void enumerateImmersiveXRDevices(CompletionHandler<void(Vector<XRDeviceInfo>&&)>&&); >- void initializeTrackingAndRendering(); >- void shutDownTrackingAndRendering(); >- void requestFrame(CompletionHandler<void(PlatformXR::Device::FrameData&&)>&&); >- void submitFrame(); >- >- WebPageProxy& m_page; >-}; >- >-} // namespace WebKit >- >-#endif // ENABLE(WEBXR) >diff --git a/Source/WebKit/UIProcess/Cocoa/PlatformXRSystem.messages.in b/Source/WebKit/UIProcess/Cocoa/PlatformXRSystem.messages.in >deleted file mode 100644 >index f453aad90c3176b8ba1f86fc0f395d2d00046608..0000000000000000000000000000000000000000 >--- a/Source/WebKit/UIProcess/Cocoa/PlatformXRSystem.messages.in >+++ /dev/null >@@ -1,36 +0,0 @@ >-/* >- * Copyright (C) 2021 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. >- */ >- >-#if PLATFORM(COCOA) && ENABLE(WEBXR) >- >-messages -> PlatformXRSystem NotRefCounted { >- EnumerateImmersiveXRDevices() -> (Vector<WebKit::XRDeviceInfo> devicesInfos) Async >- InitializeTrackingAndRendering() >- ShutDownTrackingAndRendering() >- RequestFrame() -> (struct PlatformXR::Device::FrameData frameData) Async >- SubmitFrame() >-} >- >-#endif >diff --git a/Source/WebKit/UIProcess/Cocoa/PlatformXRSystem.mm b/Source/WebKit/UIProcess/Cocoa/PlatformXRSystem.mm >deleted file mode 100644 >index b7f3d7f498c6bc31ee507738d212594e7f9c6fc3..0000000000000000000000000000000000000000 >--- a/Source/WebKit/UIProcess/Cocoa/PlatformXRSystem.mm >+++ /dev/null >@@ -1,123 +0,0 @@ >-/* >- * Copyright (C) 2021 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 "PlatformXRSystem.h" >- >-#if ENABLE(WEBXR) >- >-#import "PlatformXRCoordinator.h" >-#import "PlatformXRSystemMessages.h" >-#import "PlatformXRSystemProxyMessages.h" >-#import "WebPageProxy.h" >-#import "WebProcessProxy.h" >- >-namespace WebKit { >- >-PlatformXRSystem::PlatformXRSystem(WebPageProxy& page) >- : m_page(page) >-{ >- m_page.process().addMessageReceiver(Messages::PlatformXRSystem::messageReceiverName(), m_page.webPageID(), *this); >-} >- >-PlatformXRSystem::~PlatformXRSystem() >-{ >- m_page.process().removeMessageReceiver(Messages::PlatformXRSystem::messageReceiverName(), m_page.webPageID()); >-} >- >-void PlatformXRSystem::invalidate() >-{ >- if (xrCoordinator()) >- xrCoordinator()->endSessionIfExists(m_page); >-} >- >-void PlatformXRSystem::enumerateImmersiveXRDevices(CompletionHandler<void(Vector<XRDeviceInfo>&&)>&& completionHandler) >-{ >- auto* xrCoordinator = PlatformXRSystem::xrCoordinator(); >- if (!xrCoordinator) { >- completionHandler({ }); >- return; >- } >- >- xrCoordinator->getPrimaryDeviceInfo([completionHandler = WTFMove(completionHandler)](std::optional<XRDeviceInfo> deviceInfo) mutable { >- RunLoop::main().dispatch([completionHandler = WTFMove(completionHandler), deviceInfo = WTFMove(deviceInfo)]() mutable { >- if (!deviceInfo) { >- completionHandler({ }); >- return; >- } >- >- completionHandler({ deviceInfo.value() }); >- }); >- }); >-} >- >-void PlatformXRSystem::initializeTrackingAndRendering() >-{ >- auto* xrCoordinator = PlatformXRSystem::xrCoordinator(); >- if (!xrCoordinator) >- return; >- >- xrCoordinator->startSession(m_page, [weakThis = makeWeakPtr(*this)](XRDeviceIdentifier deviceIdentifier) { >- RunLoop::main().dispatch([weakThis, deviceIdentifier]() mutable { >- if (weakThis) >- weakThis->m_page.send(Messages::PlatformXRSystemProxy::SessionDidEnd(deviceIdentifier)); >- }); >- }); >-} >- >-void PlatformXRSystem::shutDownTrackingAndRendering() >-{ >- if (auto* xrCoordinator = PlatformXRSystem::xrCoordinator()) >- xrCoordinator->endSessionIfExists(m_page); >-} >- >-void PlatformXRSystem::requestFrame(CompletionHandler<void(PlatformXR::Device::FrameData&&)>&& completionHandler) >-{ >- if (auto* xrCoordinator = PlatformXRSystem::xrCoordinator()) >- xrCoordinator->scheduleAnimationFrame(m_page, WTFMove(completionHandler)); >-} >- >-void PlatformXRSystem::submitFrame() >-{ >- if (auto* xrCoordinator = PlatformXRSystem::xrCoordinator()) >- xrCoordinator->submitFrame(m_page); >-} >- >-} >- >-#if USE(APPLE_INTERNAL_SDK) >-#include <WebKitAdditions/PlatformXRSystemAdditions.mm> >-#else >-namespace WebKit { >- >-PlatformXRCoordinator* PlatformXRSystem::xrCoordinator() >-{ >- return nullptr; >-} >- >-} >-#endif >- >-#endif // ENABLE(WEBXR) >diff --git a/Source/WebKit/UIProcess/WebPageProxy.cpp b/Source/WebKit/UIProcess/WebPageProxy.cpp >index 35fc94bfd4e14ba33cd67ba4c6e787f361709af0..1c2efc32ff6f5637085267670b7e030db6953a34 100644 >--- a/Source/WebKit/UIProcess/WebPageProxy.cpp >+++ b/Source/WebKit/UIProcess/WebPageProxy.cpp >@@ -1032,7 +1032,7 @@ void WebPageProxy::didAttachToRunningProcess() > m_webDeviceOrientationUpdateProviderProxy = makeUnique<WebDeviceOrientationUpdateProviderProxy>(*this); > #endif > >-#if ENABLE(WEBXR) && PLATFORM(COCOA) >+#if ENABLE(WEBXR) && !USE(OPENXR) > ASSERT(!m_xrSystem); > m_xrSystem = makeUnique<PlatformXRSystem>(*this); > #endif >@@ -7792,7 +7792,7 @@ void WebPageProxy::resetState(ResetStateReason resetStateReason) > > m_speechRecognitionPermissionManager = nullptr; > >-#if ENABLE(WEBXR) && PLATFORM(COCOA) >+#if ENABLE(WEBXR) && !USE(OPENXR) > if (m_xrSystem) { > m_xrSystem->invalidate(); > m_xrSystem = nullptr; >diff --git a/Source/WebKit/UIProcess/WebPageProxy.h b/Source/WebKit/UIProcess/WebPageProxy.h >index 485f74b4ebfae8add9f29061ccde3fbbf67b00f9..edcda3f19c2c9934be4e07f04aabe98fee75368b 100644 >--- a/Source/WebKit/UIProcess/WebPageProxy.h >+++ b/Source/WebKit/UIProcess/WebPageProxy.h >@@ -185,7 +185,7 @@ interface ID3D11Device1; > #include <WebCore/MediaSessionIdentifier.h> > #endif > >-#if ENABLE(WEBXR) && PLATFORM(COCOA) >+#if ENABLE(WEBXR) && !USE(OPENXR) > #include "PlatformXRSystem.h" > #endif > >@@ -3043,7 +3043,7 @@ private: > > std::optional<WebCore::PrivateClickMeasurement> m_privateClickMeasurement; > >-#if ENABLE(WEBXR) && PLATFORM(COCOA) >+#if ENABLE(WEBXR) && !USE(OPENXR) > std::unique_ptr<PlatformXRSystem> m_xrSystem; > #endif > >diff --git a/Source/WebKit/UIProcess/XR/PlatformXRCoordinator.h b/Source/WebKit/UIProcess/XR/PlatformXRCoordinator.h >new file mode 100644 >index 0000000000000000000000000000000000000000..0316118fcf6f71e45d9dc5ed466ac748707a3cc0 >--- /dev/null >+++ b/Source/WebKit/UIProcess/XR/PlatformXRCoordinator.h >@@ -0,0 +1,61 @@ >+/* >+ * Copyright (C) 2021 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 >+ >+#if ENABLE(WEBXR) >+ >+#include "XRDeviceIdentifier.h" >+#include "XRDeviceInfo.h" >+#include <WebCore/PlatformXR.h> >+#include <wtf/Function.h> >+ >+namespace WebKit { >+ >+class WebPageProxy; >+ >+class PlatformXRCoordinator { >+public: >+ virtual ~PlatformXRCoordinator() = default; >+ >+ // FIXME: Temporary and will be fixed later. >+ static PlatformXR::LayerHandle defaultLayerHandle() { return 1; } >+ >+ using DeviceInfoCallback = Function<void(std::optional<XRDeviceInfo>)>; >+ virtual void getPrimaryDeviceInfo(DeviceInfoCallback&&) = 0; >+ >+ // Session creation/termination. >+ using OnSessionEndCallback = Function<void(XRDeviceIdentifier)>; >+ virtual void startSession(WebPageProxy&, OnSessionEndCallback&&) = 0; >+ virtual void endSessionIfExists(WebPageProxy&) = 0; >+ >+ // Session display loop. >+ virtual void scheduleAnimationFrame(WebPageProxy&, PlatformXR::Device::RequestFrameCallback&&) = 0; >+ virtual void submitFrame(WebPageProxy&) { } >+}; >+ >+} // namespace WebKit >+ >+#endif // ENABLE(WEBXR) >diff --git a/Source/WebKit/UIProcess/XR/PlatformXRSystem.cpp b/Source/WebKit/UIProcess/XR/PlatformXRSystem.cpp >new file mode 100644 >index 0000000000000000000000000000000000000000..2ce2cba6679e536df774b420a03a201e1b1ccb0f >--- /dev/null >+++ b/Source/WebKit/UIProcess/XR/PlatformXRSystem.cpp >@@ -0,0 +1,121 @@ >+/* >+ * Copyright (C) 2021 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 "PlatformXRSystem.h" >+ >+#if ENABLE(WEBXR) >+ >+#include "PlatformXRCoordinator.h" >+#include "PlatformXRSystemMessages.h" >+#include "PlatformXRSystemProxyMessages.h" >+#include "WebPageProxy.h" >+#include "WebProcessProxy.h" >+ >+namespace WebKit { >+ >+PlatformXRSystem::PlatformXRSystem(WebPageProxy& page) >+ : m_page(page) >+{ >+ m_page.process().addMessageReceiver(Messages::PlatformXRSystem::messageReceiverName(), m_page.webPageID(), *this); >+} >+ >+PlatformXRSystem::~PlatformXRSystem() >+{ >+ m_page.process().removeMessageReceiver(Messages::PlatformXRSystem::messageReceiverName(), m_page.webPageID()); >+} >+ >+void PlatformXRSystem::invalidate() >+{ >+ if (xrCoordinator()) >+ xrCoordinator()->endSessionIfExists(m_page); >+} >+ >+void PlatformXRSystem::enumerateImmersiveXRDevices(CompletionHandler<void(Vector<XRDeviceInfo>&&)>&& completionHandler) >+{ >+ auto* xrCoordinator = PlatformXRSystem::xrCoordinator(); >+ if (!xrCoordinator) { >+ completionHandler({ }); >+ return; >+ } >+ >+ xrCoordinator->getPrimaryDeviceInfo([completionHandler = WTFMove(completionHandler)](std::optional<XRDeviceInfo> deviceInfo) mutable { >+ RunLoop::main().dispatch([completionHandler = WTFMove(completionHandler), deviceInfo = WTFMove(deviceInfo)]() mutable { >+ if (!deviceInfo) { >+ completionHandler({ }); >+ return; >+ } >+ >+ completionHandler({ deviceInfo.value() }); >+ }); >+ }); >+} >+ >+void PlatformXRSystem::initializeTrackingAndRendering() >+{ >+ auto* xrCoordinator = PlatformXRSystem::xrCoordinator(); >+ if (!xrCoordinator) >+ return; >+ >+ xrCoordinator->startSession(m_page, [weakThis = makeWeakPtr(*this)](XRDeviceIdentifier deviceIdentifier) { >+ RunLoop::main().dispatch([weakThis, deviceIdentifier]() mutable { >+ if (weakThis) >+ weakThis->m_page.send(Messages::PlatformXRSystemProxy::SessionDidEnd(deviceIdentifier)); >+ }); >+ }); >+} >+ >+void PlatformXRSystem::shutDownTrackingAndRendering() >+{ >+ if (auto* xrCoordinator = PlatformXRSystem::xrCoordinator()) >+ xrCoordinator->endSessionIfExists(m_page); >+} >+ >+void PlatformXRSystem::requestFrame(CompletionHandler<void(PlatformXR::Device::FrameData&&)>&& completionHandler) >+{ >+ if (auto* xrCoordinator = PlatformXRSystem::xrCoordinator()) >+ xrCoordinator->scheduleAnimationFrame(m_page, WTFMove(completionHandler)); >+} >+ >+void PlatformXRSystem::submitFrame() >+{ >+ if (auto* xrCoordinator = PlatformXRSystem::xrCoordinator()) >+ xrCoordinator->submitFrame(m_page); >+} >+ >+} >+ >+#if !USE(APPLE_INTERNAL_SDK) >+namespace WebKit { >+ >+PlatformXRCoordinator* PlatformXRSystem::xrCoordinator() >+{ >+ return nullptr; >+} >+ >+} >+#endif >+ >+#endif // ENABLE(WEBXR) >diff --git a/Source/WebKit/UIProcess/XR/PlatformXRSystem.h b/Source/WebKit/UIProcess/XR/PlatformXRSystem.h >new file mode 100644 >index 0000000000000000000000000000000000000000..cdae453d72cc7264115e888dac1360b54dc6dc46 >--- /dev/null >+++ b/Source/WebKit/UIProcess/XR/PlatformXRSystem.h >@@ -0,0 +1,67 @@ >+/* >+ * Copyright (C) 2021 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 >+ >+#if ENABLE(WEBXR) >+ >+#include "MessageReceiver.h" >+#include "WebCoreArgumentCoders.h" >+#include <WebCore/PlatformXR.h> >+ >+namespace WebKit { >+ >+class PlatformXRCoordinator; >+class WebPageProxy; >+ >+struct XRDeviceInfo; >+ >+class PlatformXRSystem : public IPC::MessageReceiver { >+ WTF_MAKE_FAST_ALLOCATED; >+public: >+ PlatformXRSystem(WebPageProxy&); >+ virtual ~PlatformXRSystem(); >+ >+ void invalidate(); >+ >+private: >+ static PlatformXRCoordinator* xrCoordinator(); >+ >+ // IPC::MessageReceiver >+ void didReceiveMessage(IPC::Connection&, IPC::Decoder&) final; >+ >+ // Message handlers >+ void enumerateImmersiveXRDevices(CompletionHandler<void(Vector<XRDeviceInfo>&&)>&&); >+ void initializeTrackingAndRendering(); >+ void shutDownTrackingAndRendering(); >+ void requestFrame(CompletionHandler<void(PlatformXR::Device::FrameData&&)>&&); >+ void submitFrame(); >+ >+ WebPageProxy& m_page; >+}; >+ >+} // namespace WebKit >+ >+#endif // ENABLE(WEBXR) >diff --git a/Source/WebKit/UIProcess/XR/PlatformXRSystem.messages.in b/Source/WebKit/UIProcess/XR/PlatformXRSystem.messages.in >new file mode 100644 >index 0000000000000000000000000000000000000000..5f4c8bb62646934b0662ef13be161ed52f52bbef >--- /dev/null >+++ b/Source/WebKit/UIProcess/XR/PlatformXRSystem.messages.in >@@ -0,0 +1,36 @@ >+/* >+ * Copyright (C) 2021 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. >+ */ >+ >+#if ENABLE(WEBXR) >+ >+messages -> PlatformXRSystem NotRefCounted { >+ EnumerateImmersiveXRDevices() -> (Vector<WebKit::XRDeviceInfo> devicesInfos) Async >+ InitializeTrackingAndRendering() >+ ShutDownTrackingAndRendering() >+ RequestFrame() -> (struct PlatformXR::Device::FrameData frameData) Async >+ SubmitFrame() >+} >+ >+#endif >diff --git a/Source/WebKit/WebKit.xcodeproj/project.pbxproj b/Source/WebKit/WebKit.xcodeproj/project.pbxproj >index c9763b6f13915051c0bc4135172cc2ea7c4dff37..c4ec65f4725a7d6edc8a9e81847c3ed1c48e7580 100644 >--- a/Source/WebKit/WebKit.xcodeproj/project.pbxproj >+++ b/Source/WebKit/WebKit.xcodeproj/project.pbxproj >@@ -3,7 +3,7 @@ > archiveVersion = 1; > classes = { > }; >- objectVersion = 52; >+ objectVersion = 54; > objects = { > > /* Begin PBXAggregateTarget section */ >@@ -1113,12 +1113,6 @@ > 51FAEC3A1B0657630009C4E7 /* AuxiliaryProcessMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 51FAEC371B0657310009C4E7 /* AuxiliaryProcessMessages.h */; }; > 51FAEC3B1B0657680009C4E7 /* AuxiliaryProcessMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51FAEC361B0657310009C4E7 /* AuxiliaryProcessMessageReceiver.cpp */; }; > 51FD18B61651FBAD00DBE1CE /* NetworkResourceLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 51FD18B41651FBAD00DBE1CE /* NetworkResourceLoader.h */; }; >- 525080B1261BDE6C00678AEE /* XRDeviceIdentifier.h in Headers */ = {isa = PBXBuildFile; fileRef = 525080AE261BDE6B00678AEE /* XRDeviceIdentifier.h */; }; >- 525080B2261BDE6C00678AEE /* XRDeviceInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 525080AF261BDE6C00678AEE /* XRDeviceInfo.h */; }; >- 5263E257261E73DF0018D47D /* XRDeviceProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 5263E255261E73DF0018D47D /* XRDeviceProxy.h */; }; >- 5263E25A261E93A70018D47D /* PlatformXRCoordinator.h in Headers */ = {isa = PBXBuildFile; fileRef = 5263E24D261E6FB90018D47D /* PlatformXRCoordinator.h */; }; >- 5263E25B261E93AB0018D47D /* PlatformXRSystem.h in Headers */ = {isa = PBXBuildFile; fileRef = 5263E24F261E72EB0018D47D /* PlatformXRSystem.h */; }; >- 5263E25F261E96EF0018D47D /* PlatformXRSystemProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 5263E25D261E96DF0018D47D /* PlatformXRSystemProxy.h */; }; > 5272D4C91E735F0900EB4290 /* WKProtectionSpaceNS.h in Headers */ = {isa = PBXBuildFile; fileRef = 5272D4C71E735F0900EB4290 /* WKProtectionSpaceNS.h */; settings = {ATTRIBUTES = (Private, ); }; }; > 528C37C1195CBB1A00D8B9CC /* WKBackForwardListPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A9F28101958F478008CAC72 /* WKBackForwardListPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; }; > 52D5A1B01C57495A00DE34A3 /* VideoFullscreenManagerProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 52D5A1AA1C57494E00DE34A3 /* VideoFullscreenManagerProxy.h */; }; >@@ -2560,6 +2554,19 @@ > 0FFED98F23A3203700EEF459 /* WKWebViewMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKWebViewMac.mm; sourceTree = "<group>"; }; > 0FFED99023A3203800EEF459 /* WKWebViewMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKWebViewMac.h; sourceTree = "<group>"; }; > 1058C7B1FEA5585E11CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; }; >+ 118502562673B01600A6425E /* PlatformXRSystemProxy.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PlatformXRSystemProxy.h; sourceTree = "<group>"; }; >+ 118502572673B01600A6425E /* PlatformXRSystemProxy.messages.in */ = {isa = PBXFileReference; lastKnownFileType = text; path = PlatformXRSystemProxy.messages.in; sourceTree = "<group>"; }; >+ 118502582673B01600A6425E /* PlatformXRSystemProxy.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = PlatformXRSystemProxy.cpp; sourceTree = "<group>"; }; >+ 1185025A2673B07100A6425E /* PlatformXRSystem.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = PlatformXRSystem.cpp; sourceTree = "<group>"; }; >+ 1185025B2673B07100A6425E /* PlatformXRCoordinator.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PlatformXRCoordinator.h; sourceTree = "<group>"; }; >+ 1185025C2673B07100A6425E /* PlatformXRSystem.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PlatformXRSystem.h; sourceTree = "<group>"; }; >+ 1185025D2673B07100A6425E /* PlatformXRSystem.messages.in */ = {isa = PBXFileReference; lastKnownFileType = text; path = PlatformXRSystem.messages.in; sourceTree = "<group>"; }; >+ 1185025E2673B0A700A6425E /* PlatformXRCoordinator.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PlatformXRCoordinator.mm; sourceTree = "<group>"; }; >+ 118502612673B0DA00A6425E /* XRDeviceProxy.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XRDeviceProxy.h; sourceTree = "<group>"; }; >+ 118502622673B0DA00A6425E /* XRDeviceProxy.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = XRDeviceProxy.cpp; sourceTree = "<group>"; }; >+ 118502632673B0DA00A6425E /* XRDeviceIdentifier.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XRDeviceIdentifier.h; sourceTree = "<group>"; }; >+ 118502642673B0DA00A6425E /* XRDeviceInfo.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = XRDeviceInfo.cpp; sourceTree = "<group>"; }; >+ 118502652673B0DA00A6425E /* XRDeviceInfo.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XRDeviceInfo.h; sourceTree = "<group>"; }; > 1A002D3E196B329400B9AD44 /* _WKSessionState.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = _WKSessionState.mm; sourceTree = "<group>"; }; > 1A002D3F196B329400B9AD44 /* _WKSessionState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _WKSessionState.h; sourceTree = "<group>"; }; > 1A002D42196B337000B9AD44 /* _WKSessionStateInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _WKSessionStateInternal.h; sourceTree = "<group>"; }; >@@ -4188,18 +4195,6 @@ > 51FB0902163A3B1C00EC324A /* NetworkProcessConnection.messages.in */ = {isa = PBXFileReference; lastKnownFileType = text; name = NetworkProcessConnection.messages.in; path = Network/NetworkProcessConnection.messages.in; sourceTree = "<group>"; }; > 51FD18B31651FBAD00DBE1CE /* NetworkResourceLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NetworkResourceLoader.cpp; sourceTree = "<group>"; }; > 51FD18B41651FBAD00DBE1CE /* NetworkResourceLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NetworkResourceLoader.h; sourceTree = "<group>"; }; >- 525080AD261BDE6B00678AEE /* XRDeviceInfo.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = XRDeviceInfo.mm; sourceTree = "<group>"; }; >- 525080AE261BDE6B00678AEE /* XRDeviceIdentifier.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XRDeviceIdentifier.h; sourceTree = "<group>"; }; >- 525080AF261BDE6C00678AEE /* XRDeviceInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XRDeviceInfo.h; sourceTree = "<group>"; }; >- 5263E24D261E6FB90018D47D /* PlatformXRCoordinator.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PlatformXRCoordinator.h; sourceTree = "<group>"; }; >- 5263E24E261E72EB0018D47D /* PlatformXRSystem.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = PlatformXRSystem.mm; sourceTree = "<group>"; }; >- 5263E24F261E72EB0018D47D /* PlatformXRSystem.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PlatformXRSystem.h; sourceTree = "<group>"; }; >- 5263E250261E72EC0018D47D /* PlatformXRSystem.messages.in */ = {isa = PBXFileReference; lastKnownFileType = text; path = PlatformXRSystem.messages.in; sourceTree = "<group>"; }; >- 5263E254261E73DE0018D47D /* XRDeviceProxy.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = XRDeviceProxy.mm; sourceTree = "<group>"; }; >- 5263E255261E73DF0018D47D /* XRDeviceProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XRDeviceProxy.h; sourceTree = "<group>"; }; >- 5263E25C261E96DF0018D47D /* PlatformXRSystemProxy.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = PlatformXRSystemProxy.mm; sourceTree = "<group>"; }; >- 5263E25D261E96DF0018D47D /* PlatformXRSystemProxy.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PlatformXRSystemProxy.h; sourceTree = "<group>"; }; >- 5263E25E261E96E00018D47D /* PlatformXRSystemProxy.messages.in */ = {isa = PBXFileReference; lastKnownFileType = text; path = PlatformXRSystemProxy.messages.in; sourceTree = "<group>"; }; > 5272D4C71E735F0900EB4290 /* WKProtectionSpaceNS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WKProtectionSpaceNS.h; path = mac/WKProtectionSpaceNS.h; sourceTree = "<group>"; }; > 5272D4C81E735F0900EB4290 /* WKProtectionSpaceNS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WKProtectionSpaceNS.mm; path = mac/WKProtectionSpaceNS.mm; sourceTree = "<group>"; }; > 52D5A1AA1C57494E00DE34A3 /* VideoFullscreenManagerProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VideoFullscreenManagerProxy.h; sourceTree = "<group>"; }; >@@ -6418,6 +6413,39 @@ > name = "Other Frameworks"; > sourceTree = "<group>"; > }; >+ 118502552673B01600A6425E /* XR */ = { >+ isa = PBXGroup; >+ children = ( >+ 118502582673B01600A6425E /* PlatformXRSystemProxy.cpp */, >+ 118502562673B01600A6425E /* PlatformXRSystemProxy.h */, >+ 118502572673B01600A6425E /* PlatformXRSystemProxy.messages.in */, >+ ); >+ path = XR; >+ sourceTree = "<group>"; >+ }; >+ 118502592673B07100A6425E /* XR */ = { >+ isa = PBXGroup; >+ children = ( >+ 1185025B2673B07100A6425E /* PlatformXRCoordinator.h */, >+ 1185025A2673B07100A6425E /* PlatformXRSystem.cpp */, >+ 1185025C2673B07100A6425E /* PlatformXRSystem.h */, >+ 1185025D2673B07100A6425E /* PlatformXRSystem.messages.in */, >+ ); >+ path = XR; >+ sourceTree = "<group>"; >+ }; >+ 118502602673B0DA00A6425E /* XR */ = { >+ isa = PBXGroup; >+ children = ( >+ 118502632673B0DA00A6425E /* XRDeviceIdentifier.h */, >+ 118502642673B0DA00A6425E /* XRDeviceInfo.cpp */, >+ 118502652673B0DA00A6425E /* XRDeviceInfo.h */, >+ 118502622673B0DA00A6425E /* XRDeviceProxy.cpp */, >+ 118502612673B0DA00A6425E /* XRDeviceProxy.h */, >+ ); >+ path = XR; >+ sourceTree = "<group>"; >+ }; > 1A0EC6B0124BBD36007EF4A5 /* PluginProcess */ = { > isa = PBXGroup; > children = ( >@@ -6684,6 +6712,7 @@ > 1AAE058C1279DCD400852418 /* Plugins */, > 2D2E04761F5BEC4F00BB25ED /* RemoteLayerTree */, > 1ABF43781A368035003FB0E6 /* WebsiteData */, >+ 118502602673B0DA00A6425E /* XR */, > E3BCE877267252120011D8DB /* AccessibilityPreferences.cpp */, > E3BCE878267252120011D8DB /* AccessibilityPreferences.h */, > A7D792D51767CB6E00881CBE /* ActivityAssertion.cpp */, >@@ -7040,10 +7069,7 @@ > 1ABC3DF31899E437004F0626 /* NavigationState.mm */, > 5C6CE6D31F59EA350007C6CB /* PageClientImplCocoa.h */, > 5C6CE6D01F59BC460007C6CB /* PageClientImplCocoa.mm */, >- 5263E24D261E6FB90018D47D /* PlatformXRCoordinator.h */, >- 5263E24F261E72EB0018D47D /* PlatformXRSystem.h */, >- 5263E250261E72EC0018D47D /* PlatformXRSystem.messages.in */, >- 5263E24E261E72EB0018D47D /* PlatformXRSystem.mm */, >+ 1185025E2673B0A700A6425E /* PlatformXRCoordinator.mm */, > CDA29A1E1CBEB5FB00901CCF /* PlaybackSessionManagerProxy.h */, > CDA29A221CBEB61A00901CCF /* PlaybackSessionManagerProxy.messages.in */, > CDA29A1F1CBEB5FB00901CCF /* PlaybackSessionManagerProxy.mm */, >@@ -8318,11 +8344,6 @@ > C14D306524B794E700480387 /* XPCEndpoint.mm */, > C14D306824B794E700480387 /* XPCEndpointClient.h */, > C14D306624B794E700480387 /* XPCEndpointClient.mm */, >- 525080AE261BDE6B00678AEE /* XRDeviceIdentifier.h */, >- 525080AF261BDE6C00678AEE /* XRDeviceInfo.h */, >- 525080AD261BDE6B00678AEE /* XRDeviceInfo.mm */, >- 5263E255261E73DF0018D47D /* XRDeviceProxy.h */, >- 5263E254261E73DE0018D47D /* XRDeviceProxy.mm */, > ); > name = cocoa; > path = Cocoa; >@@ -9319,9 +9340,6 @@ > C1A152D624E5A29A00978C8B /* HandleXPCEndpointMessages.mm */, > C14D37FC24ACDF45007FF014 /* LaunchServicesDatabaseManager.h */, > C14D37FD24ACE086007FF014 /* LaunchServicesDatabaseManager.mm */, >- 5263E25D261E96DF0018D47D /* PlatformXRSystemProxy.h */, >- 5263E25E261E96E00018D47D /* PlatformXRSystemProxy.messages.in */, >- 5263E25C261E96DF0018D47D /* PlatformXRSystemProxy.mm */, > 446DC64B24A2D8AD0061F390 /* PlaybackSessionContextIdentifier.h */, > CDA29A191CBDBF4100901CCF /* PlaybackSessionManager.h */, > CDA29A1C1CBDBF5B00901CCF /* PlaybackSessionManager.messages.in */, >@@ -9787,6 +9805,7 @@ > BC032D5D10F437220058C15A /* WebCoreSupport */, > BC032D5E10F4372B0058C15A /* WebPage */, > 1AAC4DDE16B1CBF6009425E3 /* WebStorage */, >+ 118502552673B01600A6425E /* XR */, > BCE9C0CF1485965D00E33D61 /* WebConnectionToUIProcess.cpp */, > BCE9C0D01485965D00E33D61 /* WebConnectionToUIProcess.h */, > BC111AE3112F5C2600337BAB /* WebProcess.cpp */, >@@ -9952,6 +9971,7 @@ > 1AAF089E192681AC00B6390C /* UserContent */, > 57608294202BD84900116678 /* WebAuthentication */, > 1A53C2A31A325691004E8C70 /* WebsiteData */, >+ 118502592673B07100A6425E /* XR */, > E1513C64166EABB200149FCB /* AuxiliaryProcessProxy.cpp */, > E1513C65166EABB200149FCB /* AuxiliaryProcessProxy.h */, > 46A2B6061E5675A200C3DEDA /* BackgroundProcessResponsivenessTimer.cpp */, >@@ -12159,9 +12179,6 @@ > 2D8710171828415D0018FA01 /* PlatformCALayerRemoteCustom.h in Headers */, > 2D8949F1182044F600E898AA /* PlatformCALayerRemoteTiledBacking.h in Headers */, > BCC43ABB127B95DC00317F16 /* PlatformPopupMenuData.h in Headers */, >- 5263E25A261E93A70018D47D /* PlatformXRCoordinator.h in Headers */, >- 5263E25B261E93AB0018D47D /* PlatformXRSystem.h in Headers */, >- 5263E25F261E96EF0018D47D /* PlatformXRSystemProxy.h in Headers */, > 446DC64C24A2D8E50061F390 /* PlaybackSessionContextIdentifier.h in Headers */, > CDA29A1B1CBDBF4100901CCF /* PlaybackSessionManager.h in Headers */, > CDA29A291CBEB67A00901CCF /* PlaybackSessionManagerMessages.h in Headers */, >@@ -13055,9 +13072,6 @@ > C15E6CB324B7BE6F00E501A2 /* XPCEndpoint.h in Headers */, > C15E6CB424B7BE7600E501A2 /* XPCEndpointClient.h in Headers */, > BCBECDE816B6416800047A1A /* XPCServiceEntryPoint.h in Headers */, >- 525080B1261BDE6C00678AEE /* XRDeviceIdentifier.h in Headers */, >- 525080B2261BDE6C00678AEE /* XRDeviceInfo.h in Headers */, >- 5263E257261E73DF0018D47D /* XRDeviceProxy.h in Headers */, > ); > runOnlyForDeploymentPostprocessing = 0; > }; >diff --git a/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp b/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp >index 7d62e5e9a39d15caa375a11c9967456764df8997..4754d3a453fb47f2ab54f0e8bc185838deceba43 100644 >--- a/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp >+++ b/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp >@@ -1496,7 +1496,7 @@ void WebChromeClient::showMediaControlsContextMenu(FloatRect&& targetFrame, Vect > > #endif // ENABLE(MEDIA_CONTROLS_CONTEXT_MENUS) && USE(UICONTEXTMENU) > >-#if ENABLE(WEBXR) && PLATFORM(COCOA) >+#if ENABLE(WEBXR) && !USE(OPENXR) > void WebChromeClient::enumerateImmersiveXRDevices(CompletionHandler<void(const PlatformXR::Instance::DeviceList&)>&& completionHandler) > { > m_page.xrSystemProxy().enumerateImmersiveXRDevices(WTFMove(completionHandler)); >diff --git a/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h b/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h >index 62862028424fbbbed1328163574b705d3bc18366..f88c9c8f3bd381ea2f2e63e8f850a4bd96707cc4 100644 >--- a/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h >+++ b/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h >@@ -444,7 +444,7 @@ private: > void showMediaControlsContextMenu(WebCore::FloatRect&&, Vector<WebCore::MediaControlsContextMenuItem>&&, CompletionHandler<void(WebCore::MediaControlsContextMenuItem::ID)>&&) final; > #endif // ENABLE(MEDIA_CONTROLS_CONTEXT_MENUS) && USE(UICONTEXTMENU) > >-#if ENABLE(WEBXR) && PLATFORM(COCOA) >+#if ENABLE(WEBXR) && !USE(OPENXR) > void enumerateImmersiveXRDevices(CompletionHandler<void(const PlatformXR::Instance::DeviceList&)>&&) final; > #endif > >diff --git a/Source/WebKit/WebProcess/WebPage/Cocoa/WebPageCocoa.mm b/Source/WebKit/WebProcess/WebPage/Cocoa/WebPageCocoa.mm >index 4490755fff768d410b5357fc6102226ef7eb56ee..e14150b5b8da6c15709b30cac2a9de467de2babc 100644 >--- a/Source/WebKit/WebProcess/WebPage/Cocoa/WebPageCocoa.mm >+++ b/Source/WebKit/WebProcess/WebPage/Cocoa/WebPageCocoa.mm >@@ -443,15 +443,6 @@ void WebPage::getPDFFirstPageSize(WebCore::FrameIdentifier frameID, CompletionHa > completionHandler(FloatSize(plugin->pdfDocumentSizeForPrinting())); > } > >-#if ENABLE(WEBXR) >-PlatformXRSystemProxy& WebPage::xrSystemProxy() >-{ >- if (!m_xrSystemProxy) >- m_xrSystemProxy = std::unique_ptr<PlatformXRSystemProxy>(new PlatformXRSystemProxy(*this)); >- return *m_xrSystemProxy; >-} >-#endif >- > #if ENABLE(DATA_DETECTION) > > void WebPage::handleClickForDataDetectionResult(const DataDetectorElementInfo& info, const IntPoint& clickLocation) >diff --git a/Source/WebKit/WebProcess/WebPage/WebPage.cpp b/Source/WebKit/WebProcess/WebPage/WebPage.cpp >index 2d4a141fe05e5c0b97302fd2e5b2c1398eff6661..8879bd6723ced1944a71a80a096a9dbb71ee174a 100644 >--- a/Source/WebKit/WebProcess/WebPage/WebPage.cpp >+++ b/Source/WebKit/WebProcess/WebPage/WebPage.cpp >@@ -7337,6 +7337,15 @@ void WebPage::textAutosizingUsesIdempotentModeChanged() > } > #endif // ENABLE(TEXT_AUTOSIZING) > >+#if ENABLE(WEBXR) && !USE(OPENXR) >+PlatformXRSystemProxy& WebPage::xrSystemProxy() >+{ >+ if (!m_xrSystemProxy) >+ m_xrSystemProxy = std::unique_ptr<PlatformXRSystemProxy>(new PlatformXRSystemProxy(*this)); >+ return *m_xrSystemProxy; >+} >+#endif >+ > void WebPage::setOverriddenMediaType(const String& mediaType) > { > if (mediaType == m_overriddenMediaType) >diff --git a/Source/WebKit/WebProcess/WebPage/WebPage.h b/Source/WebKit/WebProcess/WebPage/WebPage.h >index c9b3059a1a3a3f2b164d961a3ed1d7b97f37ec87..ec59b9f48ef480723f6e0c5f6a64dc2558c6e5dd 100644 >--- a/Source/WebKit/WebProcess/WebPage/WebPage.h >+++ b/Source/WebKit/WebProcess/WebPage/WebPage.h >@@ -144,7 +144,7 @@ typedef struct _AtkObject AtkObject; > #include <WebCore/MediaSessionIdentifier.h> > #endif > >-#if ENABLE(WEBXR) && PLATFORM(COCOA) >+#if ENABLE(WEBXR) && !USE(OPENXR) > #include "PlatformXRSystemProxy.h" > #endif > >@@ -1458,7 +1458,7 @@ public: > void textAutosizingUsesIdempotentModeChanged(); > #endif > >-#if ENABLE(WEBXR) && PLATFORM(COCOA) >+#if ENABLE(WEBXR) && !USE(OPENXR) > PlatformXRSystemProxy& xrSystemProxy(); > #endif > >@@ -2351,7 +2351,7 @@ private: > Vector<std::pair<WeakPtr<WebCore::HTMLElement>, Vector<CompletionHandler<void(RefPtr<WebCore::Element>&&)>>>> m_elementsPendingTextRecognition; > #endif > >-#if ENABLE(WEBXR) && PLATFORM(COCOA) >+#if ENABLE(WEBXR) && !USE(OPENXR) > std::unique_ptr<PlatformXRSystemProxy> m_xrSystemProxy; > #endif > }; >diff --git a/Source/WebKit/WebProcess/XR/PlatformXRSystemProxy.cpp b/Source/WebKit/WebProcess/XR/PlatformXRSystemProxy.cpp >new file mode 100644 >index 0000000000000000000000000000000000000000..359b96c7b77c4c8893cd2dd94b402825058c2ce7 >--- /dev/null >+++ b/Source/WebKit/WebProcess/XR/PlatformXRSystemProxy.cpp >@@ -0,0 +1,116 @@ >+/* >+ * Copyright (C) 2021 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 "PlatformXRSystemProxy.h" >+ >+#if ENABLE(WEBXR) >+ >+#include "PlatformXRCoordinator.h" >+#include "PlatformXRSystemMessages.h" >+#include "PlatformXRSystemProxyMessages.h" >+#include "WebPage.h" >+#include "WebProcess.h" >+#include "XRDeviceInfo.h" >+#include <wtf/Vector.h> >+ >+using namespace PlatformXR; >+ >+namespace WebKit { >+ >+PlatformXRSystemProxy::PlatformXRSystemProxy(WebPage& page) >+ : m_page(page) >+{ >+ WebProcess::singleton().addMessageReceiver(Messages::PlatformXRSystemProxy::messageReceiverName(), m_page.identifier(), *this); >+} >+ >+PlatformXRSystemProxy::~PlatformXRSystemProxy() >+{ >+ WebProcess::singleton().removeMessageReceiver(Messages::PlatformXRSystemProxy::messageReceiverName(), m_page.identifier()); >+} >+ >+void PlatformXRSystemProxy::enumerateImmersiveXRDevices(CompletionHandler<void(const Instance::DeviceList&)>&& completionHandler) >+{ >+ m_page.sendWithAsyncReply(Messages::PlatformXRSystem::EnumerateImmersiveXRDevices(), [this, weakThis = makeWeakPtr(this), completionHandler = WTFMove(completionHandler)](Vector<XRDeviceInfo>&& devicesInfos) mutable { >+ if (!weakThis) >+ return; >+ >+ PlatformXR::Instance::DeviceList devices; >+ for (auto& deviceInfo : devicesInfos) { >+ if (auto device = deviceByIdentifier(deviceInfo.identifier)) >+ devices.append(*device); >+ else >+ devices.append(XRDeviceProxy::create(WTFMove(deviceInfo), *this)); >+ } >+ m_devices.swap(devices); >+ completionHandler(m_devices); >+ }); >+} >+ >+void PlatformXRSystemProxy::initializeTrackingAndRendering() >+{ >+ m_page.send(Messages::PlatformXRSystem::InitializeTrackingAndRendering()); >+} >+ >+void PlatformXRSystemProxy::shutDownTrackingAndRendering() >+{ >+ m_page.send(Messages::PlatformXRSystem::ShutDownTrackingAndRendering()); >+} >+ >+void PlatformXRSystemProxy::requestFrame(PlatformXR::Device::RequestFrameCallback&& callback) >+{ >+ m_page.sendWithAsyncReply(Messages::PlatformXRSystem::RequestFrame(), WTFMove(callback)); >+} >+ >+std::optional<PlatformXR::LayerHandle> PlatformXRSystemProxy::createLayerProjection(uint32_t, uint32_t, bool) >+{ >+ return PlatformXRCoordinator::defaultLayerHandle(); >+} >+ >+void PlatformXRSystemProxy::submitFrame() >+{ >+ m_page.send(Messages::PlatformXRSystem::SubmitFrame()); >+} >+ >+void PlatformXRSystemProxy::sessionDidEnd(XRDeviceIdentifier deviceIdentifier) >+{ >+ if (auto device = deviceByIdentifier(deviceIdentifier)) >+ device->sessionDidEnd(); >+} >+ >+RefPtr<XRDeviceProxy> PlatformXRSystemProxy::deviceByIdentifier(XRDeviceIdentifier identifier) >+{ >+ for (auto& device : m_devices) { >+ auto* deviceProxy = static_cast<XRDeviceProxy*>(device.ptr()); >+ if (deviceProxy->identifier() == identifier) >+ return deviceProxy; >+ } >+ >+ return nullptr; >+} >+ >+} // namespace WebKit >+ >+#endif // ENABLE(WEBXR) >diff --git a/Source/WebKit/WebProcess/XR/PlatformXRSystemProxy.h b/Source/WebKit/WebProcess/XR/PlatformXRSystemProxy.h >new file mode 100644 >index 0000000000000000000000000000000000000000..0134de51a12587f1432cd0652e8cc74496ed4092 >--- /dev/null >+++ b/Source/WebKit/WebProcess/XR/PlatformXRSystemProxy.h >@@ -0,0 +1,66 @@ >+/* >+ * Copyright (C) 2021 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 >+ >+#if ENABLE(WEBXR) >+ >+#include "MessageReceiver.h" >+#include "XRDeviceIdentifier.h" >+#include "XRDeviceProxy.h" >+#include <WebCore/PlatformXR.h> >+ >+namespace WebKit { >+ >+class WebPage; >+ >+class PlatformXRSystemProxy : public IPC::MessageReceiver { >+public: >+ PlatformXRSystemProxy(WebPage&); >+ virtual ~PlatformXRSystemProxy(); >+ >+ void enumerateImmersiveXRDevices(CompletionHandler<void(const PlatformXR::Instance::DeviceList&)>&&); >+ void initializeTrackingAndRendering(); >+ void shutDownTrackingAndRendering(); >+ void requestFrame(PlatformXR::Device::RequestFrameCallback&&); >+ std::optional<PlatformXR::LayerHandle> createLayerProjection(uint32_t, uint32_t, bool); >+ void submitFrame(); >+ >+private: >+ RefPtr<XRDeviceProxy> deviceByIdentifier(XRDeviceIdentifier); >+ >+ // IPC::MessageReceiver >+ void didReceiveMessage(IPC::Connection&, IPC::Decoder&) final; >+ >+ // Message handlers >+ void sessionDidEnd(XRDeviceIdentifier); >+ >+ PlatformXR::Instance::DeviceList m_devices; >+ WebPage& m_page; >+}; >+ >+} >+ >+#endif // ENABLE(WEBXR) >diff --git a/Source/WebKit/WebProcess/XR/PlatformXRSystemProxy.messages.in b/Source/WebKit/WebProcess/XR/PlatformXRSystemProxy.messages.in >new file mode 100644 >index 0000000000000000000000000000000000000000..7090ac1f7f624b496da57a10f964ef4dd91f5c7f >--- /dev/null >+++ b/Source/WebKit/WebProcess/XR/PlatformXRSystemProxy.messages.in >@@ -0,0 +1,32 @@ >+/* >+ * Copyright (C) 2021 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. >+ */ >+ >+#if ENABLE(WEBXR) >+ >+messages -> PlatformXRSystemProxy NotRefCounted { >+ SessionDidEnd(WebKit::XRDeviceIdentifier deviceIdentifier) >+} >+ >+#endif >diff --git a/Source/WebKit/WebProcess/cocoa/PlatformXRSystemProxy.h b/Source/WebKit/WebProcess/cocoa/PlatformXRSystemProxy.h >deleted file mode 100644 >index 0134de51a12587f1432cd0652e8cc74496ed4092..0000000000000000000000000000000000000000 >--- a/Source/WebKit/WebProcess/cocoa/PlatformXRSystemProxy.h >+++ /dev/null >@@ -1,66 +0,0 @@ >-/* >- * Copyright (C) 2021 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 >- >-#if ENABLE(WEBXR) >- >-#include "MessageReceiver.h" >-#include "XRDeviceIdentifier.h" >-#include "XRDeviceProxy.h" >-#include <WebCore/PlatformXR.h> >- >-namespace WebKit { >- >-class WebPage; >- >-class PlatformXRSystemProxy : public IPC::MessageReceiver { >-public: >- PlatformXRSystemProxy(WebPage&); >- virtual ~PlatformXRSystemProxy(); >- >- void enumerateImmersiveXRDevices(CompletionHandler<void(const PlatformXR::Instance::DeviceList&)>&&); >- void initializeTrackingAndRendering(); >- void shutDownTrackingAndRendering(); >- void requestFrame(PlatformXR::Device::RequestFrameCallback&&); >- std::optional<PlatformXR::LayerHandle> createLayerProjection(uint32_t, uint32_t, bool); >- void submitFrame(); >- >-private: >- RefPtr<XRDeviceProxy> deviceByIdentifier(XRDeviceIdentifier); >- >- // IPC::MessageReceiver >- void didReceiveMessage(IPC::Connection&, IPC::Decoder&) final; >- >- // Message handlers >- void sessionDidEnd(XRDeviceIdentifier); >- >- PlatformXR::Instance::DeviceList m_devices; >- WebPage& m_page; >-}; >- >-} >- >-#endif // ENABLE(WEBXR) >diff --git a/Source/WebKit/WebProcess/cocoa/PlatformXRSystemProxy.messages.in b/Source/WebKit/WebProcess/cocoa/PlatformXRSystemProxy.messages.in >deleted file mode 100644 >index 79405791b615438a9bf7db4b4b00668708293d63..0000000000000000000000000000000000000000 >--- a/Source/WebKit/WebProcess/cocoa/PlatformXRSystemProxy.messages.in >+++ /dev/null >@@ -1,32 +0,0 @@ >-/* >- * Copyright (C) 2021 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. >- */ >- >-#if PLATFORM(COCOA) && ENABLE(WEBXR) >- >-messages -> PlatformXRSystemProxy NotRefCounted { >- SessionDidEnd(WebKit::XRDeviceIdentifier deviceIdentifier) >-} >- >-#endif >diff --git a/Source/WebKit/WebProcess/cocoa/PlatformXRSystemProxy.mm b/Source/WebKit/WebProcess/cocoa/PlatformXRSystemProxy.mm >deleted file mode 100644 >index a3efa5b882fe6d97f31e78e51c3d30ffea733fd0..0000000000000000000000000000000000000000 >--- a/Source/WebKit/WebProcess/cocoa/PlatformXRSystemProxy.mm >+++ /dev/null >@@ -1,116 +0,0 @@ >-/* >- * Copyright (C) 2021 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 "PlatformXRSystemProxy.h" >- >-#if ENABLE(WEBXR) >- >-#import "PlatformXRCoordinator.h" >-#import "PlatformXRSystemMessages.h" >-#import "PlatformXRSystemProxyMessages.h" >-#import "WebPage.h" >-#import "WebProcess.h" >-#import "XRDeviceInfo.h" >-#import <wtf/Vector.h> >- >-using namespace PlatformXR; >- >-namespace WebKit { >- >-PlatformXRSystemProxy::PlatformXRSystemProxy(WebPage& page) >- : m_page(page) >-{ >- WebProcess::singleton().addMessageReceiver(Messages::PlatformXRSystemProxy::messageReceiverName(), m_page.identifier(), *this); >-} >- >-PlatformXRSystemProxy::~PlatformXRSystemProxy() >-{ >- WebProcess::singleton().removeMessageReceiver(Messages::PlatformXRSystemProxy::messageReceiverName(), m_page.identifier()); >-} >- >-void PlatformXRSystemProxy::enumerateImmersiveXRDevices(CompletionHandler<void(const Instance::DeviceList&)>&& completionHandler) >-{ >- m_page.sendWithAsyncReply(Messages::PlatformXRSystem::EnumerateImmersiveXRDevices(), [this, weakThis = makeWeakPtr(this), completionHandler = WTFMove(completionHandler)](Vector<XRDeviceInfo>&& devicesInfos) mutable { >- if (!weakThis) >- return; >- >- PlatformXR::Instance::DeviceList devices; >- for (auto& deviceInfo : devicesInfos) { >- if (auto device = deviceByIdentifier(deviceInfo.identifier)) >- devices.append(*device); >- else >- devices.append(XRDeviceProxy::create(WTFMove(deviceInfo), *this)); >- } >- m_devices.swap(devices); >- completionHandler(m_devices); >- }); >-} >- >-void PlatformXRSystemProxy::initializeTrackingAndRendering() >-{ >- m_page.send(Messages::PlatformXRSystem::InitializeTrackingAndRendering()); >-} >- >-void PlatformXRSystemProxy::shutDownTrackingAndRendering() >-{ >- m_page.send(Messages::PlatformXRSystem::ShutDownTrackingAndRendering()); >-} >- >-void PlatformXRSystemProxy::requestFrame(PlatformXR::Device::RequestFrameCallback&& callback) >-{ >- m_page.sendWithAsyncReply(Messages::PlatformXRSystem::RequestFrame(), WTFMove(callback)); >-} >- >-std::optional<PlatformXR::LayerHandle> PlatformXRSystemProxy::createLayerProjection(uint32_t, uint32_t, bool) >-{ >- return PlatformXRCoordinator::defaultLayerHandle(); >-} >- >-void PlatformXRSystemProxy::submitFrame() >-{ >- m_page.send(Messages::PlatformXRSystem::SubmitFrame()); >-} >- >-void PlatformXRSystemProxy::sessionDidEnd(XRDeviceIdentifier deviceIdentifier) >-{ >- if (auto device = deviceByIdentifier(deviceIdentifier)) >- device->sessionDidEnd(); >-} >- >-RefPtr<XRDeviceProxy> PlatformXRSystemProxy::deviceByIdentifier(XRDeviceIdentifier identifier) >-{ >- for (auto& device : m_devices) { >- auto* deviceProxy = static_cast<XRDeviceProxy*>(device.ptr()); >- if (deviceProxy->identifier() == identifier) >- return deviceProxy; >- } >- >- return nullptr; >-} >- >-} // namespace WebKit >- >-#endif // ENABLE(WEBXR)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 226919
:
431196
|
431201
|
431848
|
432026
|
432271
|
432922
|
432926
|
432929
|
433127
|
433131
|
433305