Commit 9bc8796c authored by codeimpl's avatar codeimpl Committed by Commit Bot

[WebXR] Change from XRPresentationFrame to XRFrame

XRFrame is a more generric name because with the addition of the input API
we're using frames in places where there's no expectation of rendering or
presentation involved[1].

[1] https://github.com/immersive-web/webxr/issues/364

Bug: 852528
Change-Id: Ie9a325cd626912b09bb2b77fe1b46d29baaef0b8
Reviewed-on: https://chromium-review.googlesource.com/1103426
Commit-Queue: Brandon Jones <bajones@chromium.org>
Reviewed-by: default avatarBrandon Jones <bajones@chromium.org>
Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Cr-Commit-Position: refs/heads/master@{#568654}
parent 0ee7fda8
......@@ -47,9 +47,9 @@ dictionary XRSessionCreationOptions {
attribute EventHandler onend;
};
callback XRFrameRequestCallback = void (DOMHighResTimeStamp time, XRPresentationFrame frame);
callback XRFrameRequestCallback = void (DOMHighResTimeStamp time, XRFrame frame);
[SecureContext, Exposed=Window] interface XRPresentationFrame {
[SecureContext, Exposed=Window] interface XRFrame {
readonly attribute FrozenArray<XRView> views;
XRDevicePose? getDevicePose(XRCoordinateSystem coordinateSystem);
......
......@@ -59,16 +59,16 @@ PASS XRSession interface: attribute onresetpose
PASS Unscopable handled correctly for onresetpose property on XRSession
PASS XRSession interface: attribute onend
PASS Unscopable handled correctly for onend property on XRSession
PASS XRPresentationFrame interface: existence and properties of interface object
PASS XRPresentationFrame interface object length
PASS XRPresentationFrame interface object name
PASS XRPresentationFrame interface: existence and properties of interface prototype object
PASS XRPresentationFrame interface: existence and properties of interface prototype object's "constructor" property
PASS XRPresentationFrame interface: existence and properties of interface prototype object's @@unscopables property
PASS XRPresentationFrame interface: attribute views
PASS Unscopable handled correctly for views property on XRPresentationFrame
PASS XRPresentationFrame interface: operation getDevicePose(XRCoordinateSystem)
PASS Unscopable handled correctly for getDevicePose(XRCoordinateSystem) on XRPresentationFrame
PASS XRFrame interface: existence and properties of interface object
PASS XRFrame interface object length
PASS XRFrame interface object name
PASS XRFrame interface: existence and properties of interface prototype object
PASS XRFrame interface: existence and properties of interface prototype object's "constructor" property
PASS XRFrame interface: existence and properties of interface prototype object's @@unscopables property
PASS XRFrame interface: attribute views
PASS Unscopable handled correctly for views property on XRFrame
PASS XRFrame interface: operation getDevicePose(XRCoordinateSystem)
PASS Unscopable handled correctly for getDevicePose(XRCoordinateSystem) on XRFrame
FAIL XRCoordinateSystem interface: existence and properties of interface object assert_equals: prototype of XRCoordinateSystem is not EventTarget expected function "function EventTarget() { [native code] }" but got function "function () { [native code] }"
PASS XRCoordinateSystem interface object length
PASS XRCoordinateSystem interface object name
......
......@@ -12,7 +12,7 @@ function forEachWebxrObject(callback) {
callback(window.XRSessionCreationOptions, 'XRSessionCreationOptions');
callback(window.XRFrameRequestCallback, 'XRFrameRequestCallback');
callback(window.XRPresentationContext, 'XRPresentationContext');
callback(window.XRPresentationFrame, 'XRPresentationFrame');
callback(window.XRFrame, 'XRFrame');
callback(window.XRView, 'XRView');
callback(window.XRViewport, 'XRViewport');
callback(window.XRDevicePose, 'XRDevicePose');
......
......@@ -9111,6 +9111,13 @@ interface XRDevicePose
getter poseModelMatrix
method constructor
method getViewMatrix
interface XRFrame
attribute @@toStringTag
getter session
getter views
method constructor
method getDevicePose
method getInputPose
interface XRFrameOfReference : XRCoordinateSystem
attribute @@toStringTag
getter bounds
......@@ -9139,13 +9146,6 @@ interface XRPresentationContext
attribute @@toStringTag
getter canvas
method constructor
interface XRPresentationFrame
attribute @@toStringTag
getter session
getter views
method constructor
method getDevicePose
method getInputPose
interface XRSession : EventTarget
attribute @@toStringTag
getter baseLayer
......
......@@ -15,7 +15,7 @@ xr_session_promise_test( (session) => new Promise((resolve) => {
session.baseLayer = new XRWebGLLayer(session, gl);
function onFrame(time, xrFrame) {
assert_true(xrFrame instanceof XRPresentationFrame);
assert_true(xrFrame instanceof XRFrame);
// Test does not complete until the returned promise resolves.
resolve();
}
......
......@@ -58,6 +58,6 @@ xr_session_promise_test( (session, t) => {
{ exclusive: true },
{ outputContext: getOutputContext() }
],
"XRPresentationFrame getDevicePose updates on the next frame");
"XRFrame getDevicePose updates on the next frame");
</script>
......@@ -55,6 +55,6 @@ xr_session_promise_test( (session) => {
session.requestAnimationFrame(onFrame);
}));
}, fakeDevices["FakeGooglePixelPhone"], [{ exclusive: true }],
"XRPresentationFrame contains the expected views");
"XRFrame contains the expected views");
</script>
......@@ -424,6 +424,7 @@ modules_idl_files =
"xr/xr_coordinate_system.idl",
"xr/xr_device.idl",
"xr/xr_device_pose.idl",
"xr/xr_frame.idl",
"xr/xr_frame_of_reference.idl",
"xr/xr_hit_result.idl",
"xr/xr_input_pose.idl",
......@@ -431,7 +432,6 @@ modules_idl_files =
"xr/xr_input_source_event.idl",
"xr/xr_layer.idl",
"xr/xr_presentation_context.idl",
"xr/xr_presentation_frame.idl",
"xr/xr_session.idl",
"xr/xr_session_event.idl",
"xr/xr_stage_bounds.idl",
......
......@@ -16,6 +16,8 @@ blink_modules_sources("xr") {
"xr_device.h",
"xr_device_pose.cc",
"xr_device_pose.h",
"xr_frame.cc",
"xr_frame.h",
"xr_frame_of_reference.cc",
"xr_frame_of_reference.h",
"xr_frame_provider.cc",
......@@ -34,8 +36,6 @@ blink_modules_sources("xr") {
"xr_layer.h",
"xr_presentation_context.cc",
"xr_presentation_context.h",
"xr_presentation_frame.cc",
"xr_presentation_frame.h",
"xr_session.cc",
"xr_session.h",
"xr_session_event.cc",
......
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "third_party/blink/renderer/modules/xr/xr_presentation_frame.h"
#include "third_party/blink/renderer/modules/xr/xr_frame.h"
#include "third_party/blink/renderer/modules/xr/xr_coordinate_system.h"
#include "third_party/blink/renderer/modules/xr/xr_device_pose.h"
......@@ -13,14 +13,13 @@
namespace blink {
XRPresentationFrame::XRPresentationFrame(XRSession* session)
: session_(session) {}
XRFrame::XRFrame(XRSession* session) : session_(session) {}
const HeapVector<Member<XRView>>& XRPresentationFrame::views() const {
const HeapVector<Member<XRView>>& XRFrame::views() const {
return session_->views();
}
XRDevicePose* XRPresentationFrame::getDevicePose(
XRDevicePose* XRFrame::getDevicePose(
XRCoordinateSystem* coordinate_system) const {
session_->LogGetPose();
......@@ -45,7 +44,7 @@ XRDevicePose* XRPresentationFrame::getDevicePose(
return new XRDevicePose(session(), std::move(pose));
}
XRInputPose* XRPresentationFrame::getInputPose(
XRInputPose* XRFrame::getInputPose(
XRInputSource* input_source,
XRCoordinateSystem* coordinate_system) const {
if (!input_source || !coordinate_system) {
......@@ -118,12 +117,11 @@ XRInputPose* XRPresentationFrame::getInputPose(
return nullptr;
}
void XRPresentationFrame::SetBasePoseMatrix(
const TransformationMatrix& base_pose_matrix) {
void XRFrame::SetBasePoseMatrix(const TransformationMatrix& base_pose_matrix) {
base_pose_matrix_ = TransformationMatrix::Create(base_pose_matrix);
}
void XRPresentationFrame::Trace(blink::Visitor* visitor) {
void XRFrame::Trace(blink::Visitor* visitor) {
visitor->Trace(session_);
ScriptWrappable::Trace(visitor);
}
......
......@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef THIRD_PARTY_BLINK_RENDERER_MODULES_XR_XR_PRESENTATION_FRAME_H_
#define THIRD_PARTY_BLINK_RENDERER_MODULES_XR_XR_PRESENTATION_FRAME_H_
#ifndef THIRD_PARTY_BLINK_RENDERER_MODULES_XR_XR_FRAME_H_
#define THIRD_PARTY_BLINK_RENDERER_MODULES_XR_XR_FRAME_H_
#include "device/vr/public/mojom/vr_service.mojom-blink.h"
#include "third_party/blink/renderer/platform/bindings/script_wrappable.h"
......@@ -21,11 +21,11 @@ class XRInputSource;
class XRSession;
class XRView;
class XRPresentationFrame final : public ScriptWrappable {
class XRFrame final : public ScriptWrappable {
DEFINE_WRAPPERTYPEINFO();
public:
explicit XRPresentationFrame(XRSession*);
explicit XRFrame(XRSession*);
XRSession* session() const { return session_; }
......
......@@ -2,11 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// https://immersive-web.github.io/webxr/#xrpresentationframe-interface
// https://immersive-web.github.io/webxr/#xrframe
[
SecureContext,
OriginTrialEnabled=WebXR
] interface XRPresentationFrame {
] interface XRFrame {
readonly attribute XRSession session;
readonly attribute FrozenArray<XRView> views;
......
......@@ -3,4 +3,4 @@
// found in the LICENSE file.
// https://immersive-web.github.io/webxr/#callbackdef-xrframerequestcallback
callback XRFrameRequestCallback = void (DOMHighResTimeStamp time, XRPresentationFrame frame);
callback XRFrameRequestCallback = void (DOMHighResTimeStamp time, XRFrame frame);
......@@ -7,7 +7,7 @@
#include "third_party/blink/renderer/bindings/modules/v8/v8_xr_frame_request_callback.h"
#include "third_party/blink/renderer/core/inspector/inspector_trace_events.h"
#include "third_party/blink/renderer/core/probe/core_probes.h"
#include "third_party/blink/renderer/modules/xr/xr_presentation_frame.h"
#include "third_party/blink/renderer/modules/xr/xr_frame.h"
#include "third_party/blink/renderer/modules/xr/xr_session.h"
namespace blink {
......@@ -33,9 +33,8 @@ void XRFrameRequestCallbackCollection::CancelCallback(CallbackId id) {
}
}
void XRFrameRequestCallbackCollection::ExecuteCallbacks(
XRSession* session,
XRPresentationFrame* frame) {
void XRFrameRequestCallbackCollection::ExecuteCallbacks(XRSession* session,
XRFrame* frame) {
// First, generate a list of callbacks to consider. Callbacks registered from
// this point on are considered only for the "next" frame, not this one.
DCHECK(callbacks_to_invoke_.IsEmpty());
......
......@@ -12,7 +12,7 @@ namespace blink {
class ExecutionContext;
class V8XRFrameRequestCallback;
class XRPresentationFrame;
class XRFrame;
class XRSession;
class XRFrameRequestCallbackCollection final : public TraceWrapperBase {
......@@ -24,7 +24,7 @@ class XRFrameRequestCallbackCollection final : public TraceWrapperBase {
using CallbackId = int;
CallbackId RegisterCallback(V8XRFrameRequestCallback*);
void CancelCallback(CallbackId);
void ExecuteCallbacks(XRSession*, XRPresentationFrame*);
void ExecuteCallbacks(XRSession*, XRFrame*);
bool IsEmpty() const { return !callbacks_.size(); }
......
......@@ -46,7 +46,7 @@ class XRInputSource : public ScriptWrappable {
bool selection_cancelled = false;
private:
friend class XRPresentationFrame;
friend class XRFrame;
const Member<XRSession> session_;
const uint32_t source_id_;
......
......@@ -9,7 +9,7 @@ namespace blink {
XRInputSourceEvent::XRInputSourceEvent() {}
XRInputSourceEvent::XRInputSourceEvent(const AtomicString& type,
XRPresentationFrame* frame,
XRFrame* frame,
XRInputSource* input_source)
: Event(type, Bubbles::kYes, Cancelable::kNo),
frame_(frame),
......
......@@ -6,9 +6,9 @@
#define THIRD_PARTY_BLINK_RENDERER_MODULES_XR_XR_INPUT_SOURCE_EVENT_H_
#include "third_party/blink/renderer/modules/event_modules.h"
#include "third_party/blink/renderer/modules/xr/xr_frame.h"
#include "third_party/blink/renderer/modules/xr/xr_input_source.h"
#include "third_party/blink/renderer/modules/xr/xr_input_source_event_init.h"
#include "third_party/blink/renderer/modules/xr/xr_presentation_frame.h"
namespace blink {
......@@ -18,7 +18,7 @@ class XRInputSourceEvent final : public Event {
public:
static XRInputSourceEvent* Create() { return new XRInputSourceEvent; }
static XRInputSourceEvent* Create(const AtomicString& type,
XRPresentationFrame* frame,
XRFrame* frame,
XRInputSource* input_source) {
return new XRInputSourceEvent(type, frame, input_source);
}
......@@ -30,7 +30,7 @@ class XRInputSourceEvent final : public Event {
~XRInputSourceEvent() override;
XRPresentationFrame* frame() const { return frame_.Get(); }
XRFrame* frame() const { return frame_.Get(); }
XRInputSource* inputSource() const { return input_source_.Get(); }
const AtomicString& InterfaceName() const override;
......@@ -39,12 +39,10 @@ class XRInputSourceEvent final : public Event {
private:
XRInputSourceEvent();
XRInputSourceEvent(const AtomicString& type,
XRPresentationFrame*,
XRInputSource*);
XRInputSourceEvent(const AtomicString& type, XRFrame*, XRInputSource*);
XRInputSourceEvent(const AtomicString&, const XRInputSourceEventInit&);
Member<XRPresentationFrame> frame_;
Member<XRFrame> frame_;
Member<XRInputSource> input_source_;
};
......
......@@ -7,6 +7,6 @@
OriginTrialEnabled=WebXR,
Constructor(DOMString type, XRInputSourceEventInit eventInitDict)
] interface XRInputSourceEvent : Event {
readonly attribute XRPresentationFrame frame;
readonly attribute XRFrame frame;
readonly attribute XRInputSource inputSource;
};
......@@ -5,6 +5,6 @@
[
SecureContext
] dictionary XRInputSourceEventInit : EventInit {
required XRPresentationFrame frame;
required XRFrame frame;
required XRInputSource inputSource;
};
\ No newline at end of file
......@@ -19,6 +19,7 @@
#include "third_party/blink/renderer/modules/xr/xr.h"
#include "third_party/blink/renderer/modules/xr/xr_canvas_input_provider.h"
#include "third_party/blink/renderer/modules/xr/xr_device.h"
#include "third_party/blink/renderer/modules/xr/xr_frame.h"
#include "third_party/blink/renderer/modules/xr/xr_frame_of_reference.h"
#include "third_party/blink/renderer/modules/xr/xr_frame_of_reference_options.h"
#include "third_party/blink/renderer/modules/xr/xr_frame_provider.h"
......@@ -26,7 +27,6 @@
#include "third_party/blink/renderer/modules/xr/xr_input_source_event.h"
#include "third_party/blink/renderer/modules/xr/xr_layer.h"
#include "third_party/blink/renderer/modules/xr/xr_presentation_context.h"
#include "third_party/blink/renderer/modules/xr/xr_presentation_frame.h"
#include "third_party/blink/renderer/modules/xr/xr_session_event.h"
#include "third_party/blink/renderer/modules/xr/xr_view.h"
#include "third_party/blink/renderer/modules/xr/xr_webgl_layer.h"
......@@ -444,7 +444,7 @@ void XRSession::OnFrame(
if (!base_layer_)
return;
XRPresentationFrame* presentation_frame = CreatePresentationFrame();
XRFrame* presentation_frame = CreatePresentationFrame();
if (pending_frame_) {
pending_frame_ = false;
......@@ -494,8 +494,8 @@ void XRSession::LogGetPose() const {
}
}
XRPresentationFrame* XRSession::CreatePresentationFrame() {
XRPresentationFrame* presentation_frame = new XRPresentationFrame(this);
XRFrame* XRSession::CreatePresentationFrame() {
XRFrame* presentation_frame = new XRFrame(this);
if (base_pose_matrix_) {
presentation_frame->SetBasePoseMatrix(*base_pose_matrix_);
}
......@@ -687,7 +687,7 @@ void XRSession::UpdateInputSourceState(
XRInputSourceEvent* XRSession::CreateInputSourceEvent(
const AtomicString& type,
XRInputSource* input_source) {
XRPresentationFrame* presentation_frame = CreatePresentationFrame();
XRFrame* presentation_frame = CreatePresentationFrame();
return XRInputSourceEvent::Create(type, presentation_frame, input_source);
}
......
......@@ -137,7 +137,7 @@ class XRSession final : public EventTargetWithInlineData {
private:
class XRSessionResizeObserverDelegate;
XRPresentationFrame* CreatePresentationFrame();
XRFrame* CreatePresentationFrame();
void UpdateCanvasDimensions(Element*);
void UpdateInputSourceState(
......
......@@ -4,7 +4,7 @@
#include "third_party/blink/renderer/modules/xr/xr_view.h"
#include "third_party/blink/renderer/modules/xr/xr_presentation_frame.h"
#include "third_party/blink/renderer/modules/xr/xr_frame.h"
#include "third_party/blink/renderer/modules/xr/xr_session.h"
#include "third_party/blink/renderer/platform/geometry/float_point_3d.h"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment