Title: [279822] trunk/Source/WebKit
Revision
279822
Author
ifernan...@igalia.com
Date
2021-07-12 02:30:56 -0700 (Mon, 12 Jul 2021)

Log Message

Cross platform compilation of PlatformXRSystem and PlatformXRSystemProxy
https://bugs.webkit.org/show_bug.cgi?id=226919

Reviewed by Dean Jackson.

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.
* Shared/mac/MediaFormatReader/MediaSampleCursor.cpp: Add include to fix compilation error
* 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.

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/Source/WebKit/CMakeLists.txt (279821 => 279822)


--- trunk/Source/WebKit/CMakeLists.txt	2021-07-12 08:22:41 UTC (rev 279821)
+++ trunk/Source/WebKit/CMakeLists.txt	2021-07-12 09:30:56 UTC (rev 279822)
@@ -46,6 +46,7 @@
     "${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 @@
     "${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 @@
     "${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"
 )
@@ -214,6 +217,8 @@
 
     UIProcess/UserContent/WebUserContentControllerProxy
 
+    UIProcess/XR/PlatformXRSystem
+
     WebProcess/WebProcess
 
     WebProcess/Automation/WebAutomationSessionProxy
@@ -283,6 +288,8 @@
     WebProcess/WebPage/WebPage
 
     WebProcess/WebStorage/StorageAreaMap
+
+    WebProcess/XR/PlatformXRSystemProxy
 )
 
 set(WebKit_FRAMEWORKS

Modified: trunk/Source/WebKit/ChangeLog (279821 => 279822)


--- trunk/Source/WebKit/ChangeLog	2021-07-12 08:22:41 UTC (rev 279821)
+++ trunk/Source/WebKit/ChangeLog	2021-07-12 09:30:56 UTC (rev 279822)
@@ -1,3 +1,49 @@
+2021-07-12  Imanol Fernandez  <ifernan...@igalia.com>
+
+        Cross platform compilation of PlatformXRSystem and PlatformXRSystemProxy
+        https://bugs.webkit.org/show_bug.cgi?id=226919
+
+        Reviewed by Dean Jackson.
+
+        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.
+        * Shared/mac/MediaFormatReader/MediaSampleCursor.cpp: Add include to fix compilation error
+        * 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-07-11  Wenson Hsieh  <wenson_hs...@apple.com>
 
         Remove an unused deprecated private UI delegate method

Modified: trunk/Source/WebKit/DerivedSources-input.xcfilelist (279821 => 279822)


--- trunk/Source/WebKit/DerivedSources-input.xcfilelist	2021-07-12 08:22:41 UTC (rev 279821)
+++ trunk/Source/WebKit/DerivedSources-input.xcfilelist	2021-07-12 09:30:56 UTC (rev 279822)
@@ -100,7 +100,6 @@
 $(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/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/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

Modified: trunk/Source/WebKit/DerivedSources.make (279821 => 279822)


--- trunk/Source/WebKit/DerivedSources.make	2021-07-12 08:22:41 UTC (rev 279821)
+++ trunk/Source/WebKit/DerivedSources.make	2021-07-12 09:30:56 UTC (rev 279822)
@@ -162,7 +162,6 @@
 	UIProcess/ios/SmartMagnificationController \
 	UIProcess/mac/SecItemShimProxy \
 	UIProcess/WebGeolocationManagerProxy \
-	UIProcess/Cocoa/PlatformXRSystem \
 	UIProcess/Cocoa/PlaybackSessionManagerProxy \
 	UIProcess/Cocoa/UserMediaCaptureManagerProxy \
 	UIProcess/Cocoa/VideoFullscreenManagerProxy \
@@ -176,6 +175,7 @@
 	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 @@
 	WebProcess/Storage/WebSWContextManagerConnection \
 	WebProcess/Storage/WebSWClientConnection \
 	WebProcess/WebProcess \
-	WebProcess/cocoa/PlatformXRSystemProxy \
 	WebProcess/cocoa/PlaybackSessionManager \
 	WebProcess/cocoa/RemoteCaptureSampleManager \
 	WebProcess/cocoa/UserMediaCaptureManager \
@@ -239,6 +238,7 @@
 	WebProcess/WebPage/Cocoa/TextCheckingControllerProxy \
 	WebProcess/WebPage/ViewUpdateDispatcher \
 	WebProcess/WebAuthentication/WebAuthnProcessConnection \
+	WebProcess/XR/PlatformXRSystemProxy \
 	PluginProcess/WebProcessConnection \
 	PluginProcess/PluginControllerProxy \
 	PluginProcess/PluginProcess \

Modified: trunk/Source/WebKit/PlatformMac.cmake (279821 => 279822)


--- trunk/Source/WebKit/PlatformMac.cmake	2021-07-12 08:22:41 UTC (rev 279821)
+++ trunk/Source/WebKit/PlatformMac.cmake	2021-07-12 09:30:56 UTC (rev 279822)
@@ -217,7 +217,6 @@
 
     UIProcess/ViewGestureController
 
-    UIProcess/Cocoa/PlatformXRSystem
     UIProcess/Cocoa/PlaybackSessionManagerProxy
     UIProcess/Cocoa/UserMediaCaptureManagerProxy
     UIProcess/Cocoa/VideoFullscreenManagerProxy
@@ -255,7 +254,6 @@
 
     WebProcess/WebPage/RemoteLayerTree/RemoteScrollingCoordinator
 
-    WebProcess/cocoa/PlatformXRSystemProxy
     WebProcess/cocoa/PlaybackSessionManager
     WebProcess/cocoa/RemoteCaptureSampleManager
     WebProcess/cocoa/UserMediaCaptureManager

Deleted: trunk/Source/WebKit/Shared/Cocoa/XRDeviceIdentifier.h (279821 => 279822)


--- trunk/Source/WebKit/Shared/Cocoa/XRDeviceIdentifier.h	2021-07-12 08:22:41 UTC (rev 279821)
+++ trunk/Source/WebKit/Shared/Cocoa/XRDeviceIdentifier.h	2021-07-12 09:30:56 UTC (rev 279822)
@@ -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)

Deleted: trunk/Source/WebKit/Shared/Cocoa/XRDeviceInfo.h (279821 => 279822)


--- trunk/Source/WebKit/Shared/Cocoa/XRDeviceInfo.h	2021-07-12 08:22:41 UTC (rev 279821)
+++ trunk/Source/WebKit/Shared/Cocoa/XRDeviceInfo.h	2021-07-12 09:30:56 UTC (rev 279822)
@@ -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)

Deleted: trunk/Source/WebKit/Shared/Cocoa/XRDeviceInfo.mm (279821 => 279822)


--- trunk/Source/WebKit/Shared/Cocoa/XRDeviceInfo.mm	2021-07-12 08:22:41 UTC (rev 279821)
+++ trunk/Source/WebKit/Shared/Cocoa/XRDeviceInfo.mm	2021-07-12 09:30:56 UTC (rev 279822)
@@ -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)

Deleted: trunk/Source/WebKit/Shared/Cocoa/XRDeviceProxy.h (279821 => 279822)


--- trunk/Source/WebKit/Shared/Cocoa/XRDeviceProxy.h	2021-07-12 08:22:41 UTC (rev 279821)
+++ trunk/Source/WebKit/Shared/Cocoa/XRDeviceProxy.h	2021-07-12 09:30:56 UTC (rev 279822)
@@ -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)

Deleted: trunk/Source/WebKit/Shared/Cocoa/XRDeviceProxy.mm (279821 => 279822)


--- trunk/Source/WebKit/Shared/Cocoa/XRDeviceProxy.mm	2021-07-12 08:22:41 UTC (rev 279821)
+++ trunk/Source/WebKit/Shared/Cocoa/XRDeviceProxy.mm	2021-07-12 09:30:56 UTC (rev 279822)
@@ -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)

Copied: trunk/Source/WebKit/Shared/XR/XRDeviceIdentifier.h (from rev 279821, trunk/Source/WebKit/Shared/Cocoa/XRDeviceIdentifier.h) (0 => 279822)


--- trunk/Source/WebKit/Shared/XR/XRDeviceIdentifier.h	                        (rev 0)
+++ trunk/Source/WebKit/Shared/XR/XRDeviceIdentifier.h	2021-07-12 09:30:56 UTC (rev 279822)
@@ -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)

Copied: trunk/Source/WebKit/Shared/XR/XRDeviceInfo.cpp (from rev 279821, trunk/Source/WebKit/Shared/Cocoa/XRDeviceInfo.mm) (0 => 279822)


--- trunk/Source/WebKit/Shared/XR/XRDeviceInfo.cpp	                        (rev 0)
+++ trunk/Source/WebKit/Shared/XR/XRDeviceInfo.cpp	2021-07-12 09:30:56 UTC (rev 279822)
@@ -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)

Copied: trunk/Source/WebKit/Shared/XR/XRDeviceInfo.h (from rev 279821, trunk/Source/WebKit/Shared/Cocoa/XRDeviceInfo.h) (0 => 279822)


--- trunk/Source/WebKit/Shared/XR/XRDeviceInfo.h	                        (rev 0)
+++ trunk/Source/WebKit/Shared/XR/XRDeviceInfo.h	2021-07-12 09:30:56 UTC (rev 279822)
@@ -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)

Copied: trunk/Source/WebKit/Shared/XR/XRDeviceProxy.cpp (from rev 279821, trunk/Source/WebKit/Shared/Cocoa/XRDeviceProxy.mm) (0 => 279822)


--- trunk/Source/WebKit/Shared/XR/XRDeviceProxy.cpp	                        (rev 0)
+++ trunk/Source/WebKit/Shared/XR/XRDeviceProxy.cpp	2021-07-12 09:30:56 UTC (rev 279822)
@@ -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)

Copied: trunk/Source/WebKit/Shared/XR/XRDeviceProxy.h (from rev 279821, trunk/Source/WebKit/Shared/Cocoa/XRDeviceProxy.h) (0 => 279822)


--- trunk/Source/WebKit/Shared/XR/XRDeviceProxy.h	                        (rev 0)
+++ trunk/Source/WebKit/Shared/XR/XRDeviceProxy.h	2021-07-12 09:30:56 UTC (rev 279822)
@@ -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)

Modified: trunk/Source/WebKit/Shared/mac/MediaFormatReader/MediaSampleCursor.cpp (279821 => 279822)


--- trunk/Source/WebKit/Shared/mac/MediaFormatReader/MediaSampleCursor.cpp	2021-07-12 08:22:41 UTC (rev 279821)
+++ trunk/Source/WebKit/Shared/mac/MediaFormatReader/MediaSampleCursor.cpp	2021-07-12 09:30:56 UTC (rev 279822)
@@ -29,6 +29,7 @@
 #if ENABLE(WEBM_FORMAT_READER)
 
 #include "MediaTrackReader.h"
+#include <WebCore/Logging.h>
 #include <WebCore/MediaSample.h>
 #include <WebCore/SampleMap.h>
 #include <pal/avfoundation/MediaTimeAVFoundation.h>

Modified: trunk/Source/WebKit/Sources.txt (279821 => 279822)


--- trunk/Source/WebKit/Sources.txt	2021-07-12 08:22:41 UTC (rev 279821)
+++ trunk/Source/WebKit/Sources.txt	2021-07-12 09:30:56 UTC (rev 279822)
@@ -287,6 +287,9 @@
 
 Shared/WebsiteData/WebsiteData.cpp
 
+Shared/XR/XRDeviceInfo.cpp
+Shared/XR/XRDeviceProxy.cpp
+
 UIProcess/AuxiliaryProcessProxy.cpp
 UIProcess/BackgroundProcessResponsivenessTimer.cpp
 UIProcess/DeviceIdHashSaltStorage.cpp
@@ -503,6 +506,8 @@
 UIProcess/WebsiteData/WebsiteDataStore.cpp
 UIProcess/WebsiteData/WebsiteDataStoreConfiguration.cpp
 
+UIProcess/XR/PlatformXRSystem.cpp
+
 WebAuthnProcess/WebAuthnConnectionToWebProcess.cpp
 WebAuthnProcess/WebAuthnProcess.cpp
 WebAuthnProcess/WebAuthnProcessCreationParameters.cpp
@@ -721,8 +726,12 @@
 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

Modified: trunk/Source/WebKit/SourcesCocoa.txt (279821 => 279822)


--- trunk/Source/WebKit/SourcesCocoa.txt	2021-07-12 08:22:41 UTC (rev 279821)
+++ trunk/Source/WebKit/SourcesCocoa.txt	2021-07-12 09:30:56 UTC (rev 279822)
@@ -185,8 +185,6 @@
 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
@@ -404,7 +402,7 @@
 UIProcess/Cocoa/ModelElementControllerCocoa.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
@@ -602,7 +600,6 @@
 
 WebProcess/ApplePay/cocoa/WebPaymentCoordinatorCocoa.mm
 
-WebProcess/cocoa/PlatformXRSystemProxy.mm
 WebProcess/cocoa/PlaybackSessionManager.mm
 WebProcess/cocoa/RemoteCaptureSampleManager.cpp
 WebProcess/cocoa/RemoteRealtimeAudioSource.cpp
@@ -720,8 +717,6 @@
 LibWebRTCCodecsProxyMessageReceiver.cpp
 LibWebRTCCodecsMessageReceiver.cpp
 MessageNames.cpp
-PlatformXRSystemMessageReceiver.cpp
-PlatformXRSystemProxyMessageReceiver.cpp
 RemoteAudioDestinationManagerMessageReceiver.cpp
 RemoteAudioHardwareListenerMessageReceiver.cpp
 RemoteAudioSessionMessageReceiver.cpp

Deleted: trunk/Source/WebKit/UIProcess/Cocoa/PlatformXRCoordinator.h (279821 => 279822)


--- trunk/Source/WebKit/UIProcess/Cocoa/PlatformXRCoordinator.h	2021-07-12 08:22:41 UTC (rev 279821)
+++ trunk/Source/WebKit/UIProcess/Cocoa/PlatformXRCoordinator.h	2021-07-12 09:30:56 UTC (rev 279822)
@@ -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)

Copied: trunk/Source/WebKit/UIProcess/Cocoa/PlatformXRCoordinator.mm (from rev 279821, trunk/Source/WebKit/WebProcess/cocoa/PlatformXRSystemProxy.messages.in) (0 => 279822)


--- trunk/Source/WebKit/UIProcess/Cocoa/PlatformXRCoordinator.mm	                        (rev 0)
+++ trunk/Source/WebKit/UIProcess/Cocoa/PlatformXRCoordinator.mm	2021-07-12 09:30:56 UTC (rev 279822)
@@ -0,0 +1,33 @@
+/*
+ * 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 "PlatformXRCoordinator.h"
+
+#if ENABLE(WEBXR) && USE(APPLE_INTERNAL_SDK)
+
+#import <WebKitAdditions/PlatformXRSystemAdditions.mm>
+
+#endif // ENABLE(WEBXR) && USE(APPLE_INTERNAL_SDK)

Deleted: trunk/Source/WebKit/UIProcess/Cocoa/PlatformXRSystem.h (279821 => 279822)


--- trunk/Source/WebKit/UIProcess/Cocoa/PlatformXRSystem.h	2021-07-12 08:22:41 UTC (rev 279821)
+++ trunk/Source/WebKit/UIProcess/Cocoa/PlatformXRSystem.h	2021-07-12 09:30:56 UTC (rev 279822)
@@ -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)

Deleted: trunk/Source/WebKit/UIProcess/Cocoa/PlatformXRSystem.messages.in (279821 => 279822)


--- trunk/Source/WebKit/UIProcess/Cocoa/PlatformXRSystem.messages.in	2021-07-12 08:22:41 UTC (rev 279821)
+++ trunk/Source/WebKit/UIProcess/Cocoa/PlatformXRSystem.messages.in	2021-07-12 09:30:56 UTC (rev 279822)
@@ -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

Deleted: trunk/Source/WebKit/UIProcess/Cocoa/PlatformXRSystem.mm (279821 => 279822)


--- trunk/Source/WebKit/UIProcess/Cocoa/PlatformXRSystem.mm	2021-07-12 08:22:41 UTC (rev 279821)
+++ trunk/Source/WebKit/UIProcess/Cocoa/PlatformXRSystem.mm	2021-07-12 09:30:56 UTC (rev 279822)
@@ -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)

Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (279821 => 279822)


--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp	2021-07-12 08:22:41 UTC (rev 279821)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp	2021-07-12 09:30:56 UTC (rev 279822)
@@ -1040,7 +1040,7 @@
     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
@@ -7816,7 +7816,7 @@
 
     m_speechRecognitionPermissionManager = nullptr;
 
-#if ENABLE(WEBXR) && PLATFORM(COCOA)
+#if ENABLE(WEBXR) && !USE(OPENXR)
     if (m_xrSystem) {
         m_xrSystem->invalidate();
         m_xrSystem = nullptr;

Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.h (279821 => 279822)


--- trunk/Source/WebKit/UIProcess/WebPageProxy.h	2021-07-12 08:22:41 UTC (rev 279821)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.h	2021-07-12 09:30:56 UTC (rev 279822)
@@ -185,7 +185,7 @@
 #include <WebCore/MediaSessionIdentifier.h>
 #endif
 
-#if ENABLE(WEBXR) && PLATFORM(COCOA)
+#if ENABLE(WEBXR) && !USE(OPENXR)
 #include "PlatformXRSystem.h"
 #endif
 
@@ -3060,7 +3060,7 @@
 
     std::optional<WebCore::PrivateClickMeasurement> m_privateClickMeasurement;
 
-#if ENABLE(WEBXR) && PLATFORM(COCOA)
+#if ENABLE(WEBXR) && !USE(OPENXR)
     std::unique_ptr<PlatformXRSystem> m_xrSystem;
 #endif
 

Copied: trunk/Source/WebKit/UIProcess/XR/PlatformXRCoordinator.h (from rev 279821, trunk/Source/WebKit/UIProcess/Cocoa/PlatformXRCoordinator.h) (0 => 279822)


--- trunk/Source/WebKit/UIProcess/XR/PlatformXRCoordinator.h	                        (rev 0)
+++ trunk/Source/WebKit/UIProcess/XR/PlatformXRCoordinator.h	2021-07-12 09:30:56 UTC (rev 279822)
@@ -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)

Copied: trunk/Source/WebKit/UIProcess/XR/PlatformXRSystem.cpp (from rev 279821, trunk/Source/WebKit/UIProcess/Cocoa/PlatformXRSystem.mm) (0 => 279822)


--- trunk/Source/WebKit/UIProcess/XR/PlatformXRSystem.cpp	                        (rev 0)
+++ trunk/Source/WebKit/UIProcess/XR/PlatformXRSystem.cpp	2021-07-12 09:30:56 UTC (rev 279822)
@@ -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)

Copied: trunk/Source/WebKit/UIProcess/XR/PlatformXRSystem.h (from rev 279821, trunk/Source/WebKit/UIProcess/Cocoa/PlatformXRSystem.h) (0 => 279822)


--- trunk/Source/WebKit/UIProcess/XR/PlatformXRSystem.h	                        (rev 0)
+++ trunk/Source/WebKit/UIProcess/XR/PlatformXRSystem.h	2021-07-12 09:30:56 UTC (rev 279822)
@@ -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)

Copied: trunk/Source/WebKit/UIProcess/XR/PlatformXRSystem.messages.in (from rev 279821, trunk/Source/WebKit/UIProcess/Cocoa/PlatformXRSystem.messages.in) (0 => 279822)


--- trunk/Source/WebKit/UIProcess/XR/PlatformXRSystem.messages.in	                        (rev 0)
+++ trunk/Source/WebKit/UIProcess/XR/PlatformXRSystem.messages.in	2021-07-12 09:30:56 UTC (rev 279822)
@@ -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

Modified: trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj (279821 => 279822)


--- trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj	2021-07-12 08:22:41 UTC (rev 279821)
+++ trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj	2021-07-12 09:30:56 UTC (rev 279822)
@@ -1116,12 +1116,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 */; };
@@ -2569,6 +2563,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>"; };
@@ -4196,18 +4203,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>"; };
@@ -6446,6 +6441,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 = (
@@ -6712,6 +6740,7 @@
 				1AAE058C1279DCD400852418 /* Plugins */,
 				2D2E04761F5BEC4F00BB25ED /* RemoteLayerTree */,
 				1ABF43781A368035003FB0E6 /* WebsiteData */,
+				118502602673B0DA00A6425E /* XR */,
 				E3BCE877267252120011D8DB /* AccessibilityPreferences.cpp */,
 				E3BCE878267252120011D8DB /* AccessibilityPreferences.h */,
 				A7D792D51767CB6E00881CBE /* ActivityAssertion.cpp */,
@@ -7072,10 +7101,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 */,
@@ -8364,11 +8390,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;
@@ -9358,9 +9379,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 */,
@@ -9826,6 +9844,7 @@
 				BC032D5D10F437220058C15A /* WebCoreSupport */,
 				BC032D5E10F4372B0058C15A /* WebPage */,
 				1AAC4DDE16B1CBF6009425E3 /* WebStorage */,
+				118502552673B01600A6425E /* XR */,
 				BCE9C0CF1485965D00E33D61 /* WebConnectionToUIProcess.cpp */,
 				BCE9C0D01485965D00E33D61 /* WebConnectionToUIProcess.h */,
 				BC111AE3112F5C2600337BAB /* WebProcess.cpp */,
@@ -9993,6 +10012,7 @@
 				1AAF089E192681AC00B6390C /* UserContent */,
 				57608294202BD84900116678 /* WebAuthentication */,
 				1A53C2A31A325691004E8C70 /* WebsiteData */,
+				118502592673B07100A6425E /* XR */,
 				E1513C64166EABB200149FCB /* AuxiliaryProcessProxy.cpp */,
 				E1513C65166EABB200149FCB /* AuxiliaryProcessProxy.h */,
 				46A2B6061E5675A200C3DEDA /* BackgroundProcessResponsivenessTimer.cpp */,
@@ -12218,9 +12238,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 */,
@@ -13118,9 +13135,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;
 		};

Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp (279821 => 279822)


--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp	2021-07-12 08:22:41 UTC (rev 279821)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp	2021-07-12 09:30:56 UTC (rev 279822)
@@ -1503,7 +1503,7 @@
 
 #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));

Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h (279821 => 279822)


--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h	2021-07-12 08:22:41 UTC (rev 279821)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h	2021-07-12 09:30:56 UTC (rev 279822)
@@ -448,7 +448,7 @@
     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
 

Modified: trunk/Source/WebKit/WebProcess/WebPage/Cocoa/WebPageCocoa.mm (279821 => 279822)


--- trunk/Source/WebKit/WebProcess/WebPage/Cocoa/WebPageCocoa.mm	2021-07-12 08:22:41 UTC (rev 279821)
+++ trunk/Source/WebKit/WebProcess/WebPage/Cocoa/WebPageCocoa.mm	2021-07-12 09:30:56 UTC (rev 279822)
@@ -443,15 +443,6 @@
     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)

Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp (279821 => 279822)


--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2021-07-12 08:22:41 UTC (rev 279821)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2021-07-12 09:30:56 UTC (rev 279822)
@@ -7319,6 +7319,15 @@
 }
 #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)

Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.h (279821 => 279822)


--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.h	2021-07-12 08:22:41 UTC (rev 279821)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.h	2021-07-12 09:30:56 UTC (rev 279822)
@@ -145,7 +145,7 @@
 #include <WebCore/MediaSessionIdentifier.h>
 #endif
 
-#if ENABLE(WEBXR) && PLATFORM(COCOA)
+#if ENABLE(WEBXR) && !USE(OPENXR)
 #include "PlatformXRSystemProxy.h"
 #endif
 
@@ -1462,7 +1462,7 @@
     void textAutosizingUsesIdempotentModeChanged();
 #endif
 
-#if ENABLE(WEBXR) && PLATFORM(COCOA)
+#if ENABLE(WEBXR) && !USE(OPENXR)
     PlatformXRSystemProxy& xrSystemProxy();
 #endif
 
@@ -2363,7 +2363,7 @@
     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
     

Copied: trunk/Source/WebKit/WebProcess/XR/PlatformXRSystemProxy.cpp (from rev 279821, trunk/Source/WebKit/WebProcess/cocoa/PlatformXRSystemProxy.mm) (0 => 279822)


--- trunk/Source/WebKit/WebProcess/XR/PlatformXRSystemProxy.cpp	                        (rev 0)
+++ trunk/Source/WebKit/WebProcess/XR/PlatformXRSystemProxy.cpp	2021-07-12 09:30:56 UTC (rev 279822)
@@ -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)

Copied: trunk/Source/WebKit/WebProcess/XR/PlatformXRSystemProxy.h (from rev 279821, trunk/Source/WebKit/WebProcess/cocoa/PlatformXRSystemProxy.h) (0 => 279822)


--- trunk/Source/WebKit/WebProcess/XR/PlatformXRSystemProxy.h	                        (rev 0)
+++ trunk/Source/WebKit/WebProcess/XR/PlatformXRSystemProxy.h	2021-07-12 09:30:56 UTC (rev 279822)
@@ -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)

Copied: trunk/Source/WebKit/WebProcess/XR/PlatformXRSystemProxy.messages.in (from rev 279821, trunk/Source/WebKit/WebProcess/cocoa/PlatformXRSystemProxy.messages.in) (0 => 279822)


--- trunk/Source/WebKit/WebProcess/XR/PlatformXRSystemProxy.messages.in	                        (rev 0)
+++ trunk/Source/WebKit/WebProcess/XR/PlatformXRSystemProxy.messages.in	2021-07-12 09:30:56 UTC (rev 279822)
@@ -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

Deleted: trunk/Source/WebKit/WebProcess/cocoa/PlatformXRSystemProxy.h (279821 => 279822)


--- trunk/Source/WebKit/WebProcess/cocoa/PlatformXRSystemProxy.h	2021-07-12 08:22:41 UTC (rev 279821)
+++ trunk/Source/WebKit/WebProcess/cocoa/PlatformXRSystemProxy.h	2021-07-12 09:30:56 UTC (rev 279822)
@@ -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)

Deleted: trunk/Source/WebKit/WebProcess/cocoa/PlatformXRSystemProxy.messages.in (279821 => 279822)


--- trunk/Source/WebKit/WebProcess/cocoa/PlatformXRSystemProxy.messages.in	2021-07-12 08:22:41 UTC (rev 279821)
+++ trunk/Source/WebKit/WebProcess/cocoa/PlatformXRSystemProxy.messages.in	2021-07-12 09:30:56 UTC (rev 279822)
@@ -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

Deleted: trunk/Source/WebKit/WebProcess/cocoa/PlatformXRSystemProxy.mm (279821 => 279822)


--- trunk/Source/WebKit/WebProcess/cocoa/PlatformXRSystemProxy.mm	2021-07-12 08:22:41 UTC (rev 279821)
+++ trunk/Source/WebKit/WebProcess/cocoa/PlatformXRSystemProxy.mm	2021-07-12 09:30:56 UTC (rev 279822)
@@ -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)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to