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