Bug 1504937 - Use DBus remote only when running on Wayland display, r=jhorak

Differential Revision: https://phabricator.services.mozilla.com/D11004

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Martin Stransky 2018-11-06 14:59:58 +00:00
Родитель 9cae2bda28
Коммит a3dbcdcdf6
4 изменённых файлов: 28 добавлений и 28 удалений

Просмотреть файл

@ -33,17 +33,22 @@ NS_IMPL_ISUPPORTS(nsRemoteService,
NS_IMETHODIMP
nsRemoteService::Startup(const char* aAppName, const char* aProfileName)
{
#if defined(MOZ_ENABLE_DBUS) && defined(MOZ_WAYLAND)
nsresult rv;
mDBusRemoteService = new nsDBusRemoteService();
rv = mDBusRemoteService->Startup(aAppName, aProfileName);
if (NS_FAILED(rv)) {
mDBusRemoteService = nullptr;
bool useX11Remote = GDK_IS_X11_DISPLAY(gdk_display_get_default());
#if defined(MOZ_ENABLE_DBUS)
if (!useX11Remote) {
nsresult rv;
mDBusRemoteService = new nsDBusRemoteService();
rv = mDBusRemoteService->Startup(aAppName, aProfileName);
if (NS_FAILED(rv)) {
mDBusRemoteService = nullptr;
}
}
#elif !defined(MOZ_WAYLAND)
mGtkRemoteService = new nsGTKRemoteService();
mGtkRemoteService->Startup(aAppName, aProfileName);
#endif
if (useX11Remote) {
mGtkRemoteService = new nsGTKRemoteService();
mGtkRemoteService->Startup(aAppName, aProfileName);
}
if (!mDBusRemoteService && !mGtkRemoteService)
return NS_ERROR_FAILURE;
@ -70,7 +75,7 @@ nsRemoteService::RegisterWindow(mozIDOMWindow* aWindow)
NS_IMETHODIMP
nsRemoteService::Shutdown()
{
#if defined(MOZ_ENABLE_DBUS) && defined(MOZ_WAYLAND)
#if defined(MOZ_ENABLE_DBUS)
if (mDBusRemoteService) {
mDBusRemoteService->Shutdown();
mDBusRemoteService = nullptr;

Просмотреть файл

@ -1700,11 +1700,16 @@ StartRemoteClient(const char* aDesktopStartupID,
{
nsAutoPtr<nsRemoteClient> client;
#if defined(MOZ_ENABLE_DBUS) && defined(MOZ_WAYLAND)
client = new DBusRemoteClient();
#else
client = new XRemoteClient();
bool useX11Remote = GDK_IS_X11_DISPLAY(gdk_display_get_default());
#if defined(MOZ_ENABLE_DBUS)
if (!useX11Remote) {
client = new DBusRemoteClient();
} else
#endif
{
client = new XRemoteClient();
}
nsresult rv = client->Init();
if (NS_FAILED(rv))

Просмотреть файл

@ -192,15 +192,8 @@ DBusRemoteClient::DoSendDBusCommandLine(const char *aProgram, const char *aProfi
}
// send message and get a handle for a reply
DBusError err;
dbus_error_init(&err);
RefPtr<DBusMessage> reply = already_AddRefed<DBusMessage>(
dbus_connection_send_with_reply_and_block(mConnection, msg, -1, &err));
dbus_connection_send_with_reply_and_block(mConnection, msg, -1, nullptr));
if (dbus_error_is_set(&err)) {
dbus_error_free(&err);
return NS_ERROR_FAILURE;
}
return NS_OK;
return reply ? NS_OK : NS_ERROR_FAILURE;
}

Просмотреть файл

@ -11,15 +11,12 @@ FINAL_LIBRARY = 'xul'
SOURCES += [
'RemoteUtils.cpp',
'XRemoteClient.cpp',
]
if CONFIG['MOZ_ENABLE_DBUS'] and CONFIG['MOZ_WAYLAND']:
if CONFIG['MOZ_ENABLE_DBUS']:
SOURCES += [
'DBusRemoteClient.cpp',
]
CXXFLAGS += CONFIG['TK_CFLAGS']
CXXFLAGS += CONFIG['MOZ_DBUS_GLIB_CFLAGS']
else:
SOURCES += [
'XRemoteClient.cpp',
]