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 c28141e3b75d596dc145a40358972e52e14cc75b..c25da54458e04fc8f1922be5bb5c9247182402dd 100644 |
--- a/chrome/browser/android/vr_shell/non_presenting_gvr_delegate.cc |
+++ b/chrome/browser/android/vr_shell/non_presenting_gvr_delegate.cc |
@@ -20,11 +20,7 @@ |
: task_runner_(base::ThreadTaskRunnerHandle::Get()), |
binding_(this), |
weak_ptr_factory_(this) { |
- // Context may be null, see VrShellDelegate#createNonPresentingNativeContext |
- // for possible reasons a context could fail to be created. For example, |
- // the user might uninstall apps or clear data after VR support was detected. |
- if (context) |
- gvr_api_ = gvr::GvrApi::WrapNonOwned(context); |
+ gvr_api_ = gvr::GvrApi::WrapNonOwned(context); |
} |
NonPresentingGvrDelegate::~NonPresentingGvrDelegate() { |
@@ -44,8 +40,7 @@ |
void NonPresentingGvrDelegate::Pause() { |
vsync_task_.Cancel(); |
vsync_paused_ = true; |
- if (gvr_api_) |
- gvr_api_->PauseTracking(); |
+ gvr_api_->PauseTracking(); |
} |
void NonPresentingGvrDelegate::Resume() { |
@@ -65,14 +60,12 @@ |
void NonPresentingGvrDelegate::StopVSyncLoop() { |
vsync_task_.Cancel(); |
- binding_.Close(); |
if (!callback_.is_null()) { |
base::ResetAndReturn(&callback_) |
.Run(nullptr, base::TimeDelta(), -1, |
- device::mojom::VRVSyncProvider::Status::CLOSING); |
+ device::mojom::VRVSyncProvider::Status::RETRY); |
} |
- if (gvr_api_) |
- gvr_api_->PauseTracking(); |
+ gvr_api_->PauseTracking(); |
// If the loop is stopped, it's not considered to be paused. |
vsync_paused_ = false; |
} |
@@ -80,10 +73,8 @@ |
void NonPresentingGvrDelegate::StartVSyncLoop() { |
vsync_task_.Reset( |
base::Bind(&NonPresentingGvrDelegate::OnVSync, base::Unretained(this))); |
- if (gvr_api_) { |
- gvr_api_->RefreshViewerProfile(); |
- gvr_api_->ResumeTracking(); |
- } |
+ gvr_api_->RefreshViewerProfile(); |
+ gvr_api_->ResumeTracking(); |
OnVSync(); |
} |
@@ -145,12 +136,6 @@ |
gvr::ClockTimePoint target_time = gvr::GvrApi::GetTimePointNow(); |
target_time.monotonic_system_time_nanos += kPredictionTimeWithoutVsyncNanos; |
- if (!gvr_api_) { |
- callback.Run(device::mojom::VRPosePtr(nullptr), time, -1, |
- device::mojom::VRVSyncProvider::Status::SUCCESS); |
- return; |
- } |
- |
gvr::Mat4f head_mat = gvr_api_->ApplyNeckModel( |
gvr_api_->GetHeadSpaceFromStartSpaceRotation(target_time), 1.0f); |
callback.Run(VrShell::VRPosePtrFromGvrPose(head_mat), time, -1, |
@@ -171,11 +156,6 @@ |
void NonPresentingGvrDelegate::CreateVRDisplayInfo( |
const base::Callback<void(device::mojom::VRDisplayInfoPtr)>& callback, |
uint32_t device_id) { |
- if (!gvr_api_) { |
- callback.Run(device::mojom::VRDisplayInfoPtr(nullptr)); |
- return; |
- } |
- |
callback.Run(VrShell::CreateVRDisplayInfo( |
gvr_api_.get(), device::kInvalidRenderTargetSize, device_id)); |
} |