mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-04-04 13:42:48 +00:00
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:
parent
ad4b2fd4e0
commit
221455cf7a
@ -1952,7 +1952,7 @@ PWebRenderBridgeParent* CompositorBridgeParent::AllocPWebRenderBridgeParent(
|
||||
mOMTASampler->SetWebRenderWindowId(windowId);
|
||||
}
|
||||
|
||||
nsCString error;
|
||||
nsCString error("FEATURE_FAILTURE_WEBRENDER_INITIALIZE_UNSPECIFIED");
|
||||
RefPtr<wr::WebRenderAPI> api =
|
||||
wr::WebRenderAPI::Create(this, std::move(widget), windowId, aSize, error);
|
||||
if (!api) {
|
||||
|
@ -397,7 +397,12 @@ mozilla::ipc::IPCResult WebRenderBridgeParent::RecvEnsureConnected(
|
||||
*aTextureFactoryIdentifier =
|
||||
TextureFactoryIdentifier(LayersBackend::LAYERS_NONE);
|
||||
*aMaybeIdNamespace = Nothing();
|
||||
*aError = std::move(mInitError);
|
||||
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);
|
||||
}
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user