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

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: nits 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();
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 return device::kInvalidRenderTargetSize; }
34 gvr::GvrApi* gvr_api() override { return gvr_api_.get(); }
35 void OnVRVsyncProviderRequest(
36 device::mojom::VRVSyncProviderRequest request) override;
37 void UpdateVSyncInterval(long timebase_nanos,
38 double interval_seconds) override;
39
40 void Pause();
41 void Resume();
42 device::mojom::VRVSyncProviderRequest OnSwitchToPresentingDelegate();
43
44 private:
45 void StopVSyncLoop();
46 void StartVSyncLoop();
47 void OnVSync();
48 void GetVSync(const GetVSyncCallback& callback);
49 device::mojom::VRPosePtr GetPose();
50
51 std::unique_ptr<gvr::GvrApi> gvr_api_;
52 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
53 base::CancelableClosure vsync_task_;
54 base::TimeTicks vsync_timebase_;
55 base::TimeDelta vsync_interval_;
56
57 bool paused_ = false;
58 base::TimeDelta pending_time_;
59 bool pending_vsync_ = false;
60 GetVSyncCallback callback_;
61 bool received_frame_ = false;
62 uint32_t pose_index_ = 1;
63 mojo::Binding<device::mojom::VRVSyncProvider> binding_;
64 base::WeakPtrFactory<NonPresentingGvrDelegate> weak_ptr_factory_;
65
66 DISALLOW_COPY_AND_ASSIGN(NonPresentingGvrDelegate);
67 };
68
69 } // namespace vr_shell
70
71 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_NON_PRESENTING_GVR_DELEGATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698