| Index: chrome/browser/android/vr_shell/non_presenting_gvr_delegate.cc
|
| diff --git a/chrome/browser/android/vr_shell/non_presenting_gvr_delegate.cc b/chrome/browser/android/vr_shell/non_presenting_gvr_delegate.cc
|
| index 4e89373e880abb856b4d4294b12cc7e518445574..5c8406909fe401e4b4bb3bc7574d9a3d49abea06 100644
|
| --- a/chrome/browser/android/vr_shell/non_presenting_gvr_delegate.cc
|
| +++ b/chrome/browser/android/vr_shell/non_presenting_gvr_delegate.cc
|
| @@ -53,7 +53,7 @@ void NonPresentingGvrDelegate::OnSwitchToPresentingDelegate() {
|
| void NonPresentingGvrDelegate::StopVSyncLoop() {
|
| vsync_task_.Cancel();
|
| if (!callback_.is_null())
|
| - callback_.Run(nullptr, 0);
|
| + callback_.Run(nullptr, 0, -1);
|
| callback_.Reset();
|
| if (binding_.is_bound())
|
| binding_.Close();
|
| @@ -90,8 +90,7 @@ void NonPresentingGvrDelegate::OnVSync() {
|
|
|
| double time = (intervals * vsync_interval_).InSecondsF();
|
| if (!callback_.is_null()) {
|
| - callback_.Run(GetPose(), time);
|
| - callback_.Reset();
|
| + SendVSync(time, std::move(callback_));
|
| } else {
|
| pending_vsync_ = true;
|
| pending_time_ = time;
|
| @@ -104,7 +103,7 @@ void NonPresentingGvrDelegate::GetVSync(const GetVSyncCallback& callback) {
|
| return;
|
| }
|
| pending_vsync_ = false;
|
| - callback.Run(GetPose(), pending_time_);
|
| + SendVSync(pending_time_, std::move(callback));
|
| }
|
|
|
| void NonPresentingGvrDelegate::UpdateVSyncInterval(long timebase_nanos,
|
| @@ -115,17 +114,14 @@ void NonPresentingGvrDelegate::UpdateVSyncInterval(long timebase_nanos,
|
| StartVSyncLoop();
|
| }
|
|
|
| -device::mojom::VRPosePtr NonPresentingGvrDelegate::GetPose() {
|
| +void NonPresentingGvrDelegate::SendVSync(double time,
|
| + GetVSyncCallback callback) {
|
| gvr::ClockTimePoint target_time = gvr::GvrApi::GetTimePointNow();
|
| target_time.monotonic_system_time_nanos += kPredictionTimeWithoutVsyncNanos;
|
|
|
| - gvr::Mat4f head_mat =
|
| - gvr_api_->GetHeadSpaceFromStartSpaceRotation(target_time);
|
| - head_mat = gvr_api_->ApplyNeckModel(head_mat, 1.0f);
|
| -
|
| - uint32_t pose_index = pose_index_++;
|
| -
|
| - return VrShell::VRPosePtrFromGvrPose(head_mat, pose_index);
|
| + gvr::Mat4f head_mat = gvr_api_->ApplyNeckModel(
|
| + gvr_api_->GetHeadSpaceFromStartSpaceRotation(target_time), 1.0f);
|
| + callback.Run(VrShell::VRPosePtrFromGvrPose(head_mat), time, -1);
|
| }
|
|
|
| } // namespace vr_shell
|
|
|