Title: [228987] trunk/Source
Revision
228987
Author
[email protected]
Date
2018-02-26 01:43:50 -0800 (Mon, 26 Feb 2018)

Log Message

[GStreamer] User current executable name instead of g_get_prgname() for gst_init
https://bugs.webkit.org/show_bug.cgi?id=183119

Reviewed by Philippe Normand.

Source/WebCore:

g_get_prgname() is only set for programs using GOptionContext, calling gtk_init or explicitly calling
g_set_prgname(). Use WTF::getCurrentExecutableName() instead.

* platform/graphics/gstreamer/GStreamerUtilities.cpp:
(WebCore::initializeGStreamer):

Source/WTF:

Add getCurrentExecutableName() helper function to get the name of the current executable.

* wtf/glib/GLibUtilities.cpp:
(getCurrentExecutableName): Get the basename of getCurrentExecutablePath() falling back to g_get_prgname().
* wtf/glib/GLibUtilities.h:

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (228986 => 228987)


--- trunk/Source/WTF/ChangeLog	2018-02-26 08:57:48 UTC (rev 228986)
+++ trunk/Source/WTF/ChangeLog	2018-02-26 09:43:50 UTC (rev 228987)
@@ -1,3 +1,16 @@
+2018-02-26  Carlos Garcia Campos  <[email protected]>
+
+        [GStreamer] User current executable name instead of g_get_prgname() for gst_init
+        https://bugs.webkit.org/show_bug.cgi?id=183119
+
+        Reviewed by Philippe Normand.
+
+        Add getCurrentExecutableName() helper function to get the name of the current executable.
+
+        * wtf/glib/GLibUtilities.cpp:
+        (getCurrentExecutableName): Get the basename of getCurrentExecutablePath() falling back to g_get_prgname().
+        * wtf/glib/GLibUtilities.h:
+
 2018-02-23  John Wilander  <[email protected]>
 
         Introduce ITP debug logging as an opt-in developer feature

Modified: trunk/Source/WTF/wtf/glib/GLibUtilities.cpp (228986 => 228987)


--- trunk/Source/WTF/wtf/glib/GLibUtilities.cpp	2018-02-26 08:57:48 UTC (rev 228986)
+++ trunk/Source/WTF/wtf/glib/GLibUtilities.cpp	2018-02-26 09:43:50 UTC (rev 228987)
@@ -20,6 +20,9 @@
 #include "config.h"
 #include "GLibUtilities.h"
 
+#include <glib.h>
+#include <wtf/glib/GUniquePtr.h>
+
 #if OS(WINDOWS)
 #include <windows.h>
 #include <wtf/text/WTFString.h>
@@ -63,3 +66,14 @@
     return path.utf8();
 }
 #endif
+
+CString getCurrentExecutableName()
+{
+    auto executablePath = getCurrentExecutablePath();
+    if (!executablePath.isNull()) {
+        GUniquePtr<char> basename(g_path_get_basename(executablePath.data()));
+        return basename.get();
+    }
+
+    return g_get_prgname();
+}

Modified: trunk/Source/WTF/wtf/glib/GLibUtilities.h (228986 => 228987)


--- trunk/Source/WTF/wtf/glib/GLibUtilities.h	2018-02-26 08:57:48 UTC (rev 228986)
+++ trunk/Source/WTF/wtf/glib/GLibUtilities.h	2018-02-26 09:43:50 UTC (rev 228987)
@@ -24,6 +24,7 @@
 #include <wtf/text/CString.h>
 
 CString getCurrentExecutablePath();
+CString getCurrentExecutableName();
 
 // These might be added to glib in the future, but in the meantime they're defined here.
 #ifndef GULONG_TO_POINTER

Modified: trunk/Source/WebCore/ChangeLog (228986 => 228987)


--- trunk/Source/WebCore/ChangeLog	2018-02-26 08:57:48 UTC (rev 228986)
+++ trunk/Source/WebCore/ChangeLog	2018-02-26 09:43:50 UTC (rev 228987)
@@ -1,3 +1,16 @@
+2018-02-26  Carlos Garcia Campos  <[email protected]>
+
+        [GStreamer] User current executable name instead of g_get_prgname() for gst_init
+        https://bugs.webkit.org/show_bug.cgi?id=183119
+
+        Reviewed by Philippe Normand.
+
+        g_get_prgname() is only set for programs using GOptionContext, calling gtk_init or explicitly calling
+        g_set_prgname(). Use WTF::getCurrentExecutableName() instead.
+
+        * platform/graphics/gstreamer/GStreamerUtilities.cpp:
+        (WebCore::initializeGStreamer):
+
 2018-02-25  Wenson Hsieh  <[email protected]>
 
         [Extra zoom mode] Disable downloadable binary fonts by default

Modified: trunk/Source/WebCore/platform/graphics/gstreamer/GStreamerUtilities.cpp (228986 => 228987)


--- trunk/Source/WebCore/platform/graphics/gstreamer/GStreamerUtilities.cpp	2018-02-26 08:57:48 UTC (rev 228986)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/GStreamerUtilities.cpp	2018-02-26 09:43:50 UTC (rev 228987)
@@ -264,7 +264,7 @@
         Vector<String> parameters = options.value_or(extractGStreamerOptionsFromCommandLine());
         char** argv = g_new0(char*, parameters.size() + 2);
         int argc = parameters.size() + 1;
-        argv[0] = g_strdup(g_get_prgname());
+        argv[0] = g_strdup(getCurrentExecutableName().data());
         for (unsigned i = 0; i < parameters.size(); i++)
             argv[i + 1] = g_strdup(parameters[i].utf8().data());
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to