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

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: Address comments 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 8a095d2d74a4bf0e24f6d4b07d5977a7f08c4110..7f3a2a2df1e97cea9818c40b6ea4cb6fd6476ea1 100644
--- a/chrome/browser/android/vr_shell/non_presenting_gvr_delegate.cc
+++ b/chrome/browser/android/vr_shell/non_presenting_gvr_delegate.cc
@@ -6,6 +6,7 @@
#include "base/callback_helpers.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 {
@@ -13,25 +14,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();
@@ -142,4 +135,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
« no previous file with comments | « chrome/browser/android/vr_shell/non_presenting_gvr_delegate.h ('k') | chrome/browser/android/vr_shell/vr_compositor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698