Title: [266697] trunk/Source/WebCore
Revision
266697
Author
[email protected]
Date
2020-09-07 03:09:16 -0700 (Mon, 07 Sep 2020)

Log Message

[GStreamer] Convert custom GObject subclasses to WEBKIT_DEFINE_TYPE
https://bugs.webkit.org/show_bug.cgi?id=204673

Patch by Víctor Manuel Jáquez Leal <[email protected]> on 2020-09-07
Reviewed by Philippe Normand.

Instead of using G_DEFINE_TYPE macro use rather WEBKIT_DEFINE_TYPE
since it handles private structures.

No new tests since no functional changes.

* platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp:
Renamed the private structure to match with class name so it can
be autogeneterated by the macro.
(_WebKitWebAudioSrcPrivate::_WebKitWebAudioSrcPrivate): add
constructure.
(_WebKitWebAudioSrcPrivate::~_WebKitWebAudioSrcPrivate): add
destructor.
(webkit_web_audio_src_class_init): remove duplicated
initialization.
(webKitWebAudioSrcConstructed): add constructed vmethod to
initalize some private members.
(webKitWebAudioSrcSetProperty): renamed private structure.
(webKitWebAudioSrcGetProperty): ditto.
(webKitWebAudioSrcAllocateBuffersAndRenderAudio): ditto.
(webKitWebAudioSrcLoop): ditto.
* platform/graphics/gstreamer/VideoSinkGStreamer.cpp:
(webkitVideoSinkConstructed): add constructed vmethod to initalize
some private members.
(webkit_video_sink_class_init): remove duplicated initialization.
* platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.cpp:
(webkit_media_clear_key_decrypt_class_init): remove duplicated
initialization.
* platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.cpp:
(webkit_media_common_encryption_decrypt_class_init): remove
duplicated initialization.
(constructed): add constructed vmethod to initalize some private
members.
* platform/graphics/gstreamer/eme/WebKitThunderDecryptorGStreamer.cpp:
(webkit_media_thunder_decrypt_class_init): remove duplicated
initialization.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (266696 => 266697)


--- trunk/Source/WebCore/ChangeLog	2020-09-07 09:54:13 UTC (rev 266696)
+++ trunk/Source/WebCore/ChangeLog	2020-09-07 10:09:16 UTC (rev 266697)
@@ -1,3 +1,46 @@
+2020-09-07  Víctor Manuel Jáquez Leal  <[email protected]>
+
+        [GStreamer] Convert custom GObject subclasses to WEBKIT_DEFINE_TYPE
+        https://bugs.webkit.org/show_bug.cgi?id=204673
+
+        Reviewed by Philippe Normand.
+
+        Instead of using G_DEFINE_TYPE macro use rather WEBKIT_DEFINE_TYPE
+        since it handles private structures.
+
+        No new tests since no functional changes.
+
+        * platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp:
+        Renamed the private structure to match with class name so it can
+        be autogeneterated by the macro.
+        (_WebKitWebAudioSrcPrivate::_WebKitWebAudioSrcPrivate): add
+        constructure.
+        (_WebKitWebAudioSrcPrivate::~_WebKitWebAudioSrcPrivate): add
+        destructor.
+        (webkit_web_audio_src_class_init): remove duplicated
+        initialization.
+        (webKitWebAudioSrcConstructed): add constructed vmethod to
+        initalize some private members.
+        (webKitWebAudioSrcSetProperty): renamed private structure.
+        (webKitWebAudioSrcGetProperty): ditto.
+        (webKitWebAudioSrcAllocateBuffersAndRenderAudio): ditto.
+        (webKitWebAudioSrcLoop): ditto.
+        * platform/graphics/gstreamer/VideoSinkGStreamer.cpp:
+        (webkitVideoSinkConstructed): add constructed vmethod to initalize
+        some private members.
+        (webkit_video_sink_class_init): remove duplicated initialization.
+        * platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.cpp:
+        (webkit_media_clear_key_decrypt_class_init): remove duplicated
+        initialization.
+        * platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.cpp:
+        (webkit_media_common_encryption_decrypt_class_init): remove
+        duplicated initialization.
+        (constructed): add constructed vmethod to initalize some private
+        members.
+        * platform/graphics/gstreamer/eme/WebKitThunderDecryptorGStreamer.cpp:
+        (webkit_media_thunder_decrypt_class_init): remove duplicated
+        initialization.
+
 2020-09-07  Sergio Villar Senin  <[email protected]>
 
         [css-flex] Allow indefinite size flex items to be definite wrt resolving percentages inside them

Modified: trunk/Source/WebCore/platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp (266696 => 266697)


--- trunk/Source/WebCore/platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp	2020-09-07 09:54:13 UTC (rev 266696)
+++ trunk/Source/WebCore/platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp	2020-09-07 10:09:16 UTC (rev 266697)
@@ -30,16 +30,17 @@
 #include <gst/audio/audio-info.h>
 #include <gst/pbutils/missing-plugins.h>
 #include <wtf/glib/GUniquePtr.h>
+#include <wtf/glib/WTFGType.h>
 
 using namespace WebCore;
 
 typedef struct _WebKitWebAudioSrcClass   WebKitWebAudioSrcClass;
-typedef struct _WebKitWebAudioSourcePrivate WebKitWebAudioSourcePrivate;
+typedef struct _WebKitWebAudioSrcPrivate WebKitWebAudioSrcPrivate;
 
 struct _WebKitWebAudioSrc {
     GstBin parent;
 
-    WebKitWebAudioSourcePrivate* priv;
+    WebKitWebAudioSrcPrivate* priv;
 };
 
 struct _WebKitWebAudioSrcClass {
@@ -46,8 +47,12 @@
     GstBinClass parentClass;
 };
 
-#define WEBKIT_WEB_AUDIO_SRC_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), WEBKIT_TYPE_WEBAUDIO_SRC, WebKitWebAudioSourcePrivate))
-struct _WebKitWebAudioSourcePrivate {
+static GstStaticPadTemplate srcTemplate = GST_STATIC_PAD_TEMPLATE("src",
+    GST_PAD_SRC,
+    GST_PAD_ALWAYS,
+    GST_STATIC_CAPS(GST_AUDIO_CAPS_MAKE(GST_AUDIO_NE(F32))));
+
+struct _WebKitWebAudioSrcPrivate {
     gfloat sampleRate;
     AudioBus* bus;
     AudioIOCallback* provider;
@@ -70,6 +75,26 @@
     GRefPtr<GstBufferPool> pool;
 
     bool enableGapBufferSupport;
+
+    _WebKitWebAudioSrcPrivate()
+    {
+        sourcePad = webkitGstGhostPadFromStaticTemplate(&srcTemplate, "src", nullptr);
+
+        provider = nullptr;
+        bus = nullptr;
+
+        g_rec_mutex_init(&mutex);
+
+        // GAP buffer support is enabled only for GStreamer 1.12.5 because of a
+        // memory leak that was fixed in that version.
+        // https://bugzilla.gnome.org/show_bug.cgi?id=793067
+        enableGapBufferSupport = webkitGstCheckVersion(1, 12, 5);
+    }
+
+    ~_WebKitWebAudioSrcPrivate()
+    {
+        g_rec_mutex_clear(&mutex);
+    }
 };
 
 enum {
@@ -79,16 +104,10 @@
     PROP_FRAMES
 };
 
-static GstStaticPadTemplate srcTemplate = GST_STATIC_PAD_TEMPLATE("src",
-    GST_PAD_SRC,
-    GST_PAD_ALWAYS,
-    GST_STATIC_CAPS(GST_AUDIO_CAPS_MAKE(GST_AUDIO_NE(F32))));
-
 GST_DEBUG_CATEGORY_STATIC(webkit_web_audio_src_debug);
 #define GST_CAT_DEFAULT webkit_web_audio_src_debug
 
 static void webKitWebAudioSrcConstructed(GObject*);
-static void webKitWebAudioSrcFinalize(GObject*);
 static void webKitWebAudioSrcSetProperty(GObject*, guint propertyId, const GValue*, GParamSpec*);
 static void webKitWebAudioSrcGetProperty(GObject*, guint propertyId, GValue*, GParamSpec*);
 static GstStateChangeReturn webKitWebAudioSrcChangeState(GstElement*, GstStateChange);
@@ -133,10 +152,7 @@
 }
 
 #define webkit_web_audio_src_parent_class parent_class
-G_DEFINE_TYPE_WITH_CODE(WebKitWebAudioSrc, webkit_web_audio_src, GST_TYPE_BIN, GST_DEBUG_CATEGORY_INIT(webkit_web_audio_src_debug, \
-                            "webkitwebaudiosrc", \
-                            0, \
-                            "webaudiosrc element"));
+WEBKIT_DEFINE_TYPE_WITH_CODE(WebKitWebAudioSrc, webkit_web_audio_src, GST_TYPE_BIN, GST_DEBUG_CATEGORY_INIT(webkit_web_audio_src_debug, "webkitwebaudiosrc", 0, "webaudiosrc element"))
 
 static void webkit_web_audio_src_class_init(WebKitWebAudioSrcClass* webKitWebAudioSrcClass)
 {
@@ -147,7 +163,6 @@
     gst_element_class_set_metadata(elementClass, "WebKit WebAudio source element", "Source", "Handles WebAudio data from WebCore", "Philippe Normand <[email protected]>");
 
     objectClass->constructed = webKitWebAudioSrcConstructed;
-    objectClass->finalize = webKitWebAudioSrcFinalize;
     elementClass->change_state = webKitWebAudioSrcChangeState;
 
     objectClass->set_property = webKitWebAudioSrcSetProperty;
@@ -176,41 +191,23 @@
                                                       "Number of audio frames to pull at each iteration",
                                                       0, G_MAXUINT8, 128, flags));
 
-    g_type_class_add_private(webKitWebAudioSrcClass, sizeof(WebKitWebAudioSourcePrivate));
+    g_type_class_add_private(webKitWebAudioSrcClass, sizeof(WebKitWebAudioSrcPrivate));
 }
 
-static void webkit_web_audio_src_init(WebKitWebAudioSrc* src)
-{
-    WebKitWebAudioSourcePrivate* priv = G_TYPE_INSTANCE_GET_PRIVATE(src, WEBKIT_TYPE_WEB_AUDIO_SRC, WebKitWebAudioSourcePrivate);
-    src->priv = priv;
-    new (priv) WebKitWebAudioSourcePrivate();
-
-    priv->sourcePad = webkitGstGhostPadFromStaticTemplate(&srcTemplate, "src", nullptr);
-    gst_element_add_pad(GST_ELEMENT(src), priv->sourcePad);
-
-    priv->provider = nullptr;
-    priv->bus = nullptr;
-
-    g_rec_mutex_init(&priv->mutex);
-    priv->task = adoptGRef(gst_task_new(reinterpret_cast<GstTaskFunction>(webKitWebAudioSrcLoop), src, nullptr));
-
-    // GAP buffer support is enabled only for GStreamer 1.12.5 because of a
-    // memory leak that was fixed in that version.
-    // https://bugzilla.gnome.org/show_bug.cgi?id=793067
-    priv->enableGapBufferSupport = webkitGstCheckVersion(1, 12, 5);
-
-    gst_task_set_lock(priv->task.get(), &priv->mutex);
-}
-
 static void webKitWebAudioSrcConstructed(GObject* object)
 {
     WebKitWebAudioSrc* src = ""
-    WebKitWebAudioSourcePrivate* priv = src->priv;
+    WebKitWebAudioSrcPrivate* priv = src->priv;
 
     ASSERT(priv->bus);
     ASSERT(priv->provider);
     ASSERT(priv->sampleRate);
 
+    gst_element_add_pad(GST_ELEMENT(src), priv->sourcePad);
+
+    priv->task = adoptGRef(gst_task_new(reinterpret_cast<GstTaskFunction>(webKitWebAudioSrcLoop), src, nullptr));
+    gst_task_set_lock(priv->task.get(), &priv->mutex);
+
     priv->interleave = gst_element_factory_make("audiointerleave", nullptr);
 
     if (!priv->interleave) {
@@ -248,21 +245,10 @@
     gst_ghost_pad_set_target(GST_GHOST_PAD(priv->sourcePad), targetPad.get());
 }
 
-static void webKitWebAudioSrcFinalize(GObject* object)
-{
-    WebKitWebAudioSrc* src = ""
-    WebKitWebAudioSourcePrivate* priv = src->priv;
-
-    g_rec_mutex_clear(&priv->mutex);
-
-    priv->~WebKitWebAudioSourcePrivate();
-    GST_CALL_PARENT(G_OBJECT_CLASS, finalize, ((GObject* )(src)));
-}
-
 static void webKitWebAudioSrcSetProperty(GObject* object, guint propertyId, const GValue* value, GParamSpec* pspec)
 {
     WebKitWebAudioSrc* src = ""
-    WebKitWebAudioSourcePrivate* priv = src->priv;
+    WebKitWebAudioSrcPrivate* priv = src->priv;
 
     switch (propertyId) {
     case PROP_RATE:
@@ -287,7 +273,7 @@
 static void webKitWebAudioSrcGetProperty(GObject* object, guint propertyId, GValue* value, GParamSpec* pspec)
 {
     WebKitWebAudioSrc* src = ""
-    WebKitWebAudioSourcePrivate* priv = src->priv;
+    WebKitWebAudioSrcPrivate* priv = src->priv;
 
     switch (propertyId) {
     case PROP_RATE:
@@ -310,7 +296,7 @@
 
 static Optional<Vector<GRefPtr<GstBuffer>>> webKitWebAudioSrcAllocateBuffersAndRenderAudio(WebKitWebAudioSrc* src)
 {
-    WebKitWebAudioSourcePrivate* priv = src->priv;
+    WebKitWebAudioSrcPrivate* priv = src->priv;
 
     ASSERT(priv->bus);
     ASSERT(priv->provider);
@@ -365,7 +351,7 @@
 
 static void webKitWebAudioSrcLoop(WebKitWebAudioSrc* src)
 {
-    WebKitWebAudioSourcePrivate* priv = src->priv;
+    WebKitWebAudioSrcPrivate* priv = src->priv;
 
     Optional<Vector<GRefPtr<GstBuffer>>> channelBufferList = webKitWebAudioSrcAllocateBuffersAndRenderAudio(src);
     if (!channelBufferList) {

Modified: trunk/Source/WebCore/platform/graphics/gstreamer/VideoSinkGStreamer.cpp (266696 => 266697)


--- trunk/Source/WebCore/platform/graphics/gstreamer/VideoSinkGStreamer.cpp	2020-09-07 09:54:13 UTC (rev 266696)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/VideoSinkGStreamer.cpp	2020-09-07 10:09:16 UTC (rev 266697)
@@ -37,6 +37,7 @@
 #include <gst/video/gstvideometa.h>
 #include <wtf/Condition.h>
 #include <wtf/RunLoop.h>
+#include <wtf/glib/WTFGType.h>
 
 using namespace WebCore;
 
@@ -138,14 +139,11 @@
 };
 
 #define webkit_video_sink_parent_class parent_class
-G_DEFINE_TYPE_WITH_CODE(WebKitVideoSink, webkit_video_sink, GST_TYPE_VIDEO_SINK, GST_DEBUG_CATEGORY_INIT(webkitVideoSinkDebug, "webkitsink", 0, "webkit video sink"));
+WEBKIT_DEFINE_TYPE_WITH_CODE(WebKitVideoSink, webkit_video_sink, GST_TYPE_VIDEO_SINK, GST_DEBUG_CATEGORY_INIT(webkitVideoSinkDebug, "webkitsink", 0, "webkit video sink"))
 
-
-static void webkit_video_sink_init(WebKitVideoSink* sink)
+static void webkitVideoSinkConstructed(GObject* object)
 {
-    sink->priv = G_TYPE_INSTANCE_GET_PRIVATE(sink, WEBKIT_TYPE_VIDEO_SINK, WebKitVideoSinkPrivate);
-    g_object_set(GST_BASE_SINK(sink), "enable-last-sample", FALSE, nullptr);
-    new (sink->priv) WebKitVideoSinkPrivate();
+    g_object_set(GST_BASE_SINK(object), "enable-last-sample", FALSE, nullptr);
 }
 
 static void webkitVideoSinkRepaintRequested(WebKitVideoSink* sink, GstSample* sample)
@@ -177,12 +175,6 @@
     return sink->priv->scheduler.requestRender(sink, buffer) ? GST_FLOW_OK : GST_FLOW_ERROR;
 }
 
-static void webkitVideoSinkFinalize(GObject* object)
-{
-    WEBKIT_VIDEO_SINK(object)->priv->~WebKitVideoSinkPrivate();
-    G_OBJECT_CLASS(parent_class)->finalize(object);
-}
-
 static gboolean webkitVideoSinkUnlock(GstBaseSink* baseSink)
 {
     WebKitVideoSinkPrivate* priv = WEBKIT_VIDEO_SINK(baseSink)->priv;
@@ -287,7 +279,7 @@
 
     g_type_class_add_private(klass, sizeof(WebKitVideoSinkPrivate));
 
-    gobjectClass->finalize = webkitVideoSinkFinalize;
+    gobjectClass->constructed = webkitVideoSinkConstructed;
 
     baseSinkClass->unlock = webkitVideoSinkUnlock;
     baseSinkClass->unlock_stop = webkitVideoSinkUnlockStop;

Modified: trunk/Source/WebCore/platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.cpp (266696 => 266697)


--- trunk/Source/WebCore/platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.cpp	2020-09-07 09:54:13 UTC (rev 266696)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.cpp	2020-09-07 10:09:16 UTC (rev 266697)
@@ -31,6 +31,7 @@
 #include <gcrypt.h>
 #include <gst/base/gstbytereader.h>
 #include <wtf/RunLoop.h>
+#include <wtf/glib/WTFGType.h>
 
 using namespace WebCore;
 
@@ -41,7 +42,6 @@
     RefPtr<CDMProxyClearKey> cdmProxy;
 };
 
-static void finalize(GObject*);
 static const char* protectionSystemId(WebKitMediaCommonEncryptionDecrypt*);
 static bool cdmProxyAttached(WebKitMediaCommonEncryptionDecrypt* self, const RefPtr<CDMProxy>&);
 static bool decrypt(WebKitMediaCommonEncryptionDecrypt*, GstBuffer* iv, GstBuffer* keyid, GstBuffer* sample, unsigned subSamplesCount, GstBuffer* subSamples);
@@ -63,13 +63,10 @@
     GST_STATIC_CAPS("video/x-h264; audio/mpeg; video/x-vp8; video/x-vp9"));
 
 #define webkit_media_clear_key_decrypt_parent_class parent_class
-G_DEFINE_TYPE(WebKitMediaClearKeyDecrypt, webkit_media_clear_key_decrypt, WEBKIT_TYPE_MEDIA_CENC_DECRYPT);
+WEBKIT_DEFINE_TYPE(WebKitMediaClearKeyDecrypt, webkit_media_clear_key_decrypt, WEBKIT_TYPE_MEDIA_CENC_DECRYPT)
 
 static void webkit_media_clear_key_decrypt_class_init(WebKitMediaClearKeyDecryptClass* klass)
 {
-    GObjectClass* gobjectClass = G_OBJECT_CLASS(klass);
-    gobjectClass->finalize = finalize;
-
     GstElementClass* elementClass = GST_ELEMENT_CLASS(klass);
     gst_element_class_add_pad_template(elementClass, gst_static_pad_template_get(&sinkTemplate));
     gst_element_class_add_pad_template(elementClass, gst_static_pad_template_get(&srcTemplate));
@@ -91,22 +88,6 @@
     g_type_class_add_private(klass, sizeof(WebKitMediaClearKeyDecryptPrivate));
 }
 
-static void webkit_media_clear_key_decrypt_init(WebKitMediaClearKeyDecrypt* self)
-{
-    WebKitMediaClearKeyDecryptPrivate* priv = WEBKIT_MEDIA_CK_DECRYPT_GET_PRIVATE(self);
-    self->priv = priv;
-    new (priv) WebKitMediaClearKeyDecryptPrivate();
-}
-
-static void finalize(GObject* object)
-{
-    WebKitMediaClearKeyDecrypt* self = WEBKIT_MEDIA_CK_DECRYPT(object);
-    WebKitMediaClearKeyDecryptPrivate* priv = self->priv;
-    priv->~WebKitMediaClearKeyDecryptPrivate();
-
-    GST_CALL_PARENT(G_OBJECT_CLASS, finalize, (object));
-}
-
 static const char* protectionSystemId(WebKitMediaCommonEncryptionDecrypt*)
 {
     return GStreamerEMEUtilities::s_ClearKeyUUID;

Modified: trunk/Source/WebCore/platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.cpp (266696 => 266697)


--- trunk/Source/WebCore/platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.cpp	2020-09-07 09:54:13 UTC (rev 266696)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.cpp	2020-09-07 10:09:16 UTC (rev 266697)
@@ -32,6 +32,7 @@
 #include <wtf/PrintStream.h>
 #include <wtf/RunLoop.h>
 #include <wtf/Scope.h>
+#include <wtf/glib/WTFGType.h>
 
 using WebCore::CDMProxy;
 
@@ -46,8 +47,8 @@
 
 static constexpr Seconds MaxSecondsToWaitForCDMProxy = 5_s;
 
+static void constructed(GObject*);
 static GstStateChangeReturn changeState(GstElement*, GstStateChange transition);
-static void finalize(GObject*);
 static GstCaps* transformCaps(GstBaseTransform*, GstPadDirection, GstCaps*, GstCaps*);
 static GstFlowReturn transformInPlace(GstBaseTransform*, GstBuffer*);
 static gboolean sinkEventHandler(GstBaseTransform*, GstEvent*);
@@ -57,12 +58,12 @@
 #define GST_CAT_DEFAULT webkit_media_common_encryption_decrypt_debug_category
 
 #define webkit_media_common_encryption_decrypt_parent_class parent_class
-G_DEFINE_TYPE(WebKitMediaCommonEncryptionDecrypt, webkit_media_common_encryption_decrypt, GST_TYPE_BASE_TRANSFORM);
+WEBKIT_DEFINE_TYPE(WebKitMediaCommonEncryptionDecrypt, webkit_media_common_encryption_decrypt, GST_TYPE_BASE_TRANSFORM)
 
 static void webkit_media_common_encryption_decrypt_class_init(WebKitMediaCommonEncryptionDecryptClass* klass)
 {
     GObjectClass* gobjectClass = G_OBJECT_CLASS(klass);
-    gobjectClass->finalize = finalize;
+    gobjectClass->constructed = constructed;
 
     GST_DEBUG_CATEGORY_INIT(webkit_media_common_encryption_decrypt_debug_category,
         "webkitcenc", 0, "Common Encryption base class");
@@ -80,28 +81,15 @@
     g_type_class_add_private(klass, sizeof(WebKitMediaCommonEncryptionDecryptPrivate));
 }
 
-static void webkit_media_common_encryption_decrypt_init(WebKitMediaCommonEncryptionDecrypt* self)
+static void constructed(GObject* object)
 {
-    WebKitMediaCommonEncryptionDecryptPrivate* priv = WEBKIT_MEDIA_CENC_DECRYPT_GET_PRIVATE(self);
+    GstBaseTransform* base = GST_BASE_TRANSFORM(object);
 
-    self->priv = priv;
-    new (priv) WebKitMediaCommonEncryptionDecryptPrivate();
-
-    GstBaseTransform* base = GST_BASE_TRANSFORM(self);
     gst_base_transform_set_in_place(base, TRUE);
     gst_base_transform_set_passthrough(base, FALSE);
     gst_base_transform_set_gap_aware(base, FALSE);
 }
 
-static void finalize(GObject* object)
-{
-    WebKitMediaCommonEncryptionDecrypt* self = WEBKIT_MEDIA_CENC_DECRYPT(object);
-    WebKitMediaCommonEncryptionDecryptPrivate* priv = self->priv;
-
-    priv->~WebKitMediaCommonEncryptionDecryptPrivate();
-    GST_CALL_PARENT(G_OBJECT_CLASS, finalize, (object));
-}
-
 static GstCaps* transformCaps(GstBaseTransform* base, GstPadDirection direction, GstCaps* caps, GstCaps* filter)
 {
     if (direction == GST_PAD_UNKNOWN)

Modified: trunk/Source/WebCore/platform/graphics/gstreamer/eme/WebKitThunderDecryptorGStreamer.cpp (266696 => 266697)


--- trunk/Source/WebCore/platform/graphics/gstreamer/eme/WebKitThunderDecryptorGStreamer.cpp	2020-09-07 09:54:13 UTC (rev 266696)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/eme/WebKitThunderDecryptorGStreamer.cpp	2020-09-07 10:09:16 UTC (rev 266697)
@@ -30,15 +30,14 @@
 #include <gcrypt.h>
 #include <gst/base/gstbytereader.h>
 #include <wtf/RunLoop.h>
+#include <wtf/glib/WTFGType.h>
 
 using namespace WebCore;
 
-#define WEBKIT_MEDIA_THUNDER_DECRYPT_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), WEBKIT_TYPE_MEDIA_THUNDER_DECRYPT, WebKitMediaThunderDecryptPrivate))
 struct _WebKitMediaThunderDecryptPrivate {
     RefPtr<CDMProxyThunder> cdmProxy;
 };
 
-static void finalize(GObject*);
 static const char* protectionSystemId(WebKitMediaCommonEncryptionDecrypt*);
 static bool cdmProxyAttached(WebKitMediaCommonEncryptionDecrypt*, const RefPtr<CDMProxy>&);
 static bool decrypt(WebKitMediaCommonEncryptionDecrypt*, GstBuffer* iv, GstBuffer* keyid, GstBuffer* sample, unsigned subSamplesCount,
@@ -63,7 +62,7 @@
         "video/x-vp9; "));
 
 #define webkit_media_thunder_decrypt_parent_class parent_class
-G_DEFINE_TYPE(WebKitMediaThunderDecrypt, webkit_media_thunder_decrypt, WEBKIT_TYPE_MEDIA_CENC_DECRYPT);
+WEBKIT_DEFINE_TYPE(WebKitMediaThunderDecrypt, webkit_media_thunder_decrypt, WEBKIT_TYPE_MEDIA_CENC_DECRYPT)
 
 static GRefPtr<GstCaps> createSinkPadTemplateCaps()
 {
@@ -92,9 +91,6 @@
 {
     GST_DEBUG_CATEGORY_INIT(webkitMediaThunderDecryptDebugCategory, "webkitthunder", 0, "Thunder decrypt");
 
-    GObjectClass* gobjectClass = G_OBJECT_CLASS(klass);
-    gobjectClass->finalize = finalize;
-
     GstElementClass* elementClass = GST_ELEMENT_CLASS(klass);
     GRefPtr<GstCaps> gstSinkPadTemplateCaps = createSinkPadTemplateCaps();
     gst_element_class_add_pad_template(elementClass, gst_pad_template_new("sink", GST_PAD_SINK, GST_PAD_ALWAYS, gstSinkPadTemplateCaps.get()));
@@ -111,22 +107,6 @@
     g_type_class_add_private(klass, sizeof(WebKitMediaThunderDecryptPrivate));
 }
 
-static void webkit_media_thunder_decrypt_init(WebKitMediaThunderDecrypt* self)
-{
-    WebKitMediaThunderDecryptPrivate* priv = WEBKIT_MEDIA_THUNDER_DECRYPT_GET_PRIVATE(self);
-    self->priv = priv;
-    new (priv) WebKitMediaThunderDecryptPrivate();
-}
-
-static void finalize(GObject* object)
-{
-    WebKitMediaThunderDecrypt* self = WEBKIT_MEDIA_THUNDER_DECRYPT(object);
-    WebKitMediaThunderDecryptPrivate* priv = self->priv;
-    priv->~WebKitMediaThunderDecryptPrivate();
-
-    GST_CALL_PARENT(G_OBJECT_CLASS, finalize, (object));
-}
-
 static const char* protectionSystemId(WebKitMediaCommonEncryptionDecrypt* self)
 {
     WebKitMediaThunderDecryptPrivate* priv = WEBKIT_MEDIA_THUNDER_DECRYPT_GET_PRIVATE(WEBKIT_MEDIA_THUNDER_DECRYPT(self));
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to