Bug 1923086 [Wayland] Set compositor crash handler r=emilio

Differential Revision: https://phabricator.services.mozilla.com/D224926
This commit is contained in:
stransky 2024-10-10 20:20:40 +00:00
parent 254711f85b
commit c51049416a
3 changed files with 9 additions and 0 deletions

View File

@ -4751,6 +4751,7 @@ int XREMain::XRE_mainStartup(bool* aExitFlag) {
if (!disableWaylandProxy && XRE_IsParentProcess() && waylandEnabled) {
auto* proxyLog = getenv("WAYLAND_PROXY_LOG");
WaylandProxy::SetVerbose(proxyLog && *proxyLog);
WaylandProxy::SetCompositorCrashHandler(WlCompositorCrashHandler);
gWaylandProxy = WaylandProxy::Create();
if (gWaylandProxy) {
gWaylandProxy->RunThread();

View File

@ -523,6 +523,13 @@ static void WlLogHandler(const char* format, va_list args) {
MOZ_CRASH_UNSAFE(error);
}
// TODO: Add compositor info
void WlCompositorCrashHandler() {
constexpr char error[] = "Compositor crashed";
gfxCriticalNote << "Wayland protocol error: " << error;
MOZ_CRASH_UNSAFE(error);
}
nsWaylandDisplay::nsWaylandDisplay(wl_display* aDisplay)
: mThreadId(PR_GetCurrentThread()), mDisplay(aDisplay) {
// GTK sets the log handler on display creation, thus we overwrite it here

View File

@ -120,6 +120,7 @@ class nsWaylandDisplay {
wl_display* WaylandDisplayGetWLDisplay();
nsWaylandDisplay* WaylandDisplayGet();
void WaylandDisplayRelease();
void WlCompositorCrashHandler();
} // namespace mozilla::widget