Bug 1663923 - Cover more WebRender initialization failure paths with explicit reasons. r=kvark

Differential Revision: https://phabricator.services.mozilla.com/D89596
This commit is contained in:
Andrew Osmond
2020-09-09 15:47:46 +00:00
parent b8b6fa455e
commit 8b68b2b0a8
3 changed files with 25 additions and 4 deletions

View File

@@ -62,6 +62,10 @@ bool WebRenderLayerManager::Initialize(
MOZ_ASSERT(mWrChild == nullptr);
MOZ_ASSERT(aTextureFactoryIdentifier);
// When we fail to initialize WebRender, it is useful to know if it has ever
// succeeded, or if this is the first attempt.
static bool hasInitialized = false;
LayoutDeviceIntSize size = mWidget->GetClientSize();
PWebRenderBridgeChild* bridge =
aCBChild->SendPWebRenderBridgeConstructor(aLayersId, size);
@@ -71,17 +75,28 @@ bool WebRenderLayerManager::Initialize(
// reinitialization. We can expect to be notified again to reinitialize
// (which may or may not be using WebRender).
gfxCriticalNote << "Failed to create WebRenderBridgeChild.";
aError.AssignLiteral("FEATURE_FAILURE_WEBRENDER_INITIALIZE_IPDL");
aError.Assign(hasInitialized
? "FEATURE_FAILURE_WEBRENDER_INITIALIZE_IPDL_POST"_ns
: "FEATURE_FAILURE_WEBRENDER_INITIALIZE_IPDL_FIRST"_ns);
return false;
}
TextureFactoryIdentifier textureFactoryIdentifier;
wr::MaybeIdNamespace idNamespace;
// Sync ipc
bridge->SendEnsureConnected(&textureFactoryIdentifier, &idNamespace, &aError);
if (!bridge->SendEnsureConnected(&textureFactoryIdentifier, &idNamespace,
&aError)) {
gfxCriticalNote << "Failed as lost WebRenderBridgeChild.";
aError.Assign(hasInitialized
? "FEATURE_FAILURE_WEBRENDER_INITIALIZE_SYNC_POST"_ns
: "FEATURE_FAILURE_WEBRENDER_INITIALIZE_SYNC_FIRST"_ns);
return false;
}
if (textureFactoryIdentifier.mParentBackend == LayersBackend::LAYERS_NONE ||
idNamespace.isNothing()) {
gfxCriticalNote << "Failed to connect WebRenderBridgeChild.";
aError.Append(hasInitialized ? "_POST"_ns : "_FIRST"_ns);
return false;
}
@@ -90,6 +105,7 @@ bool WebRenderLayerManager::Initialize(
WrBridge()->IdentifyTextureHost(textureFactoryIdentifier);
WrBridge()->SetNamespace(idNamespace.ref());
*aTextureFactoryIdentifier = textureFactoryIdentifier;
hasInitialized = true;
return true;
}