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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 // callbacks, so instead of providing a VSync, tell the requester to try | 174 // callbacks, so instead of providing a VSync, tell the requester to try |
174 // again. A VSyncProvider is guaranteed to exist, so the request in response | 175 // again. A VSyncProvider is guaranteed to exist, so the request in response |
175 // to this message will go through some other VSyncProvider. | 176 // to this message will go through some other VSyncProvider. |
176 base::ResetAndReturn(&callback_) | 177 base::ResetAndReturn(&callback_) |
177 .Run(nullptr, base::TimeDelta(), -1, | 178 .Run(nullptr, base::TimeDelta(), -1, |
178 device::mojom::VRVSyncProvider::Status::CLOSING); | 179 device::mojom::VRVSyncProvider::Status::CLOSING); |
179 } | 180 } |
180 } | 181 } |
181 | 182 |
182 void VrShellGl::Initialize() { | 183 void VrShellGl::Initialize() { |
183 scene_.reset(new UiScene); | 184 scene_ = base::MakeUnique<UiScene>(); |
184 | 185 |
185 if (surfaceless_rendering_) { | 186 if (surfaceless_rendering_) { |
186 // If we're rendering surfaceless, we'll never get a java surface to render | 187 // If we're rendering surfaceless, we'll never get a java surface to render |
187 // into, so we can initialize GL right away. | 188 // into, so we can initialize GL right away. |
188 InitializeGl(nullptr); | 189 InitializeGl(nullptr); |
189 } | 190 } |
190 } | 191 } |
191 | 192 |
192 void VrShellGl::InitializeGl(gfx::AcceleratedWidget window) { | 193 void VrShellGl::InitializeGl(gfx::AcceleratedWidget window) { |
193 CHECK(!ready_to_draw_); | 194 CHECK(!ready_to_draw_); |
(...skipping 1096 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1290 // appropriate recommended render resolution as the default size during | 1291 // appropriate recommended render resolution as the default size during |
1291 // InitializeGl. Revisit if the initialization order changes. | 1292 // InitializeGl. Revisit if the initialization order changes. |
1292 device::mojom::VRDisplayInfoPtr info = VrShell::CreateVRDisplayInfo( | 1293 device::mojom::VRDisplayInfoPtr info = VrShell::CreateVRDisplayInfo( |
1293 gvr_api_.get(), webvr_surface_size_, device_id); | 1294 gvr_api_.get(), webvr_surface_size_, device_id); |
1294 main_thread_task_runner_->PostTask( | 1295 main_thread_task_runner_->PostTask( |
1295 FROM_HERE, | 1296 FROM_HERE, |
1296 base::Bind(&RunVRDisplayInfoCallback, callback, base::Passed(&info))); | 1297 base::Bind(&RunVRDisplayInfoCallback, callback, base::Passed(&info))); |
1297 } | 1298 } |
1298 | 1299 |
1299 } // namespace vr_shell | 1300 } // namespace vr_shell |
OLD | NEW |