| OLD | NEW |
| 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_GL_THREAD_H_ | 5 #ifndef CHROME_BROWSER_ANDROID_VR_SHELL_VR_GL_THREAD_H_ |
| 6 #define CHROME_BROWSER_ANDROID_VR_SHELL_VR_GL_THREAD_H_ | 6 #define CHROME_BROWSER_ANDROID_VR_SHELL_VR_GL_THREAD_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
| 12 #include "base/single_thread_task_runner.h" | 12 #include "base/single_thread_task_runner.h" |
| 13 #include "base/threading/thread.h" | 13 #include "base/threading/thread.h" |
| 14 #include "third_party/gvr-android-sdk/src/libraries/headers/vr/gvr/capi/include/
gvr_types.h" | 14 #include "third_party/gvr-android-sdk/src/libraries/headers/vr/gvr/capi/include/
gvr_types.h" |
| 15 | 15 |
| 16 namespace vr_shell { | 16 namespace vr_shell { |
| 17 | 17 |
| 18 class UiScene; |
| 19 class UiSceneManager; |
| 18 class VrShell; | 20 class VrShell; |
| 19 class VrShellGl; | 21 class VrShellGl; |
| 20 | 22 |
| 21 class VrGLThread : public base::Thread { | 23 class VrGLThread : public base::Thread { |
| 22 public: | 24 public: |
| 23 VrGLThread( | 25 VrGLThread( |
| 24 const base::WeakPtr<VrShell>& weak_vr_shell, | 26 const base::WeakPtr<VrShell>& weak_vr_shell, |
| 25 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner, | 27 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner, |
| 26 gvr_context* gvr_api, | 28 gvr_context* gvr_api, |
| 27 bool initially_web_vr, | 29 bool initially_web_vr, |
| 28 bool reprojected_rendering); | 30 bool reprojected_rendering); |
| 29 | 31 |
| 30 ~VrGLThread() override; | 32 ~VrGLThread() override; |
| 31 base::WeakPtr<VrShellGl> GetVrShellGl() { return weak_vr_shell_gl_; } | 33 base::WeakPtr<VrShellGl> GetVrShellGl() { return weak_vr_shell_gl_; } |
| 34 base::WeakPtr<UiSceneManager> GetSceneManager() { |
| 35 return weak_scene_manager_; |
| 36 } |
| 32 | 37 |
| 33 protected: | 38 protected: |
| 34 void Init() override; | 39 void Init() override; |
| 35 void CleanUp() override; | 40 void CleanUp() override; |
| 36 | 41 |
| 37 private: | 42 private: |
| 38 // Created on GL thread. | 43 // Created on GL thread. |
| 44 std::unique_ptr<UiScene> scene_; |
| 45 std::unique_ptr<UiSceneManager> scene_manager_; |
| 46 base::WeakPtr<UiSceneManager> weak_scene_manager_; |
| 39 std::unique_ptr<VrShellGl> vr_shell_gl_; | 47 std::unique_ptr<VrShellGl> vr_shell_gl_; |
| 40 base::WeakPtr<VrShellGl> weak_vr_shell_gl_; | 48 base::WeakPtr<VrShellGl> weak_vr_shell_gl_; |
| 41 | 49 |
| 42 // This state is used for initializing vr_shell_gl_. | 50 // This state is used for initializing vr_shell_gl_. |
| 43 base::WeakPtr<VrShell> weak_vr_shell_; | 51 base::WeakPtr<VrShell> weak_vr_shell_; |
| 44 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_; | 52 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_; |
| 45 gvr_context* gvr_api_; | 53 gvr_context* gvr_api_; |
| 46 bool initially_web_vr_; | 54 bool initially_web_vr_; |
| 47 bool reprojected_rendering_; | 55 bool reprojected_rendering_; |
| 48 | 56 |
| 49 DISALLOW_COPY_AND_ASSIGN(VrGLThread); | 57 DISALLOW_COPY_AND_ASSIGN(VrGLThread); |
| 50 }; | 58 }; |
| 51 | 59 |
| 52 } // namespace vr_shell | 60 } // namespace vr_shell |
| 53 | 61 |
| 54 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_GL_THREAD_H_ | 62 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_GL_THREAD_H_ |
| OLD | NEW |