Chromium Code Reviews| 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" |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 27 initially_web_vr_(initially_web_vr), | 27 initially_web_vr_(initially_web_vr), |
| 28 reprojected_rendering_(reprojected_rendering) {} | 28 reprojected_rendering_(reprojected_rendering) {} |
| 29 | 29 |
| 30 VrGLThread::~VrGLThread() { | 30 VrGLThread::~VrGLThread() { |
| 31 Stop(); | 31 Stop(); |
| 32 } | 32 } |
| 33 | 33 |
| 34 void VrGLThread::Init() { | 34 void VrGLThread::Init() { |
| 35 scene_ = base::MakeUnique<UiScene>(); | 35 scene_ = base::MakeUnique<UiScene>(); |
| 36 scene_manager_ = base::MakeUnique<UiSceneManager>(scene_.get()); | 36 scene_manager_ = base::MakeUnique<UiSceneManager>(scene_.get()); |
| 37 | |
| 38 // TODO: Clear up the init order. We should create the GL object first, as it | |
|
cjgrant
2017/04/19 16:24:52
Elaborating: This isn't a big deal, but we should
| |
| 39 // is the tool used to draw the scene, and it supplies texture IDs as elements | |
| 40 // are created. However, the GL object also needs a pointer to the scene, so | |
| 41 // it has something to draw. Possibly just supply the scene pointer to | |
| 42 // VrShellGl after it's created. Whatever happens, be sure to tear things | |
| 43 // down later in the inverse order. | |
| 44 | |
| 37 vr_shell_gl_ = base::MakeUnique<VrShellGl>( | 45 vr_shell_gl_ = base::MakeUnique<VrShellGl>( |
| 38 std::move(weak_vr_shell_), std::move(main_thread_task_runner_), gvr_api_, | 46 std::move(weak_vr_shell_), std::move(main_thread_task_runner_), gvr_api_, |
| 39 initially_web_vr_, reprojected_rendering_, scene_.get()); | 47 initially_web_vr_, reprojected_rendering_, scene_.get()); |
| 40 weak_vr_shell_gl_ = vr_shell_gl_->GetWeakPtr(); | 48 weak_vr_shell_gl_ = vr_shell_gl_->GetWeakPtr(); |
| 41 weak_scene_manager_ = scene_manager_->GetWeakPtr(); | 49 weak_scene_manager_ = scene_manager_->GetWeakPtr(); |
| 42 vr_shell_gl_->Initialize(); | 50 vr_shell_gl_->Initialize(); |
| 43 } | 51 } |
| 44 | 52 |
| 45 void VrGLThread::CleanUp() { | 53 void VrGLThread::CleanUp() { |
| 46 vr_shell_gl_.reset(); | 54 vr_shell_gl_.reset(); |
| 47 scene_manager_.reset(); | 55 scene_manager_.reset(); |
| 48 scene_.reset(); | 56 scene_.reset(); |
| 49 } | 57 } |
| 50 | 58 |
| 51 } // namespace vr_shell | 59 } // namespace vr_shell |
| OLD | NEW |