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

Unified Diff: device/vr/android/gvr/gvr_device_provider.cc

Issue 2742083002: Revert of Re-land WebVR compositor bypass via BrowserMain context + mailbox (Closed)
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « device/vr/android/gvr/gvr_device_provider.h ('k') | device/vr/test/fake_vr_device.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/vr/android/gvr/gvr_device_provider.cc
diff --git a/device/vr/android/gvr/gvr_device_provider.cc b/device/vr/android/gvr/gvr_device_provider.cc
index 9b5be90ee8c1d6eeca3e479436fb6969fa93ed18..4aff6ce54860890f749df2ec638836a32b48f671 100644
--- a/device/vr/android/gvr/gvr_device_provider.cc
+++ b/device/vr/android/gvr/gvr_device_provider.cc
@@ -33,14 +33,9 @@
}
void GvrDeviceProvider::GetDevices(std::vector<VRDevice*>* devices) {
- devices->push_back(vr_device_.get());
-}
-
-device::GvrDelegateProvider* GvrDeviceProvider::GetDelegateProvider() {
- device::GvrDelegateProvider* provider =
- device::GvrDelegateProvider::GetInstance();
- Initialize(provider);
- return provider;
+ Initialize();
+ if (initialized_)
+ devices->push_back(vr_device_.get());
}
void GvrDeviceProvider::Initialize() {
@@ -48,36 +43,41 @@
// GvrDeviceProvider so we don't have to call this function multiple times.
// Ideally the DelegateProvider would always be available, and GetInstance()
// would create it.
- Initialize(device::GvrDelegateProvider::GetInstance());
-}
-
-void GvrDeviceProvider::Initialize(device::GvrDelegateProvider* provider) {
- if (!provider)
+ if (initialized_)
return;
- provider->SetDeviceProvider(this);
+ device::GvrDelegateProvider* delegate_provider =
+ device::GvrDelegateProvider::GetInstance();
+ if (!delegate_provider)
+ return;
+ delegate_provider->SetDeviceProvider(this);
+ initialized_ = true;
}
void GvrDeviceProvider::RequestPresent(
- mojom::VRSubmitFrameClientPtr submit_client,
const base::Callback<void(bool)>& callback) {
- device::GvrDelegateProvider* delegate_provider = GetDelegateProvider();
+ Initialize();
+ device::GvrDelegateProvider* delegate_provider =
+ device::GvrDelegateProvider::GetInstance();
if (!delegate_provider)
return callback.Run(false);
// RequestWebVRPresent is async as we may trigger a DON flow that pauses
// Chrome.
- delegate_provider->RequestWebVRPresent(std::move(submit_client), callback);
+ delegate_provider->RequestWebVRPresent(callback);
}
// VR presentation exit requested by the API.
void GvrDeviceProvider::ExitPresent() {
- device::GvrDelegateProvider* delegate_provider = GetDelegateProvider();
+ Initialize();
+ GvrDelegateProvider* delegate_provider = GvrDelegateProvider::GetInstance();
if (delegate_provider)
delegate_provider->ExitWebVRPresent();
}
void GvrDeviceProvider::SetListeningForActivate(bool listening) {
- device::GvrDelegateProvider* delegate_provider = GetDelegateProvider();
+ Initialize();
+ device::GvrDelegateProvider* delegate_provider =
+ device::GvrDelegateProvider::GetInstance();
if (!delegate_provider)
return;
« no previous file with comments | « device/vr/android/gvr/gvr_device_provider.h ('k') | device/vr/test/fake_vr_device.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698