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 be28d03854226db5fecad1c2cb428cdd3ef5fd1b..57bbf69b7a4c1d518a6a37c5afe9f761ffa27f36 100644 |
--- a/chrome/browser/android/vr_shell/non_presenting_gvr_delegate.cc |
+++ b/chrome/browser/android/vr_shell/non_presenting_gvr_delegate.cc |
@@ -60,7 +60,7 @@ NonPresentingGvrDelegate::OnSwitchToPresentingDelegate() { |
void NonPresentingGvrDelegate::StopVSyncLoop() { |
vsync_task_.Cancel(); |
if (!callback_.is_null()) |
- callback_.Run(nullptr, base::TimeDelta()); |
+ callback_.Run(nullptr, base::TimeDelta(), -1); |
callback_.Reset(); |
gvr_api_->PauseTracking(); |
paused_ = false; |
@@ -96,8 +96,7 @@ void NonPresentingGvrDelegate::OnVSync() { |
base::TimeDelta time = intervals * vsync_interval_; |
if (!callback_.is_null()) { |
- callback_.Run(GetPose(), time); |
- callback_.Reset(); |
+ SendVSync(time, std::move(callback_)); |
} else { |
pending_vsync_ = true; |
pending_time_ = time; |
@@ -115,7 +114,7 @@ void NonPresentingGvrDelegate::GetVSync(const GetVSyncCallback& callback) { |
return; |
} |
pending_vsync_ = false; |
- callback.Run(GetPose(), pending_time_); |
+ SendVSync(pending_time_, std::move(callback)); |
dcheng
2017/01/18 23:58:07
Nit: std::move() here is a no-op
mthiesse
2017/01/19 01:19:08
Done.
|
} |
void NonPresentingGvrDelegate::UpdateVSyncInterval(long timebase_nanos, |
@@ -126,17 +125,14 @@ void NonPresentingGvrDelegate::UpdateVSyncInterval(long timebase_nanos, |
StartVSyncLoop(); |
} |
-device::mojom::VRPosePtr NonPresentingGvrDelegate::GetPose() { |
+void NonPresentingGvrDelegate::SendVSync(const base::TimeDelta& 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 |