| Index: chrome/browser/android/vr_shell/vr_gl_thread.cc
|
| diff --git a/chrome/browser/android/vr_shell/vr_gl_thread.cc b/chrome/browser/android/vr_shell/vr_gl_thread.cc
|
| index 16d08aa97d14aaf6ae34a176297c3b2525b41239..a5cc9c2814b1cda3d0e311dfedfe4ebb001ce46f 100644
|
| --- a/chrome/browser/android/vr_shell/vr_gl_thread.cc
|
| +++ b/chrome/browser/android/vr_shell/vr_gl_thread.cc
|
| @@ -25,7 +25,8 @@ VrGLThread::VrGLThread(
|
| main_thread_task_runner_(std::move(main_thread_task_runner)),
|
| gvr_api_(gvr_api),
|
| initially_web_vr_(initially_web_vr),
|
| - reprojected_rendering_(reprojected_rendering) {}
|
| + reprojected_rendering_(reprojected_rendering),
|
| + weak_ptr_factory_(this) {}
|
|
|
| VrGLThread::~VrGLThread() {
|
| Stop();
|
| @@ -34,15 +35,29 @@ VrGLThread::~VrGLThread() {
|
| void VrGLThread::Init() {
|
| scene_ = base::MakeUnique<UiScene>();
|
| vr_shell_gl_ = base::MakeUnique<VrShellGl>(
|
| - std::move(weak_vr_shell_), std::move(main_thread_task_runner_), gvr_api_,
|
| - initially_web_vr_, reprojected_rendering_, scene_.get());
|
| - scene_manager_ = base::MakeUnique<UiSceneManager>(scene_.get());
|
| + weak_ptr_factory_.GetWeakPtr(), gvr_api_, initially_web_vr_,
|
| + reprojected_rendering_, scene_.get());
|
| + scene_manager_ = base::MakeUnique<UiSceneManager>(
|
| + weak_ptr_factory_.GetWeakPtr(), scene_.get());
|
|
|
| weak_vr_shell_gl_ = vr_shell_gl_->GetWeakPtr();
|
| weak_scene_manager_ = scene_manager_->GetWeakPtr();
|
| vr_shell_gl_->Initialize();
|
| }
|
|
|
| +void VrGLThread::PostToMainThread(const base::Closure& task) {
|
| + main_thread_task_runner_->PostTask(FROM_HERE, task);
|
| +}
|
| +
|
| +base::WeakPtr<VrShell> VrGLThread::GetVrShell() {
|
| + return weak_vr_shell_;
|
| +}
|
| +
|
| +scoped_refptr<base::SingleThreadTaskRunner>
|
| +VrGLThread::GetMainThreadTaskRunner() {
|
| + return main_thread_task_runner_;
|
| +}
|
| +
|
| void VrGLThread::CleanUp() {
|
| scene_manager_.reset();
|
| vr_shell_gl_.reset();
|
|
|