Chromium Code Reviews| Index: chrome/browser/android/vr_shell/vr_shell_delegate.cc |
| diff --git a/chrome/browser/android/vr_shell/vr_shell_delegate.cc b/chrome/browser/android/vr_shell/vr_shell_delegate.cc |
| index 81dcd4f2e4cafdc1d65f9ae988eafa4372dc1ec9..57872f7155514e23972b78f3be1e56402880acd0 100644 |
| --- a/chrome/browser/android/vr_shell/vr_shell_delegate.cc |
| +++ b/chrome/browser/android/vr_shell/vr_shell_delegate.cc |
| @@ -62,6 +62,13 @@ void VrShellDelegate::SetPresentingDelegate( |
| } |
| presenting_delegate_->UpdateVSyncInterval(timebase_nanos_, interval_seconds_); |
| + |
| + if (pending_successful_present_request_) { |
| + presenting_delegate_->SetSubmitClient(std::move(submit_client_)); |
| + present_callback_.Run(true); |
|
mthiesse
2017/03/30 15:29:46
nit: base::ResetAndReturn(presenting_delegate_).Ru
tiborg
2017/03/30 22:19:57
Done.
|
| + present_callback_.Reset(); |
| + pending_successful_present_request_ = false; |
| + } |
| } |
| void VrShellDelegate::RemoveDelegate() { |
| @@ -75,10 +82,22 @@ void VrShellDelegate::RemoveDelegate() { |
| void VrShellDelegate::SetPresentResult(JNIEnv* env, |
| const JavaParamRef<jobject>& obj, |
| - jboolean result) { |
| + jboolean success) { |
| CHECK(!present_callback_.is_null()); |
| - present_callback_.Run(result); |
| + if (success && !presenting_delegate_) { |
| + // We have to wait until the GL thread is ready since we have to pass it |
| + // the VRSubmitFrameClient. |
| + pending_successful_present_request_ = true; |
| + return; |
| + } |
| + |
| + if (success) { |
| + presenting_delegate_->SetSubmitClient(std::move(submit_client_)); |
| + } |
| + |
| + present_callback_.Run(success); |
| present_callback_.Reset(); |
| + pending_successful_present_request_ = false; |
| } |
| void VrShellDelegate::DisplayActivate(JNIEnv* env, |
| @@ -121,10 +140,6 @@ void VrShellDelegate::Destroy(JNIEnv* env, const JavaParamRef<jobject>& obj) { |
| delete this; |
| } |
| -device::mojom::VRSubmitFrameClientPtr VrShellDelegate::TakeSubmitFrameClient() { |
| - return std::move(submit_client_); |
| -} |
| - |
| void VrShellDelegate::SetDeviceProvider( |
| device::GvrDeviceProvider* device_provider) { |
| if (device_provider_ == device_provider) |