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

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

Issue 2893623002: VR: Make sure GL thread is started before binding callbacks to it. (Closed)
Patch Set: Add comment Created 3 years, 7 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
« 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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 159
160 void ProcessContentGesture(std::unique_ptr<blink::WebInputEvent> event); 160 void ProcessContentGesture(std::unique_ptr<blink::WebInputEvent> event);
161 void SubmitControllerModel(std::unique_ptr<VrControllerModel> model); 161 void SubmitControllerModel(std::unique_ptr<VrControllerModel> model);
162 162
163 // device::GvrGamepadDataProvider implementation. 163 // device::GvrGamepadDataProvider implementation.
164 void UpdateGamepadData(device::GvrGamepadData) override; 164 void UpdateGamepadData(device::GvrGamepadData) override;
165 void RegisterGamepadDataFetcher(device::GvrGamepadDataFetcher*) override; 165 void RegisterGamepadDataFetcher(device::GvrGamepadDataFetcher*) override;
166 166
167 private: 167 private:
168 ~VrShell() override; 168 ~VrShell() override;
169 void PostToGlThreadWhenReady(const base::Closure& task); 169 void WaitForGlThread();
170 void PostToGlThread(const tracked_objects::Location& from_here,
171 const base::Closure& task);
170 void SetUiState(); 172 void SetUiState();
171 173
172 // device::GvrDelegate implementation. 174 // device::GvrDelegate implementation.
173 void SetWebVRSecureOrigin(bool secure_origin) override; 175 void SetWebVRSecureOrigin(bool secure_origin) override;
174 void SubmitWebVRFrame(int16_t frame_index, 176 void SubmitWebVRFrame(int16_t frame_index,
175 const gpu::MailboxHolder& mailbox) override; 177 const gpu::MailboxHolder& mailbox) override;
176 void UpdateWebVRTextureBounds(int16_t frame_index, 178 void UpdateWebVRTextureBounds(int16_t frame_index,
177 const gfx::RectF& left_bounds, 179 const gfx::RectF& left_bounds,
178 const gfx::RectF& right_bounds, 180 const gfx::RectF& right_bounds,
179 const gfx::Size& source_size) override; 181 const gfx::Size& source_size) override;
(...skipping 27 matching lines...) Expand all
207 209
208 VrShellDelegate* delegate_provider_ = nullptr; 210 VrShellDelegate* delegate_provider_ = nullptr;
209 base::android::ScopedJavaGlobalRef<jobject> j_vr_shell_; 211 base::android::ScopedJavaGlobalRef<jobject> j_vr_shell_;
210 212
211 std::unique_ptr<VrInputManager> input_manager_; 213 std::unique_ptr<VrInputManager> input_manager_;
212 std::unique_ptr<AndroidUiGestureTarget> android_ui_gesture_target_; 214 std::unique_ptr<AndroidUiGestureTarget> android_ui_gesture_target_;
213 std::unique_ptr<VrMetricsHelper> metrics_helper_; 215 std::unique_ptr<VrMetricsHelper> metrics_helper_;
214 216
215 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_; 217 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_;
216 std::unique_ptr<VrGLThread> gl_thread_; 218 std::unique_ptr<VrGLThread> gl_thread_;
219 bool thread_started_ = false;
217 UiInterface* ui_; 220 UiInterface* ui_;
218 bool reprojected_rendering_; 221 bool reprojected_rendering_;
219 222
220 jobject content_surface_ = nullptr; 223 jobject content_surface_ = nullptr;
221 base::CancelableClosure poll_capturing_media_task_; 224 base::CancelableClosure poll_capturing_media_task_;
222 bool is_capturing_audio_ = false; 225 bool is_capturing_audio_ = false;
223 bool is_capturing_video_ = false; 226 bool is_capturing_video_ = false;
224 bool is_capturing_screen_ = false; 227 bool is_capturing_screen_ = false;
225 228
226 // TODO(mthiesse): Remove the need for this to be stored here. 229 // TODO(mthiesse): Remove the need for this to be stored here.
227 // crbug.com/674594 230 // crbug.com/674594
228 gvr_context* gvr_api_; 231 gvr_context* gvr_api_;
229 232
230 // Are we currently providing a gamepad factory to the gamepad manager? 233 // Are we currently providing a gamepad factory to the gamepad manager?
231 bool gamepad_source_active_ = false; 234 bool gamepad_source_active_ = false;
232 // Registered fetcher, must remain alive for UpdateGamepadData calls. 235 // Registered fetcher, must remain alive for UpdateGamepadData calls.
233 // That's ok since the fetcher is only destroyed from VrShell's destructor. 236 // That's ok since the fetcher is only destroyed from VrShell's destructor.
234 device::GvrGamepadDataFetcher* gamepad_data_fetcher_ = nullptr; 237 device::GvrGamepadDataFetcher* gamepad_data_fetcher_ = nullptr;
235 238
236 base::WeakPtrFactory<VrShell> weak_ptr_factory_; 239 base::WeakPtrFactory<VrShell> weak_ptr_factory_;
237 240
238 DISALLOW_COPY_AND_ASSIGN(VrShell); 241 DISALLOW_COPY_AND_ASSIGN(VrShell);
239 }; 242 };
240 243
241 bool RegisterVrShell(JNIEnv* env); 244 bool RegisterVrShell(JNIEnv* env);
242 245
243 } // namespace vr_shell 246 } // namespace vr_shell
244 247
245 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_H_ 248 #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