From 77de4f7263e376e55b521514e02132b5f987d940 Mon Sep 17 00:00:00 2001 From: Coroiu Cristina Date: Sat, 26 Jan 2019 01:46:32 +0200 Subject: [PATCH] Backed out changeset e0034670b26a (bug 1514417) as requested by daoshengmu --- gfx/vr/gfxVRExternal.cpp | 8 ++------ gfx/vr/gfxVRExternal.h | 1 - gfx/vr/service/VRService.cpp | 7 ------- gfx/vr/service/VRService.h | 3 --- 4 files changed, 2 insertions(+), 17 deletions(-) diff --git a/gfx/vr/gfxVRExternal.cpp b/gfx/vr/gfxVRExternal.cpp index a4f006f61ddf..b982a84b8c0b 100644 --- a/gfx/vr/gfxVRExternal.cpp +++ b/gfx/vr/gfxVRExternal.cpp @@ -426,8 +426,8 @@ VRSystemManagerExternal::VRSystemManagerExternal( VRExternalShmem* aAPIShmem /* = nullptr*/) : mExternalShmem(aAPIShmem) #if !defined(MOZ_WIDGET_ANDROID) - , mMutex("VRSystemManagerExternal::mMutex") - , mSameProcess(aAPIShmem != nullptr) + , + mSameProcess(aAPIShmem != nullptr) #endif { #if defined(XP_MACOSX) @@ -844,10 +844,6 @@ void VRSystemManagerExternal::PushState(VRBrowserState* aBrowserState, pthread_mutex_unlock((pthread_mutex_t*)&(mExternalShmem->browserMutex)); } #else - // We need this MutexAutoLock to avoid mAPIShmem happens deadlock issue - // when both of VRService and VRSubmitFrame threads are writing/reading - // it from the memory. - MutexAutoLock lock(mMutex); mExternalShmem->browserGenerationA++; memcpy((void*)&(mExternalShmem->browserState), (void*)aBrowserState, sizeof(VRBrowserState)); diff --git a/gfx/vr/gfxVRExternal.h b/gfx/vr/gfxVRExternal.h index 1b0429fefbb1..d129350e27bc 100644 --- a/gfx/vr/gfxVRExternal.h +++ b/gfx/vr/gfxVRExternal.h @@ -134,7 +134,6 @@ class VRSystemManagerExternal : public VRSystemManager { volatile VRExternalShmem* mExternalShmem; #if !defined(MOZ_WIDGET_ANDROID) - Mutex mMutex; bool mSameProcess; #endif TimeStamp mEarliestRestartTime; diff --git a/gfx/vr/service/VRService.cpp b/gfx/vr/service/VRService.cpp index 1b8664c99b0b..b622a460e9f1 100644 --- a/gfx/vr/service/VRService.cpp +++ b/gfx/vr/service/VRService.cpp @@ -68,9 +68,6 @@ VRService::VRService() mTargetShmemFile(0), mLastHapticState{}, mFrameStartTime{}, -#if !defined(MOZ_WIDGET_ANDROID) - mMutex("VRService::mMutex"), -#endif mVRProcessEnabled(gfxPrefs::VRProcessEnabled()) { // When we have the VR process, we map the memory // of mAPIShmem from GPU process. @@ -459,10 +456,6 @@ void VRService::PullState(mozilla::gfx::VRBrowserState& aState) { pthread_mutex_unlock((pthread_mutex_t*)&(mExternalShmem->browserMutex)); } #else - // We need this MutexAutoLock to avoid mAPIShmem happens deadlock issue - // when both of VRService and VRSubmitFrame threads are writing/reading - // it from the memory. - MutexAutoLock lock(mMutex); VRExternalShmem tmp; if (mAPIShmem->browserGenerationA != mBrowserGeneration) { memcpy(&tmp, mAPIShmem, sizeof(VRExternalShmem)); diff --git a/gfx/vr/service/VRService.h b/gfx/vr/service/VRService.h index 1a6f955d8259..32eddab50c1d 100644 --- a/gfx/vr/service/VRService.h +++ b/gfx/vr/service/VRService.h @@ -63,9 +63,6 @@ class VRService { base::ProcessHandle mTargetShmemFile; VRHapticState mLastHapticState[kVRHapticsMaxCount]; TimeStamp mFrameStartTime[kVRFrameTimingHistoryDepth]; -#if !defined(MOZ_WIDGET_ANDROID) - Mutex mMutex; -#endif // We store the value of gfxPrefs::VRProcessEnabled() in mVRProcessEnabled. // This allows us to read the value in the VRService destructor, after // gfxPrefs has been shut down. We should investigate why gfxPrefs