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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_ANDROID_VR_SHELL_NON_PRESENTING_GVR_DELEGATE_H_
6 #define CHROME_BROWSER_ANDROID_VR_SHELL_NON_PRESENTING_GVR_DELEGATE_H_
7
8 #include <jni.h>
9
10 #include "base/cancelable_callback.h"
11 #include "base/macros.h"
12 #include "device/vr/android/gvr/gvr_delegate.h"
13 #include "device/vr/vr_service.mojom.h"
14 #include "mojo/public/cpp/bindings/binding.h"
15
16 namespace vr_shell {
17
18 // A non presenting delegate for magic window mode.
19 class NonPresentingGvrDelegate : public device::GvrDelegate,
20 public device::mojom::VRVSyncProvider {
21 public:
22 explicit NonPresentingGvrDelegate(long context);
23
24 ~NonPresentingGvrDelegate() override;
25
26 // GvrDelegate implementation
27 void SetWebVRSecureOrigin(bool secure_origin) override {}
28 void SubmitWebVRFrame() override {}
29 void UpdateWebVRTextureBounds(const gvr::Rectf& left_bounds,
30 const gvr::Rectf& right_bounds) override {}
31 void SetWebVRRenderSurfaceSize(int width, int height) override {}
32 gvr::Sizei GetWebVRCompositorSurfaceSize() override;
33 gvr::GvrApi* gvr_api() override;
34 void OnVRVsyncProviderRequest(
35 device::mojom::VRVSyncProviderRequest request) override;
36 void UpdateVSyncInterval(long timebase_nanos,
37 double interval_seconds) override;
38
39 void Pause();
40 void Resume();
41 device::mojom::VRVSyncProviderRequest OnSwitchToPresentingDelegate();
42
43 private:
44 void StopVSyncLoop();
45 void StartVSyncLoop();
46 void OnVSync();
47 device::mojom::VRPosePtr GetPose();
48
49 // VRVSyncProvider
50 void GetVSync(const GetVSyncCallback& callback) override;
51
52 std::unique_ptr<gvr::GvrApi> gvr_api_;
53 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
54 base::CancelableClosure vsync_task_;
55 base::TimeTicks vsync_timebase_;
56 base::TimeDelta vsync_interval_;
57
58 // Whether the vsync loop is paused, but not stopped.
59 bool vsync_paused_ = false;
60 base::TimeDelta pending_time_;
61 bool pending_vsync_ = false;
62 GetVSyncCallback callback_;
63 uint32_t pose_index_ = 1;
64 mojo::Binding<device::mojom::VRVSyncProvider> binding_;
65 base::WeakPtrFactory<NonPresentingGvrDelegate> weak_ptr_factory_;
66
67 DISALLOW_COPY_AND_ASSIGN(NonPresentingGvrDelegate);
68 };
69
70 } // namespace vr_shell
71
72 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_NON_PRESENTING_GVR_DELEGATE_H_
OLDNEW
« 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