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

Unified Diff: chrome/browser/android/vr_shell/vr_shell_delegate.h

Issue 2658643003: Refactor GvrDelegate ownership into GvrDelegateProvider and fix more threading violations. (Closed)
Patch Set: cleanup Created 3 years, 11 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
Index: chrome/browser/android/vr_shell/vr_shell_delegate.h
diff --git a/chrome/browser/android/vr_shell/vr_shell_delegate.h b/chrome/browser/android/vr_shell/vr_shell_delegate.h
index 8067a412fdf76538cc0f11a970df54aa4783f6eb..426273c9039d693928cd62adc440e2c474f03c29 100644
--- a/chrome/browser/android/vr_shell/vr_shell_delegate.h
+++ b/chrome/browser/android/vr_shell/vr_shell_delegate.h
@@ -25,9 +25,10 @@ class VrShellDelegate : public device::GvrDelegateProvider {
VrShellDelegate(JNIEnv* env, jobject obj);
~VrShellDelegate() override;
- static VrShellDelegate* GetNativeDelegate(JNIEnv* env, jobject jdelegate);
+ static VrShellDelegate* GetNativeVrShellDelegate(JNIEnv* env,
+ jobject jdelegate);
- void SetDelegate(device::GvrDelegate* delegate);
+ void SetDelegate(device::GvrDelegate* delegate, gvr_context* context);
void RemoveDelegate();
void SetPresentResult(JNIEnv* env,
@@ -49,12 +50,14 @@ class VrShellDelegate : public device::GvrDelegateProvider {
private:
// device::GvrDelegateProvider implementation
void SetDeviceProvider(device::GvrDeviceProvider* device_provider) override;
+ void ClearDeviceProvider() override;
void RequestWebVRPresent(const base::Callback<void(bool)>& callback) override;
void ExitWebVRPresent() override;
- device::GvrDelegate* GetNonPresentingDelegate() override;
- void DestroyNonPresentingDelegate() override;
+ device::GvrDelegate* GetDelegate() override;
void SetListeningForActivate(bool listening) override;
+ void CreateNonPresentingDelegate();
+
std::unique_ptr<NonPresentingGvrDelegate> non_presenting_delegate_;
base::android::ScopedJavaGlobalRef<jobject> j_vr_shell_delegate_;
device::GvrDeviceProvider* device_provider_ = nullptr;
@@ -63,6 +66,9 @@ class VrShellDelegate : public device::GvrDelegateProvider {
long timebase_nanos_ = 0;
double interval_seconds_ = 0;
+ // TODO(mthiesse): Remove the need for this to stored here. crbug.com/674594
cjgrant 2017/01/25 21:45:31 "to be"
mthiesse 2017/01/30 19:47:26 Done.
+ gvr_context* context_ = nullptr;
+
base::WeakPtrFactory<VrShellDelegate> weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(VrShellDelegate);

Powered by Google App Engine
This is Rietveld 408576698