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

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: 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
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 base::Closure& task);
170 void SetUiState(); 171 void SetUiState();
171 172
172 // device::GvrDelegate implementation. 173 // device::GvrDelegate implementation.
173 void SetWebVRSecureOrigin(bool secure_origin) override; 174 void SetWebVRSecureOrigin(bool secure_origin) override;
174 void SubmitWebVRFrame(int16_t frame_index, 175 void SubmitWebVRFrame(int16_t frame_index,
175 const gpu::MailboxHolder& mailbox) override; 176 const gpu::MailboxHolder& mailbox) override;
176 void UpdateWebVRTextureBounds(int16_t frame_index, 177 void UpdateWebVRTextureBounds(int16_t frame_index,
177 const gfx::RectF& left_bounds, 178 const gfx::RectF& left_bounds,
178 const gfx::RectF& right_bounds, 179 const gfx::RectF& right_bounds,
179 const gfx::Size& source_size) override; 180 const gfx::Size& source_size) override;
(...skipping 27 matching lines...) Expand all
207 208
208 VrShellDelegate* delegate_provider_ = nullptr; 209 VrShellDelegate* delegate_provider_ = nullptr;
209 base::android::ScopedJavaGlobalRef<jobject> j_vr_shell_; 210 base::android::ScopedJavaGlobalRef<jobject> j_vr_shell_;
210 211
211 std::unique_ptr<VrInputManager> input_manager_; 212 std::unique_ptr<VrInputManager> input_manager_;
212 std::unique_ptr<AndroidUiGestureTarget> android_ui_gesture_target_; 213 std::unique_ptr<AndroidUiGestureTarget> android_ui_gesture_target_;
213 std::unique_ptr<VrMetricsHelper> metrics_helper_; 214 std::unique_ptr<VrMetricsHelper> metrics_helper_;
214 215
215 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_; 216 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_;
216 std::unique_ptr<VrGLThread> gl_thread_; 217 std::unique_ptr<VrGLThread> gl_thread_;
218 bool thread_started_ = false;
217 UiInterface* ui_; 219 UiInterface* ui_;
218 bool reprojected_rendering_; 220 bool reprojected_rendering_;
219 221
220 jobject content_surface_ = nullptr; 222 jobject content_surface_ = nullptr;
221 base::CancelableClosure poll_capturing_media_task_; 223 base::CancelableClosure poll_capturing_media_task_;
222 bool is_capturing_audio_ = false; 224 bool is_capturing_audio_ = false;
223 bool is_capturing_video_ = false; 225 bool is_capturing_video_ = false;
224 bool is_capturing_screen_ = false; 226 bool is_capturing_screen_ = false;
225 227
226 // TODO(mthiesse): Remove the need for this to be stored here. 228 // TODO(mthiesse): Remove the need for this to be stored here.
227 // crbug.com/674594 229 // crbug.com/674594
228 gvr_context* gvr_api_; 230 gvr_context* gvr_api_;
229 231
230 // Are we currently providing a gamepad factory to the gamepad manager? 232 // Are we currently providing a gamepad factory to the gamepad manager?
231 bool gamepad_source_active_ = false; 233 bool gamepad_source_active_ = false;
232 // Registered fetcher, must remain alive for UpdateGamepadData calls. 234 // Registered fetcher, must remain alive for UpdateGamepadData calls.
233 // That's ok since the fetcher is only destroyed from VrShell's destructor. 235 // That's ok since the fetcher is only destroyed from VrShell's destructor.
234 device::GvrGamepadDataFetcher* gamepad_data_fetcher_ = nullptr; 236 device::GvrGamepadDataFetcher* gamepad_data_fetcher_ = nullptr;
235 237
236 base::WeakPtrFactory<VrShell> weak_ptr_factory_; 238 base::WeakPtrFactory<VrShell> weak_ptr_factory_;
237 239
238 DISALLOW_COPY_AND_ASSIGN(VrShell); 240 DISALLOW_COPY_AND_ASSIGN(VrShell);
239 }; 241 };
240 242
241 bool RegisterVrShell(JNIEnv* env); 243 bool RegisterVrShell(JNIEnv* env);
242 244
243 } // namespace vr_shell 245 } // namespace vr_shell
244 246
245 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_H_ 247 #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