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

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

Issue 2541023003: WebVR: Add sanity checks for decoded pose index values (Closed)
Patch Set: Work around bogus initialization warning 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
« no previous file with comments | « no previous file | chrome/browser/android/vr_shell/vr_shell.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 ~VrShell() override; 126 ~VrShell() override;
127 void LoadUIContent(); 127 void LoadUIContent();
128 void DrawVrShell(const gvr::Mat4f& head_pose, gvr::Frame &frame); 128 void DrawVrShell(const gvr::Mat4f& head_pose, gvr::Frame &frame);
129 void DrawUiView(const gvr::Mat4f* head_pose, 129 void DrawUiView(const gvr::Mat4f* head_pose,
130 const std::vector<const ContentRectangle*>& elements, 130 const std::vector<const ContentRectangle*>& elements,
131 const gvr::Sizei& render_size, int viewport_offset); 131 const gvr::Sizei& render_size, int viewport_offset);
132 void DrawElements(const gvr::Mat4f& render_matrix, 132 void DrawElements(const gvr::Mat4f& render_matrix,
133 const std::vector<const ContentRectangle*>& elements); 133 const std::vector<const ContentRectangle*>& elements);
134 void DrawCursor(const gvr::Mat4f& render_matrix); 134 void DrawCursor(const gvr::Mat4f& render_matrix);
135 void DrawWebVr(); 135 void DrawWebVr();
136 bool WebVrPoseByteIsValid(int pose_index_byte);
136 137
137 void UpdateController(const gvr::Vec3f& forward_vector); 138 void UpdateController(const gvr::Vec3f& forward_vector);
138 void SendEventsToTarget(VrInputManager* input_target, 139 void SendEventsToTarget(VrInputManager* input_target,
139 int pixel_x, 140 int pixel_x,
140 int pixel_y); 141 int pixel_y);
141 142
142 void HandleQueuedTasks(); 143 void HandleQueuedTasks();
143 144
144 // content::WebContentsObserver implementation. 145 // content::WebContentsObserver implementation.
145 void RenderViewHostChanged(content::RenderViewHost* old_host, 146 void RenderViewHostChanged(content::RenderViewHost* old_host,
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 int content_tex_height_ = 0; 199 int content_tex_height_ = 0;
199 gvr::Sizei content_tex_pixels_for_webvr_ = {0, 0}; 200 gvr::Sizei content_tex_pixels_for_webvr_ = {0, 0};
200 201
201 bool webvr_mode_ = false; 202 bool webvr_mode_ = false;
202 203
203 // The pose ring buffer size must be a power of two to avoid glitches when 204 // The pose ring buffer size must be a power of two to avoid glitches when
204 // the pose index wraps around. It should be large enough to handle the 205 // the pose index wraps around. It should be large enough to handle the
205 // current backlog of poses which is 2-3 frames. 206 // current backlog of poses which is 2-3 frames.
206 static constexpr int kPoseRingBufferSize = 8; 207 static constexpr int kPoseRingBufferSize = 8;
207 std::vector<gvr::Mat4f> webvr_head_pose_; 208 std::vector<gvr::Mat4f> webvr_head_pose_;
209 std::vector<bool> webvr_head_pose_valid_;
208 jint webvr_texture_id_ = 0; 210 jint webvr_texture_id_ = 0;
209 211
210 std::unique_ptr<VrController> controller_; 212 std::unique_ptr<VrController> controller_;
211 scoped_refptr<VrInputManager> content_input_manager_; 213 scoped_refptr<VrInputManager> content_input_manager_;
212 scoped_refptr<VrInputManager> ui_input_manager_; 214 scoped_refptr<VrInputManager> ui_input_manager_;
213 scoped_refptr<VrMetricsHelper> metrics_helper_; 215 scoped_refptr<VrMetricsHelper> metrics_helper_;
214 216
215 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_; 217 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_;
216 218
217 base::WeakPtrFactory<VrShell> weak_ptr_factory_; 219 base::WeakPtrFactory<VrShell> weak_ptr_factory_;
218 220
219 DISALLOW_COPY_AND_ASSIGN(VrShell); 221 DISALLOW_COPY_AND_ASSIGN(VrShell);
220 }; 222 };
221 223
222 bool RegisterVrShell(JNIEnv* env); 224 bool RegisterVrShell(JNIEnv* env);
223 225
224 } // namespace vr_shell 226 } // namespace vr_shell
225 227
226 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_H_ 228 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/android/vr_shell/vr_shell.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698