| 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_shell_gl.h" | 5 #include "chrome/browser/android/vr_shell/vr_shell_gl.h" |
| 6 | 6 |
| 7 #include <chrono> |
| 7 #include <limits> | 8 #include <limits> |
| 8 #include <utility> | 9 #include <utility> |
| 9 | 10 |
| 10 #include "base/android/jni_android.h" | 11 #include "base/android/jni_android.h" |
| 11 #include "base/callback_helpers.h" | 12 #include "base/callback_helpers.h" |
| 12 #include "base/memory/ptr_util.h" | 13 #include "base/memory/ptr_util.h" |
| 13 #include "base/metrics/histogram_macros.h" | 14 #include "base/metrics/histogram_macros.h" |
| 14 #include "base/threading/thread_task_runner_handle.h" | 15 #include "base/threading/thread_task_runner_handle.h" |
| 15 #include "chrome/browser/android/vr_shell/mailbox_to_surface_bridge.h" | 16 #include "chrome/browser/android/vr_shell/mailbox_to_surface_bridge.h" |
| 16 #include "chrome/browser/android/vr_shell/ui_elements.h" | 17 #include "chrome/browser/android/vr_shell/ui_elements.h" |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 // callbacks, so instead of providing a VSync, tell the requester to try | 181 // callbacks, so instead of providing a VSync, tell the requester to try |
| 181 // again. A VSyncProvider is guaranteed to exist, so the request in response | 182 // again. A VSyncProvider is guaranteed to exist, so the request in response |
| 182 // to this message will go through some other VSyncProvider. | 183 // to this message will go through some other VSyncProvider. |
| 183 base::ResetAndReturn(&callback_) | 184 base::ResetAndReturn(&callback_) |
| 184 .Run(nullptr, base::TimeDelta(), -1, | 185 .Run(nullptr, base::TimeDelta(), -1, |
| 185 device::mojom::VRVSyncProvider::Status::CLOSING); | 186 device::mojom::VRVSyncProvider::Status::CLOSING); |
| 186 } | 187 } |
| 187 } | 188 } |
| 188 | 189 |
| 189 void VrShellGl::Initialize() { | 190 void VrShellGl::Initialize() { |
| 190 scene_.reset(new UiScene); | 191 scene_ = base::MakeUnique<UiScene>(); |
| 191 | 192 |
| 192 if (surfaceless_rendering_) { | 193 if (surfaceless_rendering_) { |
| 193 // If we're rendering surfaceless, we'll never get a java surface to render | 194 // If we're rendering surfaceless, we'll never get a java surface to render |
| 194 // into, so we can initialize GL right away. | 195 // into, so we can initialize GL right away. |
| 195 InitializeGl(nullptr); | 196 InitializeGl(nullptr); |
| 196 } | 197 } |
| 197 } | 198 } |
| 198 | 199 |
| 199 void VrShellGl::InitializeGl(gfx::AcceleratedWidget window) { | 200 void VrShellGl::InitializeGl(gfx::AcceleratedWidget window) { |
| 200 CHECK(!ready_to_draw_); | 201 CHECK(!ready_to_draw_); |
| (...skipping 1065 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1266 // appropriate recommended render resolution as the default size during | 1267 // appropriate recommended render resolution as the default size during |
| 1267 // InitializeGl. Revisit if the initialization order changes. | 1268 // InitializeGl. Revisit if the initialization order changes. |
| 1268 device::mojom::VRDisplayInfoPtr info = VrShell::CreateVRDisplayInfo( | 1269 device::mojom::VRDisplayInfoPtr info = VrShell::CreateVRDisplayInfo( |
| 1269 gvr_api_.get(), webvr_surface_size_, device_id); | 1270 gvr_api_.get(), webvr_surface_size_, device_id); |
| 1270 main_thread_task_runner_->PostTask( | 1271 main_thread_task_runner_->PostTask( |
| 1271 FROM_HERE, | 1272 FROM_HERE, |
| 1272 base::Bind(&RunVRDisplayInfoCallback, callback, base::Passed(&info))); | 1273 base::Bind(&RunVRDisplayInfoCallback, callback, base::Passed(&info))); |
| 1273 } | 1274 } |
| 1274 | 1275 |
| 1275 } // namespace vr_shell | 1276 } // namespace vr_shell |
| OLD | NEW |