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

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: Switch to using names instead of IDs 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 std::vector<std::string> element_names,
346 int callback_id,
347 base::Callback<void(int, std::unique_ptr<base::DictionaryValue>)>
348 on_created) {
349 std::unique_ptr<base::DictionaryValue> reply =
cjgrant 2017/03/29 21:16:06 s/std::unique_ptr<base::DictionaryValue>/auto/ is
bsheedy 2017/03/29 22:33:44 Done.
350 base::MakeUnique<base::DictionaryValue>();
351 for (unsigned int i = 0; i < element_names.size(); i++) {
cjgrant 2017/03/29 21:16:06 for (const auto& name : element_names) { reply->
bsheedy 2017/03/29 22:33:45 Done.
352 reply->Set(element_names[i],
353 std::move(scene_->CreateUiElementInfo(element_names[i])));
354 }
355 main_thread_task_runner_->PostTask(
356 FROM_HERE,
357 base::Bind(on_created, callback_id, base::Passed(std::move(reply))));
358 }
359
343 void VrShellGl::OnUIFrameAvailable() { 360 void VrShellGl::OnUIFrameAvailable() {
344 ui_surface_texture_->UpdateTexImage(); 361 ui_surface_texture_->UpdateTexImage();
345 } 362 }
346 363
347 void VrShellGl::OnContentFrameAvailable() { 364 void VrShellGl::OnContentFrameAvailable() {
348 content_surface_texture_->UpdateTexImage(); 365 content_surface_texture_->UpdateTexImage();
349 received_frame_ = true; 366 received_frame_ = true;
350 } 367 }
351 368
352 void VrShellGl::OnWebVRFrameAvailable() { 369 void VrShellGl::OnWebVRFrameAvailable() {
(...skipping 938 matching lines...) Expand 10 before | Expand all | Expand 10 after
1291 // appropriate recommended render resolution as the default size during 1308 // appropriate recommended render resolution as the default size during
1292 // InitializeGl. Revisit if the initialization order changes. 1309 // InitializeGl. Revisit if the initialization order changes.
1293 device::mojom::VRDisplayInfoPtr info = VrShell::CreateVRDisplayInfo( 1310 device::mojom::VRDisplayInfoPtr info = VrShell::CreateVRDisplayInfo(
1294 gvr_api_.get(), webvr_surface_size_, device_id); 1311 gvr_api_.get(), webvr_surface_size_, device_id);
1295 main_thread_task_runner_->PostTask( 1312 main_thread_task_runner_->PostTask(
1296 FROM_HERE, 1313 FROM_HERE,
1297 base::Bind(&RunVRDisplayInfoCallback, callback, base::Passed(&info))); 1314 base::Bind(&RunVRDisplayInfoCallback, callback, base::Passed(&info)));
1298 } 1315 }
1299 1316
1300 } // namespace vr_shell 1317 } // namespace vr_shell
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698