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

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

Issue 2711173002: Prevent browser crash resulting from misbehaving WebVR renderer requesting multiple VSyncs. (Closed)
Patch Set: 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
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 2e69283b77756ce329c1810f4350599111a2e4c3..736e187307295eacc9e6b4e85aa3a5bd34dc88dc 100644
--- a/chrome/browser/android/vr_shell/non_presenting_gvr_delegate.cc
+++ b/chrome/browser/android/vr_shell/non_presenting_gvr_delegate.cc
@@ -61,7 +61,9 @@ NonPresentingGvrDelegate::OnSwitchToPresentingDelegate() {
void NonPresentingGvrDelegate::StopVSyncLoop() {
vsync_task_.Cancel();
if (!callback_.is_null()) {
- base::ResetAndReturn(&callback_).Run(nullptr, base::TimeDelta(), -1);
+ base::ResetAndReturn(&callback_)
+ .Run(nullptr, base::TimeDelta(), -1,
+ device::mojom::VRVSyncProvider::Error::ERROR_TRY_AGAIN);
}
gvr_api_->PauseTracking();
// If the loop is stopped, it's not considered to be paused.
@@ -110,6 +112,8 @@ void NonPresentingGvrDelegate::GetVSync(const GetVSyncCallback& callback) {
if (!callback_.is_null()) {
mojo::ReportBadMessage("Requested VSync before waiting for response to "
"previous request.");
+ callback.Run(nullptr, base::TimeDelta(), -1,
+ device::mojom::VRVSyncProvider::Error::ERROR_BAD_REQUEST);
return;
}
callback_ = callback;
@@ -134,7 +138,8 @@ void NonPresentingGvrDelegate::SendVSync(base::TimeDelta time,
gvr::Mat4f head_mat = gvr_api_->ApplyNeckModel(
gvr_api_->GetHeadSpaceFromStartSpaceRotation(target_time), 1.0f);
- callback.Run(VrShell::VRPosePtrFromGvrPose(head_mat), time, -1);
+ callback.Run(VrShell::VRPosePtrFromGvrPose(head_mat), time, -1,
+ device::mojom::VRVSyncProvider::Error::ERROR_NONE);
}
bool NonPresentingGvrDelegate::SupportsPresentation() {
« no previous file with comments | « no previous file | chrome/browser/android/vr_shell/vr_shell_gl.cc » ('j') | chrome/browser/android/vr_shell/vr_shell_gl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698