| Index: chrome/browser/android/vr_shell/vr_shell_gl.cc
|
| diff --git a/chrome/browser/android/vr_shell/vr_shell_gl.cc b/chrome/browser/android/vr_shell/vr_shell_gl.cc
|
| index 73afb7117c0ac2266959055deaf971b4f109f303..715b354a182d8105ab013bc6650304728212af74 100644
|
| --- a/chrome/browser/android/vr_shell/vr_shell_gl.cc
|
| +++ b/chrome/browser/android/vr_shell/vr_shell_gl.cc
|
| @@ -175,7 +175,13 @@ VrShellGl::VrShellGl(
|
| VrShellGl::~VrShellGl() {
|
| vsync_task_.Cancel();
|
| if (!callback_.is_null()) {
|
| - base::ResetAndReturn(&callback_).Run(nullptr, base::TimeDelta(), -1);
|
| + // When this VSync provider is going away we have to respond to pending
|
| + // callbacks, so instead of providing a VSync, tell the requester to try
|
| + // again. A VSyncProvider is guaranteed to exist, so the request in response
|
| + // to this message will go through some other VSyncProvider.
|
| + base::ResetAndReturn(&callback_)
|
| + .Run(nullptr, base::TimeDelta(), -1,
|
| + device::mojom::VRVSyncProvider::Error::ERROR_TRY_AGAIN);
|
| }
|
| if (binding_.is_bound()) {
|
| main_thread_task_runner_->PostTask(FROM_HERE, base::Bind(
|
| @@ -1091,6 +1097,8 @@ void VrShellGl::OnRequest(device::mojom::VRVSyncProviderRequest request) {
|
| void VrShellGl::GetVSync(const GetVSyncCallback& callback) {
|
| if (!pending_vsync_) {
|
| if (!callback_.is_null()) {
|
| + callback.Run(nullptr, base::TimeDelta(), -1,
|
| + device::mojom::VRVSyncProvider::Error::ERROR_BAD_REQUEST);
|
| mojo::ReportBadMessage("Requested VSync before waiting for response to "
|
| "previous request.");
|
| return;
|
| @@ -1135,7 +1143,8 @@ void VrShellGl::SendVSync(base::TimeDelta time,
|
|
|
| webvr_head_pose_[frame_index % kPoseRingBufferSize] = head_mat;
|
|
|
| - callback.Run(VrShell::VRPosePtrFromGvrPose(head_mat), time, frame_index);
|
| + callback.Run(VrShell::VRPosePtrFromGvrPose(head_mat), time, frame_index,
|
| + device::mojom::VRVSyncProvider::Error::ERROR_NONE);
|
| }
|
|
|
| void VrShellGl::ResetPose() {
|
|
|