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

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

Issue 2658643003: Refactor GvrDelegate ownership into GvrDelegateProvider and fix more threading violations. (Closed)
Patch Set: cleanup Created 3 years, 11 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 86942922c54574e22cf950dbc1176e68c3c68086..02d8c439daf0f46f356fd8285537cfd31bd87b97 100644
--- a/chrome/browser/android/vr_shell/non_presenting_gvr_delegate.cc
+++ b/chrome/browser/android/vr_shell/non_presenting_gvr_delegate.cc
@@ -5,6 +5,7 @@
#include "chrome/browser/android/vr_shell/non_presenting_gvr_delegate.h"
#include "chrome/browser/android/vr_shell/vr_shell.h"
+#include "third_party/gvr-android-sdk/src/libraries/headers/vr/gvr/capi/include/gvr.h"
namespace vr_shell {
@@ -12,25 +13,17 @@ namespace {
static constexpr long kPredictionTimeWithoutVsyncNanos = 50000000;
} // namespace
-NonPresentingGvrDelegate::NonPresentingGvrDelegate(long context)
+NonPresentingGvrDelegate::NonPresentingGvrDelegate(gvr_context* context)
: task_runner_(base::ThreadTaskRunnerHandle::Get()),
binding_(this),
weak_ptr_factory_(this) {
- gvr_api_ = gvr::GvrApi::WrapNonOwned(reinterpret_cast<gvr_context*>(context));
+ gvr_api_ = gvr::GvrApi::WrapNonOwned(context);
}
NonPresentingGvrDelegate::~NonPresentingGvrDelegate() {
StopVSyncLoop();
}
-gvr::Sizei NonPresentingGvrDelegate::GetWebVRCompositorSurfaceSize() {
- return device::kInvalidRenderTargetSize;
-}
-
-gvr::GvrApi* NonPresentingGvrDelegate::gvr_api() {
- return gvr_api_.get();
-}
-
void NonPresentingGvrDelegate::OnVRVsyncProviderRequest(
device::mojom::VRVSyncProviderRequest request) {
binding_.Close();
@@ -144,4 +137,22 @@ void NonPresentingGvrDelegate::SendVSync(base::TimeDelta time,
callback.Run(VrShell::VRPosePtrFromGvrPose(head_mat), time, -1);
}
+bool NonPresentingGvrDelegate::SupportsPresentation() {
+ return false;
+}
+
+void NonPresentingGvrDelegate::ResetPose() {
+ // Should never call RecenterTracking when using with Daydream viewers. On
+ // those devices recentering should only be done via the controller.
+ if (gvr_api_ && gvr_api_->GetViewerType() == GVR_VIEWER_TYPE_CARDBOARD)
+ gvr_api_->RecenterTracking();
+}
+
+void NonPresentingGvrDelegate::CreateVRDisplayInfo(
+ const base::Callback<void(device::mojom::VRDisplayInfoPtr)>& callback,
+ uint32_t device_id) {
+ callback.Run(VrShell::CreateVRDisplayInfo(
+ gvr_api_.get(), device::kInvalidRenderTargetSize, device_id));
+}
+
} // namespace vr_shell

Powered by Google App Engine
This is Rietveld 408576698