| Index: device/vr/vr_display_impl.cc
|
| diff --git a/device/vr/vr_display_impl.cc b/device/vr/vr_display_impl.cc
|
| index b4025dd80af2b7b757cea111322fed066f377f50..673b5368572267d9f8a25cff2ef280b1df7d4bc9 100644
|
| --- a/device/vr/vr_display_impl.cc
|
| +++ b/device/vr/vr_display_impl.cc
|
| @@ -15,6 +15,7 @@ VRDisplayImpl::VRDisplayImpl(device::VRDevice* device, VRServiceImpl* service)
|
| device_(device),
|
| service_(service),
|
| weak_ptr_factory_(this) {
|
| + VLOG(1) << __FUNCTION__ << ": this=" << (void*)this << " device=" << device << " service=" << service;
|
| mojom::VRDisplayInfoPtr display_info = device->GetVRDevice();
|
| if (service->client()) {
|
| service->client()->OnDisplayConnected(binding_.CreateInterfacePtrAndBind(),
|
| @@ -24,16 +25,17 @@ VRDisplayImpl::VRDisplayImpl(device::VRDevice* device, VRServiceImpl* service)
|
| }
|
|
|
| VRDisplayImpl::~VRDisplayImpl() {
|
| + VLOG(1) << __FUNCTION__ << ": this=" << (void*)this << " destructor";
|
| device_->RemoveDisplay(this);
|
| }
|
|
|
| -void VRDisplayImpl::GetPose(const GetPoseCallback& callback) {
|
| +void VRDisplayImpl::GetPose(mojom::VRPoseClientPtr pose_client) {
|
| if (!device_->IsAccessAllowed(this)) {
|
| - callback.Run(nullptr);
|
| + pose_client->OnPoseReceived(nullptr);
|
| return;
|
| }
|
|
|
| - callback.Run(device_->GetPose());
|
| + pose_client->OnPoseReceived(device_->GetPose());
|
| }
|
|
|
| void VRDisplayImpl::ResetPose() {
|
| @@ -70,17 +72,30 @@ void VRDisplayImpl::ExitPresent() {
|
| device_->ExitPresent();
|
| }
|
|
|
| -void VRDisplayImpl::SubmitFrame(mojom::VRPosePtr pose) {
|
| - if (!device_->CheckPresentingDisplay(this))
|
| +void VRDisplayImpl::SubmitFrame(int32_t surface_handle,
|
| + mojom::VRPosePtr pose,
|
| + const SubmitFrameCallback& callback) {
|
| + if (!device_->CheckPresentingDisplay(this)) {
|
| + VLOG(1) << ": no presenting service, running callback";
|
| + callback.Run(0, pose ? pose->poseIndex : 0, -1.0);
|
| return;
|
| - device_->SubmitFrame(std::move(pose));
|
| + }
|
| + device_->SubmitFrame(surface_handle, std::move(pose), std::move(callback));
|
| }
|
|
|
| void VRDisplayImpl::UpdateLayerBounds(mojom::VRLayerBoundsPtr left_bounds,
|
| mojom::VRLayerBoundsPtr right_bounds) {
|
| - if (!device_->IsAccessAllowed(this))
|
| + if (!device_->CheckPresentingDisplay(this))
|
| return;
|
|
|
| device_->UpdateLayerBounds(std::move(left_bounds), std::move(right_bounds));
|
| }
|
| +
|
| +void VRDisplayImpl::GetSurfaceHandle(int32_t width, int32_t height,
|
| + const GetSurfaceHandleCallback& callback) {
|
| + if (!device_->CheckPresentingDisplay(this))
|
| + return;
|
| +
|
| + device_->GetSurfaceHandle(width, height, callback);
|
| +}
|
| }
|
|
|