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

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

Issue 2536873002: Clean up VR Shell mode transitions (and fix potential webvr startup race). (Closed)
Patch Set: Update javascript Mode enum Created 4 years 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_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 9
10 #include <memory> 10 #include <memory>
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 }; 54 };
55 55
56 class VrMetricsHelper; 56 class VrMetricsHelper;
57 57
58 class VrShell : public device::GvrDelegate, content::WebContentsObserver { 58 class VrShell : public device::GvrDelegate, content::WebContentsObserver {
59 public: 59 public:
60 VrShell(JNIEnv* env, jobject obj, 60 VrShell(JNIEnv* env, jobject obj,
61 content::WebContents* main_contents, 61 content::WebContents* main_contents,
62 ui::WindowAndroid* content_window, 62 ui::WindowAndroid* content_window,
63 content::WebContents* ui_contents, 63 content::WebContents* ui_contents,
64 ui::WindowAndroid* ui_window); 64 ui::WindowAndroid* ui_window,
65 bool for_web_vr);
65 66
66 void UpdateCompositorLayers(JNIEnv* env, 67 void UpdateCompositorLayers(JNIEnv* env,
67 const base::android::JavaParamRef<jobject>& obj); 68 const base::android::JavaParamRef<jobject>& obj);
68 void Destroy(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj); 69 void Destroy(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj);
69 void SetDelegate(JNIEnv* env, 70 void SetDelegate(JNIEnv* env,
70 const base::android::JavaParamRef<jobject>& obj, 71 const base::android::JavaParamRef<jobject>& obj,
71 const base::android::JavaParamRef<jobject>& delegate); 72 const base::android::JavaParamRef<jobject>& delegate);
72 void GvrInit(JNIEnv* env, 73 void GvrInit(JNIEnv* env,
73 const base::android::JavaParamRef<jobject>& obj, 74 const base::android::JavaParamRef<jobject>& obj,
74 jlong native_gvr_api); 75 jlong native_gvr_api);
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 190
190 gvr::Vec3f target_point_; 191 gvr::Vec3f target_point_;
191 const ContentRectangle* target_element_ = nullptr; 192 const ContentRectangle* target_element_ = nullptr;
192 VrInputManager* current_input_target_ = nullptr; 193 VrInputManager* current_input_target_ = nullptr;
193 int ui_tex_width_ = 0; 194 int ui_tex_width_ = 0;
194 int ui_tex_height_ = 0; 195 int ui_tex_height_ = 0;
195 int content_tex_width_ = 0; 196 int content_tex_width_ = 0;
196 int content_tex_height_ = 0; 197 int content_tex_height_ = 0;
197 gvr::Sizei content_tex_pixels_for_webvr_ = {0, 0}; 198 gvr::Sizei content_tex_pixels_for_webvr_ = {0, 0};
198 199
199 bool webvr_mode_ = false;
200
201 // The pose ring buffer size must be a power of two to avoid glitches when 200 // The pose ring buffer size must be a power of two to avoid glitches when
202 // the pose index wraps around. It should be large enough to handle the 201 // the pose index wraps around. It should be large enough to handle the
203 // current backlog of poses which is 2-3 frames. 202 // current backlog of poses which is 2-3 frames.
204 static constexpr int kPoseRingBufferSize = 8; 203 static constexpr int kPoseRingBufferSize = 8;
205 std::vector<gvr::Mat4f> webvr_head_pose_; 204 std::vector<gvr::Mat4f> webvr_head_pose_;
206 jint webvr_texture_id_ = 0; 205 jint webvr_texture_id_ = 0;
207 206
208 std::unique_ptr<VrController> controller_; 207 std::unique_ptr<VrController> controller_;
209 scoped_refptr<VrInputManager> content_input_manager_; 208 scoped_refptr<VrInputManager> content_input_manager_;
210 scoped_refptr<VrInputManager> ui_input_manager_; 209 scoped_refptr<VrInputManager> ui_input_manager_;
211 scoped_refptr<VrMetricsHelper> metrics_helper_; 210 scoped_refptr<VrMetricsHelper> metrics_helper_;
212 211
213 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_; 212 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_;
214 213
215 base::WeakPtrFactory<VrShell> weak_ptr_factory_; 214 base::WeakPtrFactory<VrShell> weak_ptr_factory_;
216 215
217 DISALLOW_COPY_AND_ASSIGN(VrShell); 216 DISALLOW_COPY_AND_ASSIGN(VrShell);
218 }; 217 };
219 218
220 bool RegisterVrShell(JNIEnv* env); 219 bool RegisterVrShell(JNIEnv* env);
221 220
222 } // namespace vr_shell 221 } // namespace vr_shell
223 222
224 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_H_ 223 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698