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

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: Cleanup Created 3 years, 9 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 <limits> 7 #include <limits>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/android/jni_android.h" 10 #include "base/android/jni_android.h"
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 // of the native GL context to avoid stalls later in GVR frame 332 // of the native GL context to avoid stalls later in GVR frame
333 // acquire/submit. 333 // acquire/submit.
334 glFinish(); 334 glFinish();
335 } 335 }
336 336
337 void VrShellGl::SetSubmitClient( 337 void VrShellGl::SetSubmitClient(
338 device::mojom::VRSubmitFrameClientPtrInfo submit_client_info) { 338 device::mojom::VRSubmitFrameClientPtrInfo submit_client_info) {
339 submit_client_.Bind(std::move(submit_client_info)); 339 submit_client_.Bind(std::move(submit_client_info));
340 } 340 }
341 341
342 void VrShellGl::CreateUiElementInfos(
343 std::vector<int> element_ids,
344 int callback_id,
345 base::Callback<void(int, std::unique_ptr<base::DictionaryValue>)>
346 onCreate) {
tiborg 2017/03/27 15:14:33 Nit: I think we generally follow the convention to
bsheedy 2017/03/27 17:49:09 Done.
347 std::unique_ptr<base::DictionaryValue> reply =
348 base::MakeUnique<base::DictionaryValue>();
349 for (unsigned int i = 0; i < element_ids.size(); i++) {
350 reply->Set(std::to_string(element_ids[i]),
351 std::move(scene_->CreateUiElementInfo(element_ids[i])));
352 }
353 main_thread_task_runner_->PostTask(
354 FROM_HERE,
355 base::Bind(onCreate, callback_id, base::Passed(std::move(reply))));
356 }
357
342 void VrShellGl::OnUIFrameAvailable() { 358 void VrShellGl::OnUIFrameAvailable() {
343 ui_surface_texture_->UpdateTexImage(); 359 ui_surface_texture_->UpdateTexImage();
344 } 360 }
345 361
346 void VrShellGl::OnContentFrameAvailable() { 362 void VrShellGl::OnContentFrameAvailable() {
347 content_surface_texture_->UpdateTexImage(); 363 content_surface_texture_->UpdateTexImage();
348 received_frame_ = true; 364 received_frame_ = true;
349 } 365 }
350 366
351 void VrShellGl::OnWebVRFrameAvailable() { 367 void VrShellGl::OnWebVRFrameAvailable() {
(...skipping 938 matching lines...) Expand 10 before | Expand all | Expand 10 after
1290 // appropriate recommended render resolution as the default size during 1306 // appropriate recommended render resolution as the default size during
1291 // InitializeGl. Revisit if the initialization order changes. 1307 // InitializeGl. Revisit if the initialization order changes.
1292 device::mojom::VRDisplayInfoPtr info = VrShell::CreateVRDisplayInfo( 1308 device::mojom::VRDisplayInfoPtr info = VrShell::CreateVRDisplayInfo(
1293 gvr_api_.get(), webvr_surface_size_, device_id); 1309 gvr_api_.get(), webvr_surface_size_, device_id);
1294 main_thread_task_runner_->PostTask( 1310 main_thread_task_runner_->PostTask(
1295 FROM_HERE, 1311 FROM_HERE,
1296 base::Bind(&RunVRDisplayInfoCallback, callback, base::Passed(&info))); 1312 base::Bind(&RunVRDisplayInfoCallback, callback, base::Passed(&info)));
1297 } 1313 }
1298 1314
1299 } // namespace vr_shell 1315 } // namespace vr_shell
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698