Chromium Code Reviews| OLD | NEW |
|---|---|
| 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_VR_SHELL_H_ | 5 #ifndef CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_H_ |
| 6 #define CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_H_ | 6 #define CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_H_ |
| 7 | 7 |
| 8 #include <jni.h> | 8 #include <jni.h> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 66 UiScene* GetScene(); | 66 UiScene* GetScene(); |
| 67 void OnDomContentsLoaded(); | 67 void OnDomContentsLoaded(); |
| 68 void SetUiTextureSize(int width, int height); | 68 void SetUiTextureSize(int width, int height); |
| 69 | 69 |
| 70 // device::GvrDelegate implementation | 70 // device::GvrDelegate implementation |
| 71 void SetWebVRSecureOrigin(bool secure_origin) override; | 71 void SetWebVRSecureOrigin(bool secure_origin) override; |
| 72 void SubmitWebVRFrame() override; | 72 void SubmitWebVRFrame() override; |
| 73 void UpdateWebVRTextureBounds( | 73 void UpdateWebVRTextureBounds( |
| 74 int eye, float left, float top, float width, float height) override; | 74 int eye, float left, float top, float width, float height) override; |
| 75 gvr::GvrApi* gvr_api() override; | 75 gvr::GvrApi* gvr_api() override; |
| 76 void SetGvrPoseForWebVr(gvr::Mat4f pose, uint32_t pose_num) override; | |
|
mthiesse
2016/10/04 21:19:16
This function name feels wrong...
How about SetPo
klausw
2016/10/04 23:56:42
I think it does need "GvrPose" in the name since t
| |
| 76 | 77 |
| 77 void ContentSurfaceChanged( | 78 void ContentSurfaceChanged( |
| 78 JNIEnv* env, | 79 JNIEnv* env, |
| 79 const base::android::JavaParamRef<jobject>& object, | 80 const base::android::JavaParamRef<jobject>& object, |
| 80 jint width, | 81 jint width, |
| 81 jint height, | 82 jint height, |
| 82 const base::android::JavaParamRef<jobject>& surface); | 83 const base::android::JavaParamRef<jobject>& surface); |
| 83 void UiSurfaceChanged( | 84 void UiSurfaceChanged( |
| 84 JNIEnv* env, | 85 JNIEnv* env, |
| 85 const base::android::JavaParamRef<jobject>& object, | 86 const base::android::JavaParamRef<jobject>& object, |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 149 bool controller_active_ = false; | 150 bool controller_active_ = false; |
| 150 | 151 |
| 151 gvr::Vec3f target_point_; | 152 gvr::Vec3f target_point_; |
| 152 const ContentRectangle* target_element_ = nullptr; | 153 const ContentRectangle* target_element_ = nullptr; |
| 153 int ui_tex_width_ = 0; | 154 int ui_tex_width_ = 0; |
| 154 int ui_tex_height_ = 0; | 155 int ui_tex_height_ = 0; |
| 155 | 156 |
| 156 bool webvr_mode_ = false; | 157 bool webvr_mode_ = false; |
| 157 bool webvr_secure_origin_ = false; | 158 bool webvr_secure_origin_ = false; |
| 158 int64_t webvr_warning_end_nanos_ = 0; | 159 int64_t webvr_warning_end_nanos_ = 0; |
| 160 // The pose queue size must be a power of two to avoid glitches when | |
| 161 // the pose counter wraps around. Should be large enough to handle | |
| 162 // the current backlog of poses which is 2-3 frames. | |
| 163 static constexpr int POSE_QUEUE_SIZE = 8; | |
|
dcheng
2016/10/04 23:17:53
Nit: Chromium-style naming for constants is kPoseQ
klausw
2016/10/04 23:56:42
Done, using kPoseRingBufferSize since it's not act
| |
| 164 gvr::Mat4f webvr_head_pose_[POSE_QUEUE_SIZE]; | |
|
mthiesse
2016/10/04 21:19:16
Mild preference for std::array, or std::vector ove
dcheng
2016/10/04 23:17:53
It looks like this isn't explicitly initialized, s
klausw
2016/10/04 23:56:42
Done, using std::vector.
klausw
2016/10/04 23:56:42
Good point, added explicit initialization to ident
| |
| 165 int32_t webvr_newest_pose_num_ = 0; | |
|
mthiesse
2016/10/04 21:19:16
Remove unused variable.
klausw
2016/10/04 23:56:42
Done.
| |
| 159 | 166 |
| 160 base::WeakPtrFactory<VrShell> weak_ptr_factory_; | 167 base::WeakPtrFactory<VrShell> weak_ptr_factory_; |
| 161 | 168 |
| 162 DISALLOW_COPY_AND_ASSIGN(VrShell); | 169 DISALLOW_COPY_AND_ASSIGN(VrShell); |
| 163 }; | 170 }; |
| 164 | 171 |
| 165 bool RegisterVrShell(JNIEnv* env); | 172 bool RegisterVrShell(JNIEnv* env); |
| 166 | 173 |
| 167 } // namespace vr_shell | 174 } // namespace vr_shell |
| 168 | 175 |
| 169 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_H_ | 176 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_H_ |
| OLD | NEW |