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 <chrono> |
8 #include <limits> | 8 #include <limits> |
| 9 #include <string> |
9 #include <utility> | 10 #include <utility> |
10 | 11 |
11 #include "base/android/jni_android.h" | 12 #include "base/android/jni_android.h" |
12 #include "base/callback_helpers.h" | 13 #include "base/callback_helpers.h" |
13 #include "base/memory/ptr_util.h" | 14 #include "base/memory/ptr_util.h" |
14 #include "base/metrics/histogram_macros.h" | 15 #include "base/metrics/histogram_macros.h" |
15 #include "base/threading/thread_task_runner_handle.h" | 16 #include "base/threading/thread_task_runner_handle.h" |
16 #include "chrome/browser/android/vr_shell/mailbox_to_surface_bridge.h" | 17 #include "chrome/browser/android/vr_shell/mailbox_to_surface_bridge.h" |
17 #include "chrome/browser/android/vr_shell/ui_elements.h" | 18 #include "chrome/browser/android/vr_shell/ui_elements.h" |
18 #include "chrome/browser/android/vr_shell/ui_interface.h" | 19 #include "chrome/browser/android/vr_shell/ui_interface.h" |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 // of the native GL context to avoid stalls later in GVR frame | 334 // of the native GL context to avoid stalls later in GVR frame |
334 // acquire/submit. | 335 // acquire/submit. |
335 glFinish(); | 336 glFinish(); |
336 } | 337 } |
337 | 338 |
338 void VrShellGl::SetSubmitClient( | 339 void VrShellGl::SetSubmitClient( |
339 device::mojom::VRSubmitFrameClientPtrInfo submit_client_info) { | 340 device::mojom::VRSubmitFrameClientPtrInfo submit_client_info) { |
340 submit_client_.Bind(std::move(submit_client_info)); | 341 submit_client_.Bind(std::move(submit_client_info)); |
341 } | 342 } |
342 | 343 |
| 344 void VrShellGl::CreateUiElementInfos( |
| 345 const std::vector<std::string>& element_names, |
| 346 int callback_id, |
| 347 base::Callback<void(int, std::unique_ptr<base::DictionaryValue>)> |
| 348 on_created) { |
| 349 auto reply = base::MakeUnique<base::DictionaryValue>(); |
| 350 for (const auto& name : element_names) { |
| 351 reply->Set(name, std::move(scene_->CreateUiElementInfo(name))); |
| 352 } |
| 353 main_thread_task_runner_->PostTask( |
| 354 FROM_HERE, |
| 355 base::Bind(on_created, callback_id, base::Passed(std::move(reply)))); |
| 356 } |
| 357 |
343 void VrShellGl::OnUIFrameAvailable() { | 358 void VrShellGl::OnUIFrameAvailable() { |
344 ui_surface_texture_->UpdateTexImage(); | 359 ui_surface_texture_->UpdateTexImage(); |
345 } | 360 } |
346 | 361 |
347 void VrShellGl::OnContentFrameAvailable() { | 362 void VrShellGl::OnContentFrameAvailable() { |
348 content_surface_texture_->UpdateTexImage(); | 363 content_surface_texture_->UpdateTexImage(); |
349 received_frame_ = true; | 364 received_frame_ = true; |
350 } | 365 } |
351 | 366 |
352 void VrShellGl::OnWebVRFrameAvailable() { | 367 void VrShellGl::OnWebVRFrameAvailable() { |
(...skipping 938 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1291 // appropriate recommended render resolution as the default size during | 1306 // appropriate recommended render resolution as the default size during |
1292 // InitializeGl. Revisit if the initialization order changes. | 1307 // InitializeGl. Revisit if the initialization order changes. |
1293 device::mojom::VRDisplayInfoPtr info = VrShell::CreateVRDisplayInfo( | 1308 device::mojom::VRDisplayInfoPtr info = VrShell::CreateVRDisplayInfo( |
1294 gvr_api_.get(), webvr_surface_size_, device_id); | 1309 gvr_api_.get(), webvr_surface_size_, device_id); |
1295 main_thread_task_runner_->PostTask( | 1310 main_thread_task_runner_->PostTask( |
1296 FROM_HERE, | 1311 FROM_HERE, |
1297 base::Bind(&RunVRDisplayInfoCallback, callback, base::Passed(&info))); | 1312 base::Bind(&RunVRDisplayInfoCallback, callback, base::Passed(&info))); |
1298 } | 1313 } |
1299 | 1314 |
1300 } // namespace vr_shell | 1315 } // namespace vr_shell |
OLD | NEW |