Title: [293033] trunk/Source
Revision
293033
Author
[email protected]
Date
2022-04-19 13:27:10 -0700 (Tue, 19 Apr 2022)

Log Message

[WebXR] Update Device::initializeTrackingAndRendering() to take in more parameters regarding the session setup
https://bugs.webkit.org/show_bug.cgi?id=239476

Patch by Ada Chan <[email protected]> on 2022-04-19
Reviewed by Dean Jackson.

Source/WebCore:

Pass in document's origin and session features to Device::initializeTrackingAndRendering().

* Modules/webxr/WebXRSession.cpp:
(WebCore::WebXRSession::WebXRSession):
* Modules/webxr/WebXRSystem.h:
* platform/xr/PlatformXR.h:
* platform/xr/openxr/PlatformXROpenXR.cpp:
(PlatformXR::OpenXRDevice::initializeTrackingAndRendering):
* platform/xr/openxr/PlatformXROpenXR.h:
* testing/WebFakeXRDevice.cpp:
(WebCore::SimulatedXRDevice::initializeTrackingAndRendering):
* testing/WebFakeXRDevice.h:

Source/WebKit:

Pass in document's origin and session features to Device::initializeTrackingAndRendering().

* Shared/XR/XRDeviceProxy.cpp:
(WebKit::XRDeviceProxy::initializeTrackingAndRendering):
* Shared/XR/XRDeviceProxy.h:
* UIProcess/XR/PlatformXRCoordinator.h:
* UIProcess/XR/PlatformXRSystem.cpp:
(WebKit::PlatformXRSystem::initializeTrackingAndRendering):
* UIProcess/XR/PlatformXRSystem.h:
* UIProcess/XR/PlatformXRSystem.messages.in:
* WebProcess/XR/PlatformXRSystemProxy.cpp:
(WebKit::PlatformXRSystemProxy::initializeTrackingAndRendering):
* WebProcess/XR/PlatformXRSystemProxy.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (293032 => 293033)


--- trunk/Source/WebCore/ChangeLog	2022-04-19 20:08:37 UTC (rev 293032)
+++ trunk/Source/WebCore/ChangeLog	2022-04-19 20:27:10 UTC (rev 293033)
@@ -1,3 +1,23 @@
+2022-04-19  Ada Chan  <[email protected]>
+
+        [WebXR] Update Device::initializeTrackingAndRendering() to take in more parameters regarding the session setup
+        https://bugs.webkit.org/show_bug.cgi?id=239476
+
+        Reviewed by Dean Jackson.
+
+        Pass in document's origin and session features to Device::initializeTrackingAndRendering(). 
+
+        * Modules/webxr/WebXRSession.cpp:
+        (WebCore::WebXRSession::WebXRSession):
+        * Modules/webxr/WebXRSystem.h:
+        * platform/xr/PlatformXR.h:
+        * platform/xr/openxr/PlatformXROpenXR.cpp:
+        (PlatformXR::OpenXRDevice::initializeTrackingAndRendering):
+        * platform/xr/openxr/PlatformXROpenXR.h:
+        * testing/WebFakeXRDevice.cpp:
+        (WebCore::SimulatedXRDevice::initializeTrackingAndRendering):
+        * testing/WebFakeXRDevice.h:
+
 2022-04-19  Myles C. Maxfield  <[email protected]>
 
         [Cocoa] Add explanatory comments in fillVectorWithVerticalGlyphPositions() and simplify it somewhat

Modified: trunk/Source/WebCore/Modules/webxr/WebXRSession.cpp (293032 => 293033)


--- trunk/Source/WebCore/Modules/webxr/WebXRSession.cpp	2022-04-19 20:08:37 UTC (rev 293032)
+++ trunk/Source/WebCore/Modules/webxr/WebXRSession.cpp	2022-04-19 20:27:10 UTC (rev 293033)
@@ -66,7 +66,7 @@
     , m_views(device.views(mode))
 {
     m_device->setTrackingAndRenderingClient(*this);
-    m_device->initializeTrackingAndRendering(mode);
+    m_device->initializeTrackingAndRendering(document.securityOrigin().data(), mode, m_requestedFeatures);
 
     // https://immersive-web.github.io/webxr/#ref-for-dom-xrreferencespacetype-viewer%E2%91%A2
     // Every session MUST support viewer XRReferenceSpaces.

Modified: trunk/Source/WebCore/Modules/webxr/WebXRSystem.h (293032 => 293033)


--- trunk/Source/WebCore/Modules/webxr/WebXRSystem.h	2022-04-19 20:08:37 UTC (rev 293032)
+++ trunk/Source/WebCore/Modules/webxr/WebXRSystem.h	2022-04-19 20:27:10 UTC (rev 293033)
@@ -51,6 +51,7 @@
 class Navigator;
 class ScriptExecutionContext;
 class WebXRSession;
+struct SecurityOriginData;
 struct XRSessionInit;
 
 class WebXRSystem final : public RefCounted<WebXRSystem>, public EventTargetWithInlineData, public ActiveDOMObject {
@@ -112,7 +113,7 @@
         explicit DummyInlineDevice(ScriptExecutionContext&);
 
     private:
-        void initializeTrackingAndRendering(PlatformXR::SessionMode) final { }
+        void initializeTrackingAndRendering(const WebCore::SecurityOriginData&, PlatformXR::SessionMode, const PlatformXR::Device::FeatureList&) final { }
         void shutDownTrackingAndRendering() final { }
         void initializeReferenceSpace(PlatformXR::ReferenceSpaceType) final { }
 

Modified: trunk/Source/WebCore/platform/xr/PlatformXR.h (293032 => 293033)


--- trunk/Source/WebCore/platform/xr/PlatformXR.h	2022-04-19 20:08:37 UTC (rev 293032)
+++ trunk/Source/WebCore/platform/xr/PlatformXR.h	2022-04-19 20:27:10 UTC (rev 293033)
@@ -37,6 +37,10 @@
 #include <wtf/MachSendRight.h>
 #endif
 
+namespace WebCore {
+struct SecurityOriginData;
+}
+
 namespace PlatformXR {
 
 enum class SessionMode : uint8_t {
@@ -222,7 +226,7 @@
     virtual double maxFramebufferScalingFactor() const { return nativeFramebufferScalingFactor(); }
 
 
-    virtual void initializeTrackingAndRendering(SessionMode) = 0;
+    virtual void initializeTrackingAndRendering(const WebCore::SecurityOriginData&, SessionMode, const FeatureList&) = 0;
     virtual void shutDownTrackingAndRendering() = 0;
     TrackingAndRenderingClient* trackingAndRenderingClient() const { return m_trackingAndRenderingClient.get(); }
     void setTrackingAndRenderingClient(WeakPtr<TrackingAndRenderingClient>&& client) { m_trackingAndRenderingClient = WTFMove(client); }

Modified: trunk/Source/WebCore/platform/xr/openxr/PlatformXROpenXR.cpp (293032 => 293033)


--- trunk/Source/WebCore/platform/xr/openxr/PlatformXROpenXR.cpp	2022-04-19 20:08:37 UTC (rev 293032)
+++ trunk/Source/WebCore/platform/xr/openxr/PlatformXROpenXR.cpp	2022-04-19 20:27:10 UTC (rev 293033)
@@ -85,7 +85,7 @@
     return Device::recommendedResolution(mode);
 }
 
-void OpenXRDevice::initializeTrackingAndRendering(SessionMode mode)
+void OpenXRDevice::initializeTrackingAndRendering(const WebCore::SecurityOriginData&, SessionMode mode, const Device::FeatureList&)
 {
     m_queue.dispatch([this, protectedThis = Ref { *this }, mode]() {
         ASSERT(m_instance != XR_NULL_HANDLE);

Modified: trunk/Source/WebCore/platform/xr/openxr/PlatformXROpenXR.h (293032 => 293033)


--- trunk/Source/WebCore/platform/xr/openxr/PlatformXROpenXR.h	2022-04-19 20:08:37 UTC (rev 293032)
+++ trunk/Source/WebCore/platform/xr/openxr/PlatformXROpenXR.h	2022-04-19 20:27:10 UTC (rev 293033)
@@ -60,7 +60,7 @@
 
     // PlatformXR::Device
     WebCore::IntSize recommendedResolution(SessionMode) final;
-    void initializeTrackingAndRendering(SessionMode) final;
+    void initializeTrackingAndRendering(const WebCore::SecurityOriginData&, SessionMode, const Device::FeatureList&) final;
     void shutDownTrackingAndRendering() final;
     void initializeReferenceSpace(PlatformXR::ReferenceSpaceType) final;
     bool supportsSessionShutdownNotification() const final { return true; }

Modified: trunk/Source/WebCore/testing/WebFakeXRDevice.cpp (293032 => 293033)


--- trunk/Source/WebCore/testing/WebFakeXRDevice.cpp	2022-04-19 20:08:37 UTC (rev 293032)
+++ trunk/Source/WebCore/testing/WebFakeXRDevice.cpp	2022-04-19 20:27:10 UTC (rev 293033)
@@ -109,7 +109,7 @@
     return IntSize(32, 32);
 }
 
-void SimulatedXRDevice::initializeTrackingAndRendering(PlatformXR::SessionMode)
+void SimulatedXRDevice::initializeTrackingAndRendering(const WebCore::SecurityOriginData&, PlatformXR::SessionMode, const PlatformXR::Device::FeatureList&)
 {
     GraphicsContextGLAttributes attributes;
     attributes.depth = false;

Modified: trunk/Source/WebCore/testing/WebFakeXRDevice.h (293032 => 293033)


--- trunk/Source/WebCore/testing/WebFakeXRDevice.h	2022-04-19 20:08:37 UTC (rev 293032)
+++ trunk/Source/WebCore/testing/WebFakeXRDevice.h	2022-04-19 20:27:10 UTC (rev 293033)
@@ -84,7 +84,7 @@
     void addInputConnection(Ref<WebFakeXRInputController>&& input) { m_inputConnections.append(WTFMove(input)); };
 private:
     WebCore::IntSize recommendedResolution(PlatformXR::SessionMode) final;
-    void initializeTrackingAndRendering(PlatformXR::SessionMode) final;
+    void initializeTrackingAndRendering(const WebCore::SecurityOriginData&, PlatformXR::SessionMode, const PlatformXR::Device::FeatureList&) final;
     void shutDownTrackingAndRendering() final;
     bool supportsSessionShutdownNotification() const final { return m_supportsShutdownNotification; }
     void initializeReferenceSpace(PlatformXR::ReferenceSpaceType) final { }

Modified: trunk/Source/WebKit/ChangeLog (293032 => 293033)


--- trunk/Source/WebKit/ChangeLog	2022-04-19 20:08:37 UTC (rev 293032)
+++ trunk/Source/WebKit/ChangeLog	2022-04-19 20:27:10 UTC (rev 293033)
@@ -1,3 +1,24 @@
+2022-04-19  Ada Chan  <[email protected]>
+
+        [WebXR] Update Device::initializeTrackingAndRendering() to take in more parameters regarding the session setup
+        https://bugs.webkit.org/show_bug.cgi?id=239476
+
+        Reviewed by Dean Jackson.
+
+        Pass in document's origin and session features to Device::initializeTrackingAndRendering().
+
+        * Shared/XR/XRDeviceProxy.cpp:
+        (WebKit::XRDeviceProxy::initializeTrackingAndRendering):
+        * Shared/XR/XRDeviceProxy.h:
+        * UIProcess/XR/PlatformXRCoordinator.h:
+        * UIProcess/XR/PlatformXRSystem.cpp:
+        (WebKit::PlatformXRSystem::initializeTrackingAndRendering):
+        * UIProcess/XR/PlatformXRSystem.h:
+        * UIProcess/XR/PlatformXRSystem.messages.in:
+        * WebProcess/XR/PlatformXRSystemProxy.cpp:
+        (WebKit::PlatformXRSystemProxy::initializeTrackingAndRendering):
+        * WebProcess/XR/PlatformXRSystemProxy.h:
+
 2022-04-15  Antoine Quint  <[email protected]>
 
         [model] ready promise does not work on iOS

Modified: trunk/Source/WebKit/Shared/XR/XRDeviceProxy.cpp (293032 => 293033)


--- trunk/Source/WebKit/Shared/XR/XRDeviceProxy.cpp	2022-04-19 20:08:37 UTC (rev 293032)
+++ trunk/Source/WebKit/Shared/XR/XRDeviceProxy.cpp	2022-04-19 20:27:10 UTC (rev 293033)
@@ -30,6 +30,7 @@
 
 #include "PlatformXRSystemProxy.h"
 #include "XRDeviceInfo.h"
+#include <WebCore/SecurityOriginData.h>
 
 using namespace PlatformXR;
 
@@ -63,7 +64,7 @@
         trackingAndRenderingClient()->updateSessionVisibilityState(visibilityState);
 }
 
-void XRDeviceProxy::initializeTrackingAndRendering(PlatformXR::SessionMode sessionMode)
+void XRDeviceProxy::initializeTrackingAndRendering(const WebCore::SecurityOriginData& securityOriginData, PlatformXR::SessionMode sessionMode, const PlatformXR::Device::FeatureList& requestedFeatures)
 {
     if (sessionMode != PlatformXR::SessionMode::ImmersiveVr)
         return;
@@ -71,7 +72,7 @@
     if (!m_xrSystem)
         return;
 
-    m_xrSystem->initializeTrackingAndRendering();
+    m_xrSystem->initializeTrackingAndRendering(securityOriginData, sessionMode, requestedFeatures);
 
     // This is called from the constructor of WebXRSession. Since sessionDidInitializeInputSources()
     // ends up calling queueTaskKeepingObjectAlive() which refs the WebXRSession object, we

Modified: trunk/Source/WebKit/Shared/XR/XRDeviceProxy.h (293032 => 293033)


--- trunk/Source/WebKit/Shared/XR/XRDeviceProxy.h	2022-04-19 20:08:37 UTC (rev 293032)
+++ trunk/Source/WebKit/Shared/XR/XRDeviceProxy.h	2022-04-19 20:27:10 UTC (rev 293033)
@@ -33,6 +33,10 @@
 #include <wtf/Vector.h>
 #include <wtf/WeakPtr.h>
 
+namespace WebCore {
+struct SecurityOriginData;
+}
+
 namespace WebKit {
 
 class PlatformXRSystemProxy;
@@ -51,7 +55,7 @@
     XRDeviceProxy(XRDeviceInfo&&, PlatformXRSystemProxy&);
 
     WebCore::IntSize recommendedResolution(PlatformXR::SessionMode) final { return m_recommendedResolution; }
-    void initializeTrackingAndRendering(PlatformXR::SessionMode) final;
+    void initializeTrackingAndRendering(const WebCore::SecurityOriginData&, PlatformXR::SessionMode, const PlatformXR::Device::FeatureList&) final;
     void shutDownTrackingAndRendering() final;
     bool supportsSessionShutdownNotification() const final { return true; }
     void initializeReferenceSpace(PlatformXR::ReferenceSpaceType) final { }

Modified: trunk/Source/WebKit/UIProcess/XR/PlatformXRCoordinator.h (293032 => 293033)


--- trunk/Source/WebKit/UIProcess/XR/PlatformXRCoordinator.h	2022-04-19 20:08:37 UTC (rev 293032)
+++ trunk/Source/WebKit/UIProcess/XR/PlatformXRCoordinator.h	2022-04-19 20:27:10 UTC (rev 293033)
@@ -62,7 +62,7 @@
     };
 
     // Session creation/termination.
-    virtual void startSession(WebPageProxy&, WeakPtr<SessionEventClient>&&) = 0;
+    virtual void startSession(WebPageProxy&, WeakPtr<SessionEventClient>&&, const WebCore::SecurityOriginData&, PlatformXR::SessionMode, const PlatformXR::Device::FeatureList&) = 0;
     virtual void endSessionIfExists(WebPageProxy&) = 0;
 
     // Session display loop.

Modified: trunk/Source/WebKit/UIProcess/XR/PlatformXRSystem.cpp (293032 => 293033)


--- trunk/Source/WebKit/UIProcess/XR/PlatformXRSystem.cpp	2022-04-19 20:08:37 UTC (rev 293032)
+++ trunk/Source/WebKit/UIProcess/XR/PlatformXRSystem.cpp	2022-04-19 20:27:10 UTC (rev 293033)
@@ -84,7 +84,7 @@
     xrCoordinator->requestPermissionOnSessionFeatures(m_page, securityOriginData, mode, granted, consentRequired, consentOptional, WTFMove(completionHandler));
 }
 
-void PlatformXRSystem::initializeTrackingAndRendering()
+void PlatformXRSystem::initializeTrackingAndRendering(const WebCore::SecurityOriginData& securityOriginData, PlatformXR::SessionMode mode, const PlatformXR::Device::FeatureList& requestedFeatures)
 {
     auto* xrCoordinator = PlatformXRSystem::xrCoordinator();
     if (!xrCoordinator)
@@ -93,7 +93,7 @@
     m_immersiveSessionActivity = m_page.process().throttler().foregroundActivity("XR immersive session"_s).moveToUniquePtr();
 
     WeakPtr weakThis { *this };
-    xrCoordinator->startSession(m_page, weakThis);
+    xrCoordinator->startSession(m_page, weakThis, securityOriginData, mode, requestedFeatures);
 }
 
 void PlatformXRSystem::shutDownTrackingAndRendering()

Modified: trunk/Source/WebKit/UIProcess/XR/PlatformXRSystem.h (293032 => 293033)


--- trunk/Source/WebKit/UIProcess/XR/PlatformXRSystem.h	2022-04-19 20:08:37 UTC (rev 293032)
+++ trunk/Source/WebKit/UIProcess/XR/PlatformXRSystem.h	2022-04-19 20:27:10 UTC (rev 293033)
@@ -64,7 +64,7 @@
     // Message handlers
     void enumerateImmersiveXRDevices(CompletionHandler<void(Vector<XRDeviceInfo>&&)>&&);
     void requestPermissionOnSessionFeatures(const WebCore::SecurityOriginData&, PlatformXR::SessionMode, const PlatformXR::Device::FeatureList&, const PlatformXR::Device::FeatureList&, const PlatformXR::Device::FeatureList&, CompletionHandler<void(std::optional<PlatformXR::Device::FeatureList>&&)>&&);
-    void initializeTrackingAndRendering();
+    void initializeTrackingAndRendering(const WebCore::SecurityOriginData&, PlatformXR::SessionMode, const PlatformXR::Device::FeatureList&);
     void shutDownTrackingAndRendering();
     void requestFrame(CompletionHandler<void(PlatformXR::Device::FrameData&&)>&&);
     void submitFrame();

Modified: trunk/Source/WebKit/UIProcess/XR/PlatformXRSystem.messages.in (293032 => 293033)


--- trunk/Source/WebKit/UIProcess/XR/PlatformXRSystem.messages.in	2022-04-19 20:08:37 UTC (rev 293032)
+++ trunk/Source/WebKit/UIProcess/XR/PlatformXRSystem.messages.in	2022-04-19 20:27:10 UTC (rev 293033)
@@ -28,7 +28,7 @@
 messages -> PlatformXRSystem NotRefCounted {
     EnumerateImmersiveXRDevices() -> (Vector<WebKit::XRDeviceInfo> devicesInfos)
     RequestPermissionOnSessionFeatures(struct WebCore::SecurityOriginData origin, PlatformXR::SessionMode mode, Vector<PlatformXR::SessionFeature> granted, Vector<PlatformXR::SessionFeature> consentRequired, Vector<PlatformXR::SessionFeature> consentOptional) -> (std::optional<Vector<PlatformXR::SessionFeature>> userGranted)
-    InitializeTrackingAndRendering()
+    InitializeTrackingAndRendering(struct WebCore::SecurityOriginData origin, PlatformXR::SessionMode mode, Vector<PlatformXR::SessionFeature> requestedFeatures)
     ShutDownTrackingAndRendering()
     RequestFrame() -> (struct PlatformXR::Device::FrameData frameData)
     SubmitFrame()

Modified: trunk/Source/WebKit/WebProcess/XR/PlatformXRSystemProxy.cpp (293032 => 293033)


--- trunk/Source/WebKit/WebProcess/XR/PlatformXRSystemProxy.cpp	2022-04-19 20:08:37 UTC (rev 293032)
+++ trunk/Source/WebKit/WebProcess/XR/PlatformXRSystemProxy.cpp	2022-04-19 20:27:10 UTC (rev 293033)
@@ -75,9 +75,9 @@
     m_page.sendWithAsyncReply(Messages::PlatformXRSystem::RequestPermissionOnSessionFeatures(securityOriginData, mode, granted, consentRequired, consentOptional), WTFMove(completionHandler));
 }
 
-void PlatformXRSystemProxy::initializeTrackingAndRendering()
+void PlatformXRSystemProxy::initializeTrackingAndRendering(const WebCore::SecurityOriginData& securityOriginData, PlatformXR::SessionMode mode, const PlatformXR::Device::FeatureList& requestedFeatures)
 {
-    m_page.send(Messages::PlatformXRSystem::InitializeTrackingAndRendering());
+    m_page.send(Messages::PlatformXRSystem::InitializeTrackingAndRendering(securityOriginData, mode, requestedFeatures));
 }
 
 void PlatformXRSystemProxy::shutDownTrackingAndRendering()

Modified: trunk/Source/WebKit/WebProcess/XR/PlatformXRSystemProxy.h (293032 => 293033)


--- trunk/Source/WebKit/WebProcess/XR/PlatformXRSystemProxy.h	2022-04-19 20:08:37 UTC (rev 293032)
+++ trunk/Source/WebKit/WebProcess/XR/PlatformXRSystemProxy.h	2022-04-19 20:27:10 UTC (rev 293033)
@@ -47,7 +47,7 @@
 
     void enumerateImmersiveXRDevices(CompletionHandler<void(const PlatformXR::Instance::DeviceList&)>&&);
     void requestPermissionOnSessionFeatures(const WebCore::SecurityOriginData&, PlatformXR::SessionMode, const PlatformXR::Device::FeatureList& /* granted */, const PlatformXR::Device::FeatureList& /* consentRequired */, const PlatformXR::Device::FeatureList& /* consentOptional */, CompletionHandler<void(std::optional<PlatformXR::Device::FeatureList>&&)>&&);
-    void initializeTrackingAndRendering();
+    void initializeTrackingAndRendering(const WebCore::SecurityOriginData&, PlatformXR::SessionMode, const PlatformXR::Device::FeatureList&);
     void shutDownTrackingAndRendering();
     void requestFrame(PlatformXR::Device::RequestFrameCallback&&);
     std::optional<PlatformXR::LayerHandle> createLayerProjection(uint32_t, uint32_t, bool);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to