Skip to content
This repository was archived by the owner on Jul 9, 2025. It is now read-only.

Commit 6d8653b

Browse files
committed
Bug 1564127 - Check if GPU/VR process has connected with the parent process. r=kip
This issue happens when VR/GPU haven't connected with the parent process via IPC protocol, and we are trying to access its IPC Child when it is still null. It is possible to be happened when GPU/VR process is killed/shutdown, and we are trying to launch a new VR process. We need to check these status before completing our VR process's launch. Differential Revision: https://phabricator.services.mozilla.com/D46540 --HG-- extra : moz-landing-system : lando
1 parent 7b84f55 commit 6d8653b

3 files changed

Lines changed: 18 additions & 7 deletions

File tree

gfx/vr/ipc/VRProcessManager.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,11 @@ bool VRProcessManager::CreateGPUBridges(
154154
bool VRProcessManager::CreateGPUVRManager(
155155
base::ProcessId aOtherProcess,
156156
mozilla::ipc::Endpoint<PVRGPUChild>* aOutEndpoint) {
157+
if (mProcess && !mProcess->IsConnected()) {
158+
NS_WARNING("VR process haven't connected with the parent process yet");
159+
return false;
160+
}
161+
157162
base::ProcessId vrparentPid = mProcess
158163
? mProcess->OtherPid() // VR process id.
159164
: base::GetCurrentProcId();

gfx/vr/ipc/VRProcessParent.cpp

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ bool VRProcessParent::WaitForLaunch() {
9696
// immediately set up the IPDL actor and fire callbacks. The IO thread will
9797
// still dispatch a notification to the main thread - we'll just ignore it.
9898
bool result = GeckoChildProcessHost::WaitUntilConnected(timeoutMs);
99-
InitAfterConnect(result);
99+
result &= InitAfterConnect(result);
100100
return result;
101101
}
102102

@@ -138,14 +138,22 @@ void VRProcessParent::DestroyProcess() {
138138
}
139139
}
140140

141-
void VRProcessParent::InitAfterConnect(bool aSucceeded) {
141+
bool VRProcessParent::InitAfterConnect(bool aSucceeded) {
142142
MOZ_ASSERT(mLaunchPhase == LaunchPhase::Waiting);
143143
MOZ_ASSERT(!mVRChild);
144144

145145
mLaunchPhase = LaunchPhase::Complete;
146146
mPrefSerializer = nullptr;
147147

148148
if (aSucceeded) {
149+
GPUChild* gpuChild = GPUProcessManager::Get()->GetGPUChild();
150+
if (!gpuChild) {
151+
NS_WARNING(
152+
"GPU process haven't connected with the parent process yet"
153+
"when creating VR process.");
154+
return false;
155+
}
156+
149157
mVRChild = MakeUnique<VRChild>(this);
150158

151159
DebugOnly<bool> rv =
@@ -159,10 +167,6 @@ void VRProcessParent::InitAfterConnect(bool aSucceeded) {
159167
}
160168

161169
// Make vr-gpu process connection
162-
GPUChild* gpuChild = GPUProcessManager::Get()->GetGPUChild();
163-
// Add logs for Bug 1565000 to figure out why gpuChild can't be access.
164-
MOZ_RELEASE_ASSERT(gpuChild, "gpuChild is null.");
165-
166170
Endpoint<PVRGPUChild> vrGPUBridge;
167171
VRProcessManager* vpm = VRProcessManager::Get();
168172
DebugOnly<bool> opened =
@@ -171,6 +175,8 @@ void VRProcessParent::InitAfterConnect(bool aSucceeded) {
171175

172176
Unused << gpuChild->SendInitVR(std::move(vrGPUBridge));
173177
}
178+
179+
return true;
174180
}
175181

176182
void VRProcessParent::KillHard(const char* aReason) {

gfx/vr/ipc/VRProcessParent.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ class VRProcessParent final : public mozilla::ipc::GeckoChildProcessHost {
6666

6767
DISALLOW_COPY_AND_ASSIGN(VRProcessParent);
6868

69-
void InitAfterConnect(bool aSucceeded);
69+
bool InitAfterConnect(bool aSucceeded);
7070
void KillHard(const char* aReason);
7171

7272
UniquePtr<VRChild> mVRChild;

0 commit comments

Comments
 (0)