WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Add Realtime portal support
0001-Support-Realtime-portal.patch (text/plain), 3.84 KB, created by
Patrick Griffis
on 2021-07-10 12:38:35 PDT
(
hide
)
Description:
Add Realtime portal support
Filename:
MIME Type:
Creator:
Patrick Griffis
Created:
2021-07-10 12:38:35 PDT
Size:
3.84 KB
patch
obsolete
>From 1ee68241f403f72054c53767dd7dac40bfe20961 Mon Sep 17 00:00:00 2001 >From: Patrick Griffis <pgriffis@igalia.com> >Date: Sat, 10 Jul 2021 14:19:17 -0500 >Subject: [PATCH] Support Realtime portal > >--- > Source/WTF/wtf/glib/RealTimeKit.cpp | 47 ++++++++++++++++++++++++++--- > 1 file changed, 43 insertions(+), 4 deletions(-) > >diff --git a/Source/WTF/wtf/glib/RealTimeKit.cpp b/Source/WTF/wtf/glib/RealTimeKit.cpp >index a0b863fbe2a5..373e87f68ad4 100644 >--- a/Source/WTF/wtf/glib/RealTimeKit.cpp >+++ b/Source/WTF/wtf/glib/RealTimeKit.cpp >@@ -35,7 +35,21 @@ > > namespace WTF { > >-static const Seconds s_dbusCallTimeout = 10_ms; >+static const Seconds s_dbusCallTimeout = 20_ms; >+ >+static int64_t portalGetProperty(GDBusProxy* proxy, const char* propertyName, GError** error) >+{ >+ GRefPtr<GVariant> result = adoptGRef(g_dbus_proxy_call_sync(proxy, "GetProperty", >+ g_variant_new("(s)", propertyName), G_DBUS_CALL_FLAGS_NONE, >+ s_dbusCallTimeout.millisecondsAs<int>(), nullptr, error)); >+ >+ if (!result) >+ return -1; >+ >+ int64_t value; >+ g_variant_get(result.get(), "(x)", &value); >+ return value; >+} > > static int64_t realTimeKitGetProperty(GDBusProxy* proxy, const char* propertyName, GError** error) > { >@@ -56,9 +70,30 @@ static int64_t realTimeKitGetProperty(GDBusProxy* proxy, const char* propertyNam > void makeThreadRealTime(uint64_t processID, uint64_t threadID, uint32_t priority) > { > GUniqueOutPtr<GError> error; >- GRefPtr<GDBusProxy> proxy = adoptGRef(g_dbus_proxy_new_for_bus_sync(G_BUS_TYPE_SYSTEM, >+ GRefPtr<GDBusProxy> proxy; >+ bool usePortal = false; >+ >+ proxy = adoptGRef(g_dbus_proxy_new_for_bus_sync(G_BUS_TYPE_SESSION, > static_cast<GDBusProxyFlags>(G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS | G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES), nullptr, >- "org.freedesktop.RealtimeKit1", "/org/freedesktop/RealtimeKit1", "org.freedesktop.RealtimeKit1", nullptr, &error.outPtr())); >+ "org.freedesktop.portal.Desktop", "/org/freedesktop/portal/desktop", "org.freedesktop.portal.Realtime", nullptr, nullptr)); >+ if (proxy) { >+ /* Test that the portal actually works and is the version we need. */ >+ GRefPtr<GVariant> result = g_dbus_proxy_call_sync (proxy.get(), "org.freedesktop.DBus.Properties.Get", >+ g_variant_new("(ss)", "org.freedesktop.portal.Realtime", "version"), G_DBUS_CALL_FLAGS_NONE, >+ s_dbusCallTimeout.millisecondsAs<int>(), nullptr, nullptr); >+ if (result) { >+ GRefPtr<GVariant> property; >+ g_variant_get(result.get(), "(v)", &property.outPtr()); >+ usePortal = g_variant_get_uint32(property.get()) >= 1; >+ } >+ } >+ >+ if (!usePortal) { >+ proxy = adoptGRef(g_dbus_proxy_new_for_bus_sync(G_BUS_TYPE_SYSTEM, >+ static_cast<GDBusProxyFlags>(G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS | G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES), nullptr, >+ "org.freedesktop.RealtimeKit1", "/org/freedesktop/RealtimeKit1", "org.freedesktop.RealtimeKit1", nullptr, &error.outPtr())); >+ } >+ > if (!proxy) { > LOG_ERROR("Failed to connect to RealtimeKit: %s", error->message); > return; >@@ -68,7 +103,11 @@ void makeThreadRealTime(uint64_t processID, uint64_t threadID, uint32_t priority > // RealTimeKit requires the client to have RLIMIT_RTTIME set. > struct rlimit rl; > if (getrlimit(RLIMIT_RTTIME, &rl) >= 0) { >- auto rttimeMax = realTimeKitGetProperty(proxy.get(), "RTTimeUSecMax", &error.outPtr()); >+ int64_t rttimeMax; >+ if (usePortal) >+ rttimeMax = portalGetProperty(proxy.get(), "RTTimeUSecMax", &error.outPtr()); >+ else >+ rttimeMax = realTimeKitGetProperty(proxy.get(), "RTTimeUSecMax", &error.outPtr()); > if (error) { > LOG_ERROR("Failed to get RTTimeUSecMax from RealtimeKit: %s", error->message); > return; >-- >2.31.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 220115
:
418884
|
431959
|
432258
|
432259
|
432378
|
433265
|
433266
|
433267
|
433758
|
441371
|
441589
|
441595
|
441635
|
441705