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:
@@ -1952,7 +1952,7 @@ PWebRenderBridgeParent* CompositorBridgeParent::AllocPWebRenderBridgeParent(
|
|||||||
mOMTASampler->SetWebRenderWindowId(windowId);
|
mOMTASampler->SetWebRenderWindowId(windowId);
|
||||||
}
|
}
|
||||||
|
|
||||||
nsCString error;
|
nsCString error("FEATURE_FAILTURE_WEBRENDER_INITIALIZE_UNSPECIFIED");
|
||||||
RefPtr<wr::WebRenderAPI> api =
|
RefPtr<wr::WebRenderAPI> api =
|
||||||
wr::WebRenderAPI::Create(this, std::move(widget), windowId, aSize, error);
|
wr::WebRenderAPI::Create(this, std::move(widget), windowId, aSize, error);
|
||||||
if (!api) {
|
if (!api) {
|
||||||
|
|||||||
@@ -397,7 +397,12 @@ mozilla::ipc::IPCResult WebRenderBridgeParent::RecvEnsureConnected(
|
|||||||
*aTextureFactoryIdentifier =
|
*aTextureFactoryIdentifier =
|
||||||
TextureFactoryIdentifier(LayersBackend::LAYERS_NONE);
|
TextureFactoryIdentifier(LayersBackend::LAYERS_NONE);
|
||||||
*aMaybeIdNamespace = Nothing();
|
*aMaybeIdNamespace = Nothing();
|
||||||
|
if (mInitError.IsEmpty()) {
|
||||||
|
// Got destroyed after we initialized but before the handshake finished?
|
||||||
|
aError->AssignLiteral("FEATURE_FAILURE_WEBRENDER_INITIALIZE_RACE");
|
||||||
|
} else {
|
||||||
*aError = std::move(mInitError);
|
*aError = std::move(mInitError);
|
||||||
|
}
|
||||||
return IPC_OK();
|
return IPC_OK();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -62,6 +62,10 @@ bool WebRenderLayerManager::Initialize(
|
|||||||
MOZ_ASSERT(mWrChild == nullptr);
|
MOZ_ASSERT(mWrChild == nullptr);
|
||||||
MOZ_ASSERT(aTextureFactoryIdentifier);
|
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();
|
LayoutDeviceIntSize size = mWidget->GetClientSize();
|
||||||
PWebRenderBridgeChild* bridge =
|
PWebRenderBridgeChild* bridge =
|
||||||
aCBChild->SendPWebRenderBridgeConstructor(aLayersId, size);
|
aCBChild->SendPWebRenderBridgeConstructor(aLayersId, size);
|
||||||
@@ -71,17 +75,28 @@ bool WebRenderLayerManager::Initialize(
|
|||||||
// reinitialization. We can expect to be notified again to reinitialize
|
// reinitialization. We can expect to be notified again to reinitialize
|
||||||
// (which may or may not be using WebRender).
|
// (which may or may not be using WebRender).
|
||||||
gfxCriticalNote << "Failed to create WebRenderBridgeChild.";
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
TextureFactoryIdentifier textureFactoryIdentifier;
|
TextureFactoryIdentifier textureFactoryIdentifier;
|
||||||
wr::MaybeIdNamespace idNamespace;
|
wr::MaybeIdNamespace idNamespace;
|
||||||
// Sync ipc
|
// 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 ||
|
if (textureFactoryIdentifier.mParentBackend == LayersBackend::LAYERS_NONE ||
|
||||||
idNamespace.isNothing()) {
|
idNamespace.isNothing()) {
|
||||||
gfxCriticalNote << "Failed to connect WebRenderBridgeChild.";
|
gfxCriticalNote << "Failed to connect WebRenderBridgeChild.";
|
||||||
|
aError.Append(hasInitialized ? "_POST"_ns : "_FIRST"_ns);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -90,6 +105,7 @@ bool WebRenderLayerManager::Initialize(
|
|||||||
WrBridge()->IdentifyTextureHost(textureFactoryIdentifier);
|
WrBridge()->IdentifyTextureHost(textureFactoryIdentifier);
|
||||||
WrBridge()->SetNamespace(idNamespace.ref());
|
WrBridge()->SetNamespace(idNamespace.ref());
|
||||||
*aTextureFactoryIdentifier = textureFactoryIdentifier;
|
*aTextureFactoryIdentifier = textureFactoryIdentifier;
|
||||||
|
hasInitialized = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user