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 9a3dd570bc4e6ea2eb74f82c67d127d30e489ed8..37919e80d511309169f6109508ced5f3fa5309f3 100644 |
--- a/chrome/browser/android/vr_shell/vr_shell_delegate.cc |
+++ b/chrome/browser/android/vr_shell/vr_shell_delegate.cc |
@@ -3,6 +3,7 @@ |
// found in the LICENSE file. |
#include "chrome/browser/android/vr_shell/vr_shell_delegate.h" |
+#include "device/vr/android/gvr/gvr_delegate.h" |
#include "base/android/jni_android.h" |
#include "chrome/browser/android/vr_shell/vr_shell.h" |
@@ -18,22 +19,24 @@ namespace vr_shell { |
class GvrNonPresentingDelegate : public device::GvrDelegate { |
public: |
explicit GvrNonPresentingDelegate(jlong context) { |
+ VLOG(1) << __FUNCTION__ << ": Instantiate gvr_api for non-presenting delegate"; |
gvr_api_ = |
gvr::GvrApi::WrapNonOwned(reinterpret_cast<gvr_context*>(context)); |
} |
- virtual ~GvrNonPresentingDelegate() = default; |
+ virtual ~GvrNonPresentingDelegate() { |
+ VLOG(1) << __FUNCTION__ << ": Destructor for non-presenting delegate and its gvr_api)"; |
+ }; |
// GvrDelegate implementation |
void SetWebVRSecureOrigin(bool secure_origin) override {} |
- void SubmitWebVRFrame() override {} |
- void UpdateWebVRTextureBounds(const gvr::Rectf& left_bounds, |
+ void SubmitWebVRFrame(int32_t surface_handle, device::mojom::VRPosePtr pose) override {} |
+ void UpdateWebVRTextureBounds(uint32_t for_pose_index, |
+ const gvr::Rectf& left_bounds, |
const gvr::Rectf& right_bounds) override {} |
- void SetGvrPoseForWebVr(const gvr::Mat4f& pose, |
- uint32_t pose_index) override {} |
- void SetWebVRRenderSurfaceSize(int width, int height) override {} |
- gvr::Sizei GetWebVRCompositorSurfaceSize() override { |
- return device::kInvalidRenderTargetSize; } |
+ void SetWebVRGvrPose(const gvr::Mat4f& pose, |
+ uint32_t pose_index, int64_t pose_time_nanos) override {} |
+ void GetWebVRSurfaceHandle(int width, int height, const device::mojom::VRDisplay::GetSurfaceHandleCallback& callback) override { callback.Run(0); } |
gvr::GvrApi* gvr_api() override { return gvr_api_.get(); } |
private: |
std::unique_ptr<gvr::GvrApi> gvr_api_; |
@@ -81,6 +84,7 @@ void VrShellDelegate::SetPresentResult(JNIEnv* env, jobject obj, |
} |
void VrShellDelegate::DisplayActivate(JNIEnv* env, jobject obj) { |
+ VLOG(1) << __FUNCTION__ << ": device_provider_=" << device_provider_; |
if (device_provider_) { |
device_provider_->OnDisplayActivate(); |
} |
@@ -125,6 +129,7 @@ void VrShellDelegate::ForceExitVr() { |
device::GvrDelegate* VrShellDelegate::GetNonPresentingDelegate() { |
if (!non_presenting_delegate_) { |
JNIEnv* env = AttachCurrentThread(); |
+ VLOG(1) << __FUNCTION__; |
jlong context = Java_VrShellDelegate_createNonPresentingNativeContext( |
env, j_vr_shell_delegate_.obj()); |
if (!context) |
@@ -137,6 +142,7 @@ device::GvrDelegate* VrShellDelegate::GetNonPresentingDelegate() { |
void VrShellDelegate::DestroyNonPresentingDelegate() { |
if (non_presenting_delegate_) { |
+ VLOG(1) << __FUNCTION__; |
non_presenting_delegate_.reset(nullptr); |
JNIEnv* env = AttachCurrentThread(); |
Java_VrShellDelegate_shutdownNonPresentingNativeContext( |
@@ -146,6 +152,7 @@ void VrShellDelegate::DestroyNonPresentingDelegate() { |
void VrShellDelegate::SetListeningForActivate(bool listening) { |
JNIEnv* env = AttachCurrentThread(); |
+ VLOG(1) << __FUNCTION__; |
Java_VrShellDelegate_setListeningForWebVrActivate( |
env, j_vr_shell_delegate_.obj(), listening); |
} |