Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(229)

Unified Diff: chrome/browser/android/vr_shell/non_presenting_gvr_delegate.cc

Issue 2612333002: Allow VRDisplay to specify which frame the layer bounds should be updated at. (Closed)
Patch Set: Finish implementaion Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698