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

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

Issue 2436863002: Use the HTML UI to render WebVR warnings (Closed)
Patch Set: Make openGL call sequences identical to how they were before. Created 4 years, 1 month 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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 // Called from non-render thread to queue a callback onto the render thread. 107 // Called from non-render thread to queue a callback onto the render thread.
108 // The render thread checks for callbacks and processes them between frames. 108 // The render thread checks for callbacks and processes them between frames.
109 void QueueTask(base::Callback<void()>& callback); 109 void QueueTask(base::Callback<void()>& callback);
110 110
111 // Perform a UI action triggered by the javascript API. 111 // Perform a UI action triggered by the javascript API.
112 void DoUiAction(const UiAction action); 112 void DoUiAction(const UiAction action);
113 113
114 private: 114 private:
115 virtual ~VrShell(); 115 virtual ~VrShell();
116 void LoadUIContent(); 116 void LoadUIContent();
117 bool IsUiTextureReady();
118 // Converts a pixel rectangle to (0..1) float texture coordinates.
119 // Callers need to ensure that the texture width/height is
120 // initialized by checking IsUiTextureReady() first.
121 Rectf MakeUiGlCopyRect(Recti pixel_rect);
122 void DrawVrShell(const gvr::Mat4f& head_pose); 117 void DrawVrShell(const gvr::Mat4f& head_pose);
123 void DrawEye(gvr::Eye eye, 118 void DrawEye(gvr::Eye eye,
124 const gvr::Mat4f& head_pose, 119 const gvr::Mat4f& head_pose,
125 const gvr::BufferViewport& params); 120 const gvr::BufferViewport& params);
126 void DrawUI(const gvr::Mat4f& world_matrix, 121 void DrawUI(const gvr::Mat4f& world_matrix,
127 const gvr::Mat4f& fov_matrix); 122 const gvr::Mat4f& fov_matrix);
128 void DrawCursor(const gvr::Mat4f& render_matrix); 123 void DrawCursor(const gvr::Mat4f& render_matrix);
129 void DrawWebVr(); 124 void DrawWebVr();
130 void DrawWebVrOverlay(int64_t present_time_nanos);
131 void DrawWebVrEye(const gvr::Mat4f& view_matrix,
132 const gvr::BufferViewport& params,
133 int64_t present_time_nanos);
134 125
135 void UpdateController(const gvr::Vec3f& forward_vector); 126 void UpdateController(const gvr::Vec3f& forward_vector);
136 127
137 void HandleQueuedTasks(); 128 void HandleQueuedTasks();
138 129
139 // samplerExternalOES texture data for UI content image. 130 // samplerExternalOES texture data for UI content image.
140 jint ui_texture_id_ = 0; 131 jint ui_texture_id_ = 0;
141 // samplerExternalOES texture data for main content image. 132 // samplerExternalOES texture data for main content image.
142 jint content_texture_id_ = 0; 133 jint content_texture_id_ = 0;
143 134
(...skipping 28 matching lines...) Expand all
172 gvr::Quatf controller_quat_; 163 gvr::Quatf controller_quat_;
173 164
174 gvr::Vec3f target_point_; 165 gvr::Vec3f target_point_;
175 const ContentRectangle* target_element_ = nullptr; 166 const ContentRectangle* target_element_ = nullptr;
176 VrInputManager* current_input_target_ = nullptr; 167 VrInputManager* current_input_target_ = nullptr;
177 int ui_tex_width_ = 0; 168 int ui_tex_width_ = 0;
178 int ui_tex_height_ = 0; 169 int ui_tex_height_ = 0;
179 bool dom_contents_loaded_ = false; 170 bool dom_contents_loaded_ = false;
180 171
181 bool webvr_mode_ = false; 172 bool webvr_mode_ = false;
182 bool webvr_secure_origin_ = false; 173
183 int64_t webvr_warning_end_nanos_ = 0;
184 // The pose ring buffer size must be a power of two to avoid glitches when 174 // The pose ring buffer size must be a power of two to avoid glitches when
185 // the pose index wraps around. It should be large enough to handle the 175 // the pose index wraps around. It should be large enough to handle the
186 // current backlog of poses which is 2-3 frames. 176 // current backlog of poses which is 2-3 frames.
187 static constexpr int kPoseRingBufferSize = 8; 177 static constexpr int kPoseRingBufferSize = 8;
188 std::vector<gvr::Mat4f> webvr_head_pose_; 178 std::vector<gvr::Mat4f> webvr_head_pose_;
189 179
190 std::unique_ptr<VrController> controller_; 180 std::unique_ptr<VrController> controller_;
191 scoped_refptr<VrInputManager> content_input_manager_; 181 scoped_refptr<VrInputManager> content_input_manager_;
192 scoped_refptr<VrInputManager> ui_input_manager_; 182 scoped_refptr<VrInputManager> ui_input_manager_;
193 183
194 base::WeakPtrFactory<VrShell> weak_ptr_factory_; 184 base::WeakPtrFactory<VrShell> weak_ptr_factory_;
195 185
196 DISALLOW_COPY_AND_ASSIGN(VrShell); 186 DISALLOW_COPY_AND_ASSIGN(VrShell);
197 }; 187 };
198 188
199 bool RegisterVrShell(JNIEnv* env); 189 bool RegisterVrShell(JNIEnv* env);
200 190
201 } // namespace vr_shell 191 } // namespace vr_shell
202 192
203 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_H_ 193 #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') | chrome/browser/android/vr_shell/vr_shell.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698