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