| 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_interface.h" | 9 #include "chrome/browser/android/vr_shell/ui_interface.h" |
| 10 #include "chrome/browser/android/vr_shell/ui_scene.h" | 10 #include "chrome/browser/android/vr_shell/ui_scene.h" |
| 11 #include "chrome/browser/android/vr_shell/ui_scene_manager.h" | 11 #include "chrome/browser/android/vr_shell/ui_scene_manager.h" |
| 12 #include "chrome/browser/android/vr_shell/vr_input_manager.h" | 12 #include "chrome/browser/android/vr_shell/vr_input_manager.h" |
| 13 #include "chrome/browser/android/vr_shell/vr_shell.h" | 13 #include "chrome/browser/android/vr_shell/vr_shell.h" |
| 14 #include "chrome/browser/android/vr_shell/vr_shell_gl.h" | 14 #include "chrome/browser/android/vr_shell/vr_shell_gl.h" |
| 15 | 15 |
| 16 namespace vr_shell { | 16 namespace vr_shell { |
| 17 | 17 |
| 18 VrGLThread::VrGLThread( | 18 VrGLThread::VrGLThread( |
| 19 const base::WeakPtr<VrShell>& weak_vr_shell, | 19 const base::WeakPtr<VrShell>& weak_vr_shell, |
| 20 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner, | 20 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner, |
| 21 gvr_context* gvr_api, | 21 gvr_context* gvr_api, |
| 22 bool initially_web_vr, | 22 bool initially_web_vr, |
| 23 bool in_cct, |
| 23 bool reprojected_rendering) | 24 bool reprojected_rendering) |
| 24 : base::Thread("VrShellGL"), | 25 : base::Thread("VrShellGL"), |
| 25 weak_vr_shell_(weak_vr_shell), | 26 weak_vr_shell_(weak_vr_shell), |
| 26 main_thread_task_runner_(std::move(main_thread_task_runner)), | 27 main_thread_task_runner_(std::move(main_thread_task_runner)), |
| 27 gvr_api_(gvr_api), | 28 gvr_api_(gvr_api), |
| 28 initially_web_vr_(initially_web_vr), | 29 initially_web_vr_(initially_web_vr), |
| 30 in_cct_(in_cct), |
| 29 reprojected_rendering_(reprojected_rendering) {} | 31 reprojected_rendering_(reprojected_rendering) {} |
| 30 | 32 |
| 31 VrGLThread::~VrGLThread() { | 33 VrGLThread::~VrGLThread() { |
| 32 Stop(); | 34 Stop(); |
| 33 } | 35 } |
| 34 | 36 |
| 35 void VrGLThread::Init() { | 37 void VrGLThread::Init() { |
| 36 scene_ = base::MakeUnique<UiScene>(); | 38 scene_ = base::MakeUnique<UiScene>(); |
| 37 vr_shell_gl_ = base::MakeUnique<VrShellGl>( | 39 vr_shell_gl_ = base::MakeUnique<VrShellGl>( |
| 38 this, gvr_api_, initially_web_vr_, reprojected_rendering_, scene_.get()); | 40 this, gvr_api_, initially_web_vr_, reprojected_rendering_, scene_.get()); |
| 39 scene_manager_ = base::MakeUnique<UiSceneManager>(this, scene_.get()); | 41 scene_manager_ = |
| 42 base::MakeUnique<UiSceneManager>(this, scene_.get(), in_cct_); |
| 40 | 43 |
| 41 weak_vr_shell_gl_ = vr_shell_gl_->GetWeakPtr(); | 44 weak_vr_shell_gl_ = vr_shell_gl_->GetWeakPtr(); |
| 42 weak_scene_manager_ = scene_manager_->GetWeakPtr(); | 45 weak_scene_manager_ = scene_manager_->GetWeakPtr(); |
| 43 vr_shell_gl_->Initialize(); | 46 vr_shell_gl_->Initialize(); |
| 44 } | 47 } |
| 45 | 48 |
| 46 void VrGLThread::ContentSurfaceChanged(jobject surface) { | 49 void VrGLThread::ContentSurfaceChanged(jobject surface) { |
| 47 main_thread_task_runner_->PostTask( | 50 main_thread_task_runner_->PostTask( |
| 48 FROM_HERE, | 51 FROM_HERE, |
| 49 base::Bind(&VrShell::ContentSurfaceChanged, weak_vr_shell_, surface)); | 52 base::Bind(&VrShell::ContentSurfaceChanged, weak_vr_shell_, surface)); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 base::Bind(&VrShell::OnContentPaused, weak_vr_shell_, enabled)); | 99 base::Bind(&VrShell::OnContentPaused, weak_vr_shell_, enabled)); |
| 97 } | 100 } |
| 98 | 101 |
| 99 void VrGLThread::CleanUp() { | 102 void VrGLThread::CleanUp() { |
| 100 scene_manager_.reset(); | 103 scene_manager_.reset(); |
| 101 vr_shell_gl_.reset(); | 104 vr_shell_gl_.reset(); |
| 102 scene_.reset(); | 105 scene_.reset(); |
| 103 } | 106 } |
| 104 | 107 |
| 105 } // namespace vr_shell | 108 } // namespace vr_shell |
| OLD | NEW |