| 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 in_cct, |
| 24 bool reprojected_rendering) | 24 bool reprojected_rendering, |
| 25 bool daydream_support) |
| 25 : base::Thread("VrShellGL"), | 26 : base::Thread("VrShellGL"), |
| 26 weak_vr_shell_(weak_vr_shell), | 27 weak_vr_shell_(weak_vr_shell), |
| 27 main_thread_task_runner_(std::move(main_thread_task_runner)), | 28 main_thread_task_runner_(std::move(main_thread_task_runner)), |
| 28 gvr_api_(gvr_api), | 29 gvr_api_(gvr_api), |
| 29 initially_web_vr_(initially_web_vr), | 30 initially_web_vr_(initially_web_vr), |
| 30 in_cct_(in_cct), | 31 in_cct_(in_cct), |
| 31 reprojected_rendering_(reprojected_rendering) {} | 32 reprojected_rendering_(reprojected_rendering), |
| 33 daydream_support_(daydream_support) {} |
| 32 | 34 |
| 33 VrGLThread::~VrGLThread() { | 35 VrGLThread::~VrGLThread() { |
| 34 Stop(); | 36 Stop(); |
| 35 } | 37 } |
| 36 | 38 |
| 37 void VrGLThread::Init() { | 39 void VrGLThread::Init() { |
| 38 scene_ = base::MakeUnique<UiScene>(); | 40 scene_ = base::MakeUnique<UiScene>(); |
| 39 vr_shell_gl_ = base::MakeUnique<VrShellGl>( | 41 vr_shell_gl_ = base::MakeUnique<VrShellGl>(this, gvr_api_, initially_web_vr_, |
| 40 this, gvr_api_, initially_web_vr_, reprojected_rendering_, scene_.get()); | 42 reprojected_rendering_, |
| 43 daydream_support_, scene_.get()); |
| 41 scene_manager_ = base::MakeUnique<UiSceneManager>(this, scene_.get(), in_cct_, | 44 scene_manager_ = base::MakeUnique<UiSceneManager>(this, scene_.get(), in_cct_, |
| 42 initially_web_vr_); | 45 initially_web_vr_); |
| 43 | 46 |
| 44 weak_vr_shell_gl_ = vr_shell_gl_->GetWeakPtr(); | 47 weak_vr_shell_gl_ = vr_shell_gl_->GetWeakPtr(); |
| 45 weak_scene_manager_ = scene_manager_->GetWeakPtr(); | 48 weak_scene_manager_ = scene_manager_->GetWeakPtr(); |
| 46 vr_shell_gl_->Initialize(); | 49 vr_shell_gl_->Initialize(); |
| 47 } | 50 } |
| 48 | 51 |
| 49 void VrGLThread::ContentSurfaceChanged(jobject surface) { | 52 void VrGLThread::ContentSurfaceChanged(jobject surface) { |
| 50 main_thread_task_runner_->PostTask( | 53 main_thread_task_runner_->PostTask( |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 weak_scene_manager_)); | 194 weak_scene_manager_)); |
| 192 } | 195 } |
| 193 | 196 |
| 194 void VrGLThread::CleanUp() { | 197 void VrGLThread::CleanUp() { |
| 195 scene_manager_.reset(); | 198 scene_manager_.reset(); |
| 196 vr_shell_gl_.reset(); | 199 vr_shell_gl_.reset(); |
| 197 scene_.reset(); | 200 scene_.reset(); |
| 198 } | 201 } |
| 199 | 202 |
| 200 } // namespace vr_shell | 203 } // namespace vr_shell |
| OLD | NEW |