| 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 #include "chrome/browser/android/vr_shell/vr_gl_thread.h" | 5 #include "chrome/browser/android/vr_shell/vr_gl_thread.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "chrome/browser/android/vr_shell/ui_scene.h" | 9 #include "chrome/browser/android/vr_shell/ui_scene.h" |
| 10 #include "chrome/browser/android/vr_shell/ui_scene_manager.h" | 10 #include "chrome/browser/android/vr_shell/ui_scene_manager.h" |
| 11 #include "chrome/browser/android/vr_shell/vr_input_manager.h" | 11 #include "chrome/browser/android/vr_shell/vr_input_manager.h" |
| 12 #include "chrome/browser/android/vr_shell/vr_shell.h" | 12 #include "chrome/browser/android/vr_shell/vr_shell.h" |
| 13 #include "chrome/browser/android/vr_shell/vr_shell_gl.h" | 13 #include "chrome/browser/android/vr_shell/vr_shell_gl.h" |
| 14 | 14 |
| 15 namespace vr_shell { | 15 namespace vr_shell { |
| 16 | 16 |
| 17 VrGLThread::VrGLThread( | 17 VrGLThread::VrGLThread( |
| 18 const base::WeakPtr<VrShell>& weak_vr_shell, | 18 const base::WeakPtr<VrShell>& weak_vr_shell, |
| 19 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner, | 19 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner, |
| 20 gvr_context* gvr_api, | 20 gvr_context* gvr_api, |
| 21 bool initially_web_vr, | 21 bool initially_web_vr, |
| 22 bool in_cct, |
| 22 bool reprojected_rendering) | 23 bool reprojected_rendering) |
| 23 : base::Thread("VrShellGL"), | 24 : base::Thread("VrShellGL"), |
| 24 weak_vr_shell_(weak_vr_shell), | 25 weak_vr_shell_(weak_vr_shell), |
| 25 main_thread_task_runner_(std::move(main_thread_task_runner)), | 26 main_thread_task_runner_(std::move(main_thread_task_runner)), |
| 26 gvr_api_(gvr_api), | 27 gvr_api_(gvr_api), |
| 27 initially_web_vr_(initially_web_vr), | 28 initially_web_vr_(initially_web_vr), |
| 29 in_cct_(in_cct), |
| 28 reprojected_rendering_(reprojected_rendering) {} | 30 reprojected_rendering_(reprojected_rendering) {} |
| 29 | 31 |
| 30 VrGLThread::~VrGLThread() { | 32 VrGLThread::~VrGLThread() { |
| 31 Stop(); | 33 Stop(); |
| 32 } | 34 } |
| 33 | 35 |
| 34 void VrGLThread::Init() { | 36 void VrGLThread::Init() { |
| 35 scene_ = base::MakeUnique<UiScene>(); | 37 scene_ = base::MakeUnique<UiScene>(); |
| 36 vr_shell_gl_ = base::MakeUnique<VrShellGl>( | 38 vr_shell_gl_ = base::MakeUnique<VrShellGl>( |
| 37 std::move(weak_vr_shell_), std::move(main_thread_task_runner_), gvr_api_, | 39 std::move(weak_vr_shell_), std::move(main_thread_task_runner_), gvr_api_, |
| 38 initially_web_vr_, reprojected_rendering_, scene_.get()); | 40 initially_web_vr_, reprojected_rendering_, scene_.get()); |
| 39 scene_manager_ = base::MakeUnique<UiSceneManager>(scene_.get()); | 41 scene_manager_ = base::MakeUnique<UiSceneManager>(scene_.get(), in_cct_); |
| 40 | 42 |
| 41 weak_vr_shell_gl_ = vr_shell_gl_->GetWeakPtr(); | 43 weak_vr_shell_gl_ = vr_shell_gl_->GetWeakPtr(); |
| 42 weak_scene_manager_ = scene_manager_->GetWeakPtr(); | 44 weak_scene_manager_ = scene_manager_->GetWeakPtr(); |
| 43 vr_shell_gl_->Initialize(); | 45 vr_shell_gl_->Initialize(); |
| 44 } | 46 } |
| 45 | 47 |
| 46 void VrGLThread::CleanUp() { | 48 void VrGLThread::CleanUp() { |
| 47 scene_manager_.reset(); | 49 scene_manager_.reset(); |
| 48 vr_shell_gl_.reset(); | 50 vr_shell_gl_.reset(); |
| 49 scene_.reset(); | 51 scene_.reset(); |
| 50 } | 52 } |
| 51 | 53 |
| 52 } // namespace vr_shell | 54 } // namespace vr_shell |
| OLD | NEW |