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

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

Issue 2902393002: [vr] Bail on unhandled code points. (Closed)
Patch Set: histograms Created 3 years, 7 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.h" 5 #include "chrome/browser/android/vr_shell/vr_shell.h"
6 6
7 #include <android/native_window_jni.h> 7 #include <android/native_window_jni.h>
8 8
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 // should add a flag for disabling specific UI such as the keyboard (see 79 // should add a flag for disabling specific UI such as the keyboard (see
80 // VrTabHelper for details). 80 // VrTabHelper for details).
81 contents->GetRenderWidgetHostView()->SetIsInVR(is_in_vr); 81 contents->GetRenderWidgetHostView()->SetIsInVR(is_in_vr);
82 82
83 VrTabHelper* vr_tab_helper = VrTabHelper::FromWebContents(contents); 83 VrTabHelper* vr_tab_helper = VrTabHelper::FromWebContents(contents);
84 DCHECK(vr_tab_helper); 84 DCHECK(vr_tab_helper);
85 vr_tab_helper->SetIsInVr(is_in_vr); 85 vr_tab_helper->SetIsInVr(is_in_vr);
86 } 86 }
87 } 87 }
88 88
89 static const char* kUnsupportedModeHistogramName =
90 "VR.Shell.EncounteredUnsupportedMode";
91
89 } // namespace 92 } // namespace
90 93
91 VrShell::VrShell(JNIEnv* env, 94 VrShell::VrShell(JNIEnv* env,
92 jobject obj, 95 jobject obj,
93 ui::WindowAndroid* window, 96 ui::WindowAndroid* window,
94 bool for_web_vr, 97 bool for_web_vr,
95 bool in_cct, 98 bool in_cct,
96 VrShellDelegate* delegate, 99 VrShellDelegate* delegate,
97 gvr_context* gvr_api, 100 gvr_context* gvr_api,
98 bool reprojected_rendering) 101 bool reprojected_rendering)
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after
574 void VrShell::ExitPresent() { 577 void VrShell::ExitPresent() {
575 delegate_provider_->ExitWebVRPresent(); 578 delegate_provider_->ExitWebVRPresent();
576 } 579 }
577 580
578 void VrShell::ExitFullscreen() { 581 void VrShell::ExitFullscreen() {
579 if (web_contents_ && web_contents_->IsFullscreen()) { 582 if (web_contents_ && web_contents_->IsFullscreen()) {
580 web_contents_->ExitFullscreen(false); 583 web_contents_->ExitFullscreen(false);
581 } 584 }
582 } 585 }
583 586
584 void VrShell::ExitVrDueToUnsupportedMode() { 587 void VrShell::ExitVrDueToUnsupportedMode(UiUnsupportedMode mode) {
585 ui_->SetIsExiting(); 588 ui_->SetIsExiting();
586 main_thread_task_runner_->PostDelayedTask( 589 main_thread_task_runner_->PostDelayedTask(
587 FROM_HERE, 590 FROM_HERE,
588 base::Bind(&VrShell::ForceExitVr, weak_ptr_factory_.GetWeakPtr()), 591 base::Bind(&VrShell::ForceExitVr, weak_ptr_factory_.GetWeakPtr()),
589 kExitVrDueToUnsupportedModeDelay); 592 kExitVrDueToUnsupportedModeDelay);
593 UMA_HISTOGRAM_ENUMERATION(kUnsupportedModeHistogramName, mode,
594 UiUnsupportedMode::kMax);
590 } 595 }
591 596
592 void VrShell::OnVRVsyncProviderRequest( 597 void VrShell::OnVRVsyncProviderRequest(
593 device::mojom::VRVSyncProviderRequest request) { 598 device::mojom::VRVSyncProviderRequest request) {
594 WaitForGlThread(); 599 WaitForGlThread();
595 PostToGlThread(FROM_HERE, 600 PostToGlThread(FROM_HERE,
596 base::Bind(&VrShellGl::OnRequest, gl_thread_->GetVrShellGl(), 601 base::Bind(&VrShellGl::OnRequest, gl_thread_->GetVrShellGl(),
597 base::Passed(&request))); 602 base::Passed(&request)));
598 } 603 }
599 604
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
695 jlong gvr_api, 700 jlong gvr_api,
696 jboolean reprojected_rendering) { 701 jboolean reprojected_rendering) {
697 return reinterpret_cast<intptr_t>(new VrShell( 702 return reinterpret_cast<intptr_t>(new VrShell(
698 env, obj, reinterpret_cast<ui::WindowAndroid*>(window_android), 703 env, obj, reinterpret_cast<ui::WindowAndroid*>(window_android),
699 for_web_vr, in_cct, 704 for_web_vr, in_cct,
700 VrShellDelegate::GetNativeVrShellDelegate(env, delegate), 705 VrShellDelegate::GetNativeVrShellDelegate(env, delegate),
701 reinterpret_cast<gvr_context*>(gvr_api), reprojected_rendering)); 706 reinterpret_cast<gvr_context*>(gvr_api), reprojected_rendering));
702 } 707 }
703 708
704 } // namespace vr_shell 709 } // namespace vr_shell
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698