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

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

Issue 2711173002: Prevent browser crash resulting from misbehaving WebVR renderer requesting multiple VSyncs. (Closed)
Patch Set: rebase Created 3 years, 10 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
« no previous file with comments | « chrome/browser/android/vr_shell/non_presenting_gvr_delegate.cc ('k') | device/vr/vr_service.mojom » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 7a3c02c01c19256f8ef0f967680ca0fbe2eb2b5a..b7e699248d55de307307762a6a2856de73e20b19 100644
--- a/chrome/browser/android/vr_shell/vr_shell_gl.cc
+++ b/chrome/browser/android/vr_shell/vr_shell_gl.cc
@@ -176,7 +176,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::Status::RETRY);
}
if (binding_.is_bound()) {
main_thread_task_runner_->PostTask(
@@ -1093,8 +1099,8 @@ void VrShellGl::GetVSync(const GetVSyncCallback& callback) {
if (!pending_vsync_) {
if (!callback_.is_null()) {
mojo::ReportBadMessage(
- "Requested VSync before waiting for response to "
- "previous request.");
+ "Requested VSync before waiting for response to previous request.");
+ binding_.Close();
return;
}
callback_ = callback;
@@ -1137,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::Status::SUCCESS);
}
void VrShellGl::ResetPose() {
« no previous file with comments | « chrome/browser/android/vr_shell/non_presenting_gvr_delegate.cc ('k') | device/vr/vr_service.mojom » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698