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

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

Issue 2902393002: [vr] Bail on unhandled code points. (Closed)
Patch Set: . Created 3 years, 6 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 // should add a flag for disabling specific UI such as the keyboard (see 80 // should add a flag for disabling specific UI such as the keyboard (see
81 // VrTabHelper for details). 81 // VrTabHelper for details).
82 contents->GetRenderWidgetHostView()->SetIsInVR(is_in_vr); 82 contents->GetRenderWidgetHostView()->SetIsInVR(is_in_vr);
83 83
84 VrTabHelper* vr_tab_helper = VrTabHelper::FromWebContents(contents); 84 VrTabHelper* vr_tab_helper = VrTabHelper::FromWebContents(contents);
85 DCHECK(vr_tab_helper); 85 DCHECK(vr_tab_helper);
86 vr_tab_helper->SetIsInVr(is_in_vr); 86 vr_tab_helper->SetIsInVr(is_in_vr);
87 } 87 }
88 } 88 }
89 89
90 static const char* kUnsupportedModeHistogramName =
Ilya Sherman 2017/05/26 22:19:51 nit: no need for "static" in the anonymous namespa
Ilya Sherman 2017/05/26 22:19:51 nit: const char kUnsupportedModeHistogramName[] =
Mark P 2017/05/26 22:29:18 If it's only used in one place, why not use the "s
Ian Vollick 2017/05/27 00:02:44 Removed as per mpearson's comment.
Ian Vollick 2017/05/27 00:02:44 Done.
Ian Vollick 2017/05/27 00:02:44 Nuked.
91 "VR.Shell.EncounteredUnsupportedMode";
92
90 } // namespace 93 } // namespace
91 94
92 VrShell::VrShell(JNIEnv* env, 95 VrShell::VrShell(JNIEnv* env,
93 jobject obj, 96 jobject obj,
94 ui::WindowAndroid* window, 97 ui::WindowAndroid* window,
95 bool for_web_vr, 98 bool for_web_vr,
96 bool in_cct, 99 bool in_cct,
97 VrShellDelegate* delegate, 100 VrShellDelegate* delegate,
98 gvr_context* gvr_api, 101 gvr_context* gvr_api,
99 bool reprojected_rendering) 102 bool reprojected_rendering)
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after
575 void VrShell::ExitPresent() { 578 void VrShell::ExitPresent() {
576 delegate_provider_->ExitWebVRPresent(); 579 delegate_provider_->ExitWebVRPresent();
577 } 580 }
578 581
579 void VrShell::ExitFullscreen() { 582 void VrShell::ExitFullscreen() {
580 if (web_contents_ && web_contents_->IsFullscreen()) { 583 if (web_contents_ && web_contents_->IsFullscreen()) {
581 web_contents_->ExitFullscreen(false); 584 web_contents_->ExitFullscreen(false);
582 } 585 }
583 } 586 }
584 587
585 void VrShell::ExitVrDueToUnsupportedMode() { 588 void VrShell::ExitVrDueToUnsupportedMode(UiUnsupportedMode mode) {
586 ui_->SetIsExiting(); 589 ui_->SetIsExiting();
587 main_thread_task_runner_->PostDelayedTask( 590 main_thread_task_runner_->PostDelayedTask(
588 FROM_HERE, 591 FROM_HERE,
589 base::Bind(&VrShell::ForceExitVr, weak_ptr_factory_.GetWeakPtr()), 592 base::Bind(&VrShell::ForceExitVr, weak_ptr_factory_.GetWeakPtr()),
590 kExitVrDueToUnsupportedModeDelay); 593 kExitVrDueToUnsupportedModeDelay);
594 UMA_HISTOGRAM_ENUMERATION(kUnsupportedModeHistogramName, mode,
595 UiUnsupportedMode::kMax);
591 } 596 }
592 597
593 void VrShell::OnVRVsyncProviderRequest( 598 void VrShell::OnVRVsyncProviderRequest(
594 device::mojom::VRVSyncProviderRequest request) { 599 device::mojom::VRVSyncProviderRequest request) {
595 WaitForGlThread(); 600 WaitForGlThread();
596 PostToGlThread(FROM_HERE, 601 PostToGlThread(FROM_HERE,
597 base::Bind(&VrShellGl::OnRequest, gl_thread_->GetVrShellGl(), 602 base::Bind(&VrShellGl::OnRequest, gl_thread_->GetVrShellGl(),
598 base::Passed(&request))); 603 base::Passed(&request)));
599 } 604 }
600 605
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
723 jlong gvr_api, 728 jlong gvr_api,
724 jboolean reprojected_rendering) { 729 jboolean reprojected_rendering) {
725 return reinterpret_cast<intptr_t>(new VrShell( 730 return reinterpret_cast<intptr_t>(new VrShell(
726 env, obj, reinterpret_cast<ui::WindowAndroid*>(window_android), 731 env, obj, reinterpret_cast<ui::WindowAndroid*>(window_android),
727 for_web_vr, in_cct, 732 for_web_vr, in_cct,
728 VrShellDelegate::GetNativeVrShellDelegate(env, delegate), 733 VrShellDelegate::GetNativeVrShellDelegate(env, delegate),
729 reinterpret_cast<gvr_context*>(gvr_api), reprojected_rendering)); 734 reinterpret_cast<gvr_context*>(gvr_api), reprojected_rendering));
730 } 735 }
731 736
732 } // namespace vr_shell 737 } // namespace vr_shell
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698