Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(220)

Side by Side Diff: chrome/browser/android/vr_shell/vr_shell_gl.cc

Issue 2773903003: Add way to get native VR UI information from Java (Closed)
Patch Set: Remove comment Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 const base::Callback<void(std::unique_ptr<base::DictionaryValue>)>&
347 on_created) {
348 auto reply = base::MakeUnique<base::DictionaryValue>();
349 for (const auto& name : element_names) {
350 reply->Set(name, std::move(scene_->CreateUiElementInfo(name)));
351 }
352 main_thread_task_runner_->PostTask(
353 FROM_HERE, base::Bind(on_created, base::Passed(std::move(reply))));
354 }
355
343 void VrShellGl::OnUIFrameAvailable() { 356 void VrShellGl::OnUIFrameAvailable() {
344 ui_surface_texture_->UpdateTexImage(); 357 ui_surface_texture_->UpdateTexImage();
345 } 358 }
346 359
347 void VrShellGl::OnContentFrameAvailable() { 360 void VrShellGl::OnContentFrameAvailable() {
348 content_surface_texture_->UpdateTexImage(); 361 content_surface_texture_->UpdateTexImage();
349 received_frame_ = true; 362 received_frame_ = true;
350 } 363 }
351 364
352 void VrShellGl::OnWebVRFrameAvailable() { 365 void VrShellGl::OnWebVRFrameAvailable() {
(...skipping 951 matching lines...) Expand 10 before | Expand all | Expand 10 after
1304 // appropriate recommended render resolution as the default size during 1317 // appropriate recommended render resolution as the default size during
1305 // InitializeGl. Revisit if the initialization order changes. 1318 // InitializeGl. Revisit if the initialization order changes.
1306 device::mojom::VRDisplayInfoPtr info = VrShell::CreateVRDisplayInfo( 1319 device::mojom::VRDisplayInfoPtr info = VrShell::CreateVRDisplayInfo(
1307 gvr_api_.get(), webvr_surface_size_, device_id); 1320 gvr_api_.get(), webvr_surface_size_, device_id);
1308 main_thread_task_runner_->PostTask( 1321 main_thread_task_runner_->PostTask(
1309 FROM_HERE, 1322 FROM_HERE,
1310 base::Bind(&RunVRDisplayInfoCallback, callback, base::Passed(&info))); 1323 base::Bind(&RunVRDisplayInfoCallback, callback, base::Passed(&info)));
1311 } 1324 }
1312 1325
1313 } // namespace vr_shell 1326 } // namespace vr_shell
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698