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

Side by Side Diff: chrome/browser/android/vr_shell/non_presenting_gvr_delegate.h

Issue 2658643003: Refactor GvrDelegate ownership into GvrDelegateProvider and fix more threading violations. (Closed)
Patch Set: Address comments Created 3 years, 10 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
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_ANDROID_VR_SHELL_NON_PRESENTING_GVR_DELEGATE_H_ 5 #ifndef CHROME_BROWSER_ANDROID_VR_SHELL_NON_PRESENTING_GVR_DELEGATE_H_
6 #define CHROME_BROWSER_ANDROID_VR_SHELL_NON_PRESENTING_GVR_DELEGATE_H_ 6 #define CHROME_BROWSER_ANDROID_VR_SHELL_NON_PRESENTING_GVR_DELEGATE_H_
7 7
8 #include <jni.h> 8 #include <jni.h>
9 9
10 #include "base/cancelable_callback.h" 10 #include "base/cancelable_callback.h"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "device/vr/android/gvr/gvr_delegate.h" 12 #include "device/vr/android/gvr/gvr_delegate.h"
13 #include "device/vr/vr_service.mojom.h" 13 #include "device/vr/vr_service.mojom.h"
14 #include "mojo/public/cpp/bindings/binding.h" 14 #include "mojo/public/cpp/bindings/binding.h"
15 #include "third_party/gvr-android-sdk/src/libraries/headers/vr/gvr/capi/include/ gvr_types.h"
15 16
16 namespace vr_shell { 17 namespace vr_shell {
17 18
18 // A non presenting delegate for magic window mode. 19 // A non presenting delegate for magic window mode.
19 class NonPresentingGvrDelegate : public device::GvrDelegate, 20 class NonPresentingGvrDelegate : public device::GvrDelegate,
20 public device::mojom::VRVSyncProvider { 21 public device::mojom::VRVSyncProvider {
21 public: 22 public:
22 explicit NonPresentingGvrDelegate(long context); 23 explicit NonPresentingGvrDelegate(gvr_context* context);
23 24
24 ~NonPresentingGvrDelegate() override; 25 ~NonPresentingGvrDelegate() override;
25 26
26 // GvrDelegate implementation 27 // GvrDelegate implementation
27 void SetWebVRSecureOrigin(bool secure_origin) override {} 28 void SetWebVRSecureOrigin(bool secure_origin) override {}
28 void SubmitWebVRFrame() override {} 29 void SubmitWebVRFrame() override {}
29 void UpdateWebVRTextureBounds(int16_t frame_index, 30 void UpdateWebVRTextureBounds(int16_t frame_index,
30 const gvr::Rectf& left_bounds, 31 const gvr::Rectf& left_bounds,
31 const gvr::Rectf& right_bounds) override {} 32 const gvr::Rectf& right_bounds) override {}
32 void SetWebVRRenderSurfaceSize(int width, int height) override {}
33 gvr::Sizei GetWebVRCompositorSurfaceSize() override;
34 gvr::GvrApi* gvr_api() override;
35 void OnVRVsyncProviderRequest( 33 void OnVRVsyncProviderRequest(
36 device::mojom::VRVSyncProviderRequest request) override; 34 device::mojom::VRVSyncProviderRequest request) override;
37 void UpdateVSyncInterval(long timebase_nanos, 35 void UpdateVSyncInterval(long timebase_nanos,
38 double interval_seconds) override; 36 double interval_seconds) override;
37 bool SupportsPresentation() override;
38 void ResetPose() override;
39 void CreateVRDisplayInfo(
40 const base::Callback<void(device::mojom::VRDisplayInfoPtr)>& callback,
41 uint32_t device_id) override;
39 42
40 void Pause(); 43 void Pause();
41 void Resume(); 44 void Resume();
42 device::mojom::VRVSyncProviderRequest OnSwitchToPresentingDelegate(); 45 device::mojom::VRVSyncProviderRequest OnSwitchToPresentingDelegate();
43 46
44 private: 47 private:
45 void StopVSyncLoop(); 48 void StopVSyncLoop();
46 void StartVSyncLoop(); 49 void StartVSyncLoop();
47 void OnVSync(); 50 void OnVSync();
48 void SendVSync(base::TimeDelta time, const GetVSyncCallback& callback); 51 void SendVSync(base::TimeDelta time, const GetVSyncCallback& callback);
(...skipping 14 matching lines...) Expand all
63 GetVSyncCallback callback_; 66 GetVSyncCallback callback_;
64 mojo::Binding<device::mojom::VRVSyncProvider> binding_; 67 mojo::Binding<device::mojom::VRVSyncProvider> binding_;
65 base::WeakPtrFactory<NonPresentingGvrDelegate> weak_ptr_factory_; 68 base::WeakPtrFactory<NonPresentingGvrDelegate> weak_ptr_factory_;
66 69
67 DISALLOW_COPY_AND_ASSIGN(NonPresentingGvrDelegate); 70 DISALLOW_COPY_AND_ASSIGN(NonPresentingGvrDelegate);
68 }; 71 };
69 72
70 } // namespace vr_shell 73 } // namespace vr_shell
71 74
72 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_NON_PRESENTING_GVR_DELEGATE_H_ 75 #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