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

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

Issue 2624633002: Remove Sync GetPose VRService call, implement VRVSyncProvider (Closed)
Patch Set: oops 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.h
diff --git a/chrome/browser/android/vr_shell/non_presenting_gvr_delegate.h b/chrome/browser/android/vr_shell/non_presenting_gvr_delegate.h
new file mode 100644
index 0000000000000000000000000000000000000000..7e40607e50965db5308c180b6b5908d3ee4835ad
--- /dev/null
+++ b/chrome/browser/android/vr_shell/non_presenting_gvr_delegate.h
@@ -0,0 +1,72 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_ANDROID_VR_SHELL_NON_PRESENTING_GVR_DELEGATE_H_
+#define CHROME_BROWSER_ANDROID_VR_SHELL_NON_PRESENTING_GVR_DELEGATE_H_
+
+#include <jni.h>
+
+#include "base/cancelable_callback.h"
+#include "base/macros.h"
+#include "device/vr/android/gvr/gvr_delegate.h"
+#include "device/vr/vr_service.mojom.h"
+#include "mojo/public/cpp/bindings/binding.h"
+
+namespace vr_shell {
+
+// A non presenting delegate for magic window mode.
+class NonPresentingGvrDelegate : public device::GvrDelegate,
+ public device::mojom::VRVSyncProvider {
+ public:
+ explicit NonPresentingGvrDelegate(long context);
+
+ ~NonPresentingGvrDelegate() override;
+
+ // GvrDelegate implementation
+ void SetWebVRSecureOrigin(bool secure_origin) override {}
+ void SubmitWebVRFrame() override {}
+ void UpdateWebVRTextureBounds(const gvr::Rectf& left_bounds,
+ const gvr::Rectf& right_bounds) override {}
+ void SetWebVRRenderSurfaceSize(int width, int height) override {}
+ gvr::Sizei GetWebVRCompositorSurfaceSize() override;
+ gvr::GvrApi* gvr_api() override;
+ void OnVRVsyncProviderRequest(
+ device::mojom::VRVSyncProviderRequest request) override;
+ void UpdateVSyncInterval(long timebase_nanos,
+ double interval_seconds) override;
+
+ void Pause();
+ void Resume();
+ device::mojom::VRVSyncProviderRequest OnSwitchToPresentingDelegate();
+
+ private:
+ void StopVSyncLoop();
+ void StartVSyncLoop();
+ void OnVSync();
+ device::mojom::VRPosePtr GetPose();
+
+ // VRVSyncProvider
+ void GetVSync(const GetVSyncCallback& callback) override;
+
+ std::unique_ptr<gvr::GvrApi> gvr_api_;
+ scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
+ base::CancelableClosure vsync_task_;
+ base::TimeTicks vsync_timebase_;
+ base::TimeDelta vsync_interval_;
+
+ // Whether the vsync loop is paused, but not stopped.
+ bool vsync_paused_ = false;
+ base::TimeDelta pending_time_;
+ bool pending_vsync_ = false;
+ GetVSyncCallback callback_;
+ uint32_t pose_index_ = 1;
+ mojo::Binding<device::mojom::VRVSyncProvider> binding_;
+ base::WeakPtrFactory<NonPresentingGvrDelegate> weak_ptr_factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(NonPresentingGvrDelegate);
+};
+
+} // namespace vr_shell
+
+#endif // CHROME_BROWSER_ANDROID_VR_SHELL_NON_PRESENTING_GVR_DELEGATE_H_
« no previous file with comments | « chrome/browser/android/vr_shell/BUILD.gn ('k') | chrome/browser/android/vr_shell/non_presenting_gvr_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698