Unreviewed, rolling out r140420.
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 22 Jan 2013 16:05:39 +0000 (16:05 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 22 Jan 2013 16:05:39 +0000 (16:05 +0000)
http://trac.webkit.org/changeset/140420
https://bugs.webkit.org/show_bug.cgi?id=107557

Still causes crashes (EFL this time) (Requested by kov on
#webkit).

Patch by Sheriff Bot <webkit.review.bot@gmail.com> on 2013-01-22

* platform/graphics/gstreamer/GStreamerVersioning.cpp:
* platform/graphics/gstreamer/GStreamerVersioning.h:
* platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
(StreamingClient):
(_WebKitWebSrcPrivate):
(webKitWebSrcFinalize):
(webKitWebSrcStop):
(StreamingClient::didReceiveData):
* platform/network/ResourceHandleClient.h:
(ResourceHandleClient):
* platform/network/ResourceHandleInternal.h:
(WebCore::ResourceHandleInternal::ResourceHandleInternal):
(ResourceHandleInternal):
* platform/network/soup/ResourceHandleSoup.cpp:
(WebCore::cleanupSoupRequestOperation):
(WebCore::nextMultipartResponsePartCallback):
(WebCore::sendRequestCallback):
(WebCore::readCallback):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@140425 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/gstreamer/GStreamerVersioning.cpp
Source/WebCore/platform/graphics/gstreamer/GStreamerVersioning.h
Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp
Source/WebCore/platform/network/ResourceHandleClient.h
Source/WebCore/platform/network/ResourceHandleInternal.h
Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp

index 692ba4b..38a27d0 100644 (file)
@@ -1,3 +1,31 @@
+2013-01-22  Sheriff Bot  <webkit.review.bot@gmail.com>
+
+        Unreviewed, rolling out r140420.
+        http://trac.webkit.org/changeset/140420
+        https://bugs.webkit.org/show_bug.cgi?id=107557
+
+        Still causes crashes (EFL this time) (Requested by kov on
+        #webkit).
+
+        * platform/graphics/gstreamer/GStreamerVersioning.cpp:
+        * platform/graphics/gstreamer/GStreamerVersioning.h:
+        * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
+        (StreamingClient):
+        (_WebKitWebSrcPrivate):
+        (webKitWebSrcFinalize):
+        (webKitWebSrcStop):
+        (StreamingClient::didReceiveData):
+        * platform/network/ResourceHandleClient.h:
+        (ResourceHandleClient):
+        * platform/network/ResourceHandleInternal.h:
+        (WebCore::ResourceHandleInternal::ResourceHandleInternal):
+        (ResourceHandleInternal):
+        * platform/network/soup/ResourceHandleSoup.cpp:
+        (WebCore::cleanupSoupRequestOperation):
+        (WebCore::nextMultipartResponsePartCallback):
+        (WebCore::sendRequestCallback):
+        (WebCore::readCallback):
+
 2013-01-22  Allan Sandfeld Jensen  <allan.jensen@digia.com>
 
         [Qt] Crash in PasteboardQt.cpp Pasteboard::writeSelection
index 2802894..340a645 100644 (file)
@@ -1,6 +1,5 @@
 /*
  * Copyright (C) 2012 Igalia, S.L.
- * Copyright (C) 2013 Collabora Ltd.
  *
  *  This library is free software; you can redistribute it and/or
  *  modify it under the terms of the GNU Library General Public
 #include <gst/audio/multichannel.h>
 #endif
 
-#ifdef GST_API_VERSION_1
-const char* webkitGstMapInfoQuarkString = "webkit-gst-map-info";
-#endif
-
 void webkitGstObjectRefSink(GstObject* gstObject)
 {
 #ifdef GST_API_VERSION_1
@@ -126,75 +121,6 @@ GstBuffer* createGstBuffer(GstBuffer* buffer)
     return newBuffer;
 }
 
-GstBuffer* createGstBufferForData(const char* data, int length)
-{
-    GstBuffer* buffer = gst_buffer_new_and_alloc(length);
-
-#ifdef GST_API_VERSION_1
-    gst_buffer_fill(buffer, 0, data, length);
-#else
-    memcpy(GST_BUFFER_DATA(buffer), data, length);
-#endif
-
-    return buffer;
-}
-
-int getGstBufferSize(GstBuffer* buffer)
-{
-#ifdef GST_API_VERSION_1
-    return gst_buffer_get_size(buffer);
-#else
-    return GST_BUFFER_SIZE(buffer);
-#endif
-}
-
-void setGstBufferSize(GstBuffer* buffer, int newSize)
-{
-#ifdef GST_API_VERSION_1
-    gst_buffer_set_size(buffer, static_cast<gssize>(newSize));
-#else
-    GST_BUFFER_SIZE(buffer) = static_cast<gsize>(newSize);
-#endif
-}
-
-char* getGstBufferDataPointer(GstBuffer* buffer)
-{
-#ifdef GST_API_VERSION_1
-    GstMiniObject* miniObject = reinterpret_cast<GstMiniObject*>(buffer);
-    GstMapInfo* mapInfo = static_cast<GstMapInfo*>(gst_mini_object_get_qdata(miniObject, g_quark_from_static_string(webkitGstMapInfoQuarkString)));
-    return reinterpret_cast<char*>(mapInfo->data);
-#else
-    return reinterpret_cast<char*>(GST_BUFFER_DATA(buffer));
-#endif
-}
-
-#ifdef GST_API_VERSION_1
-void mapGstBuffer(GstBuffer* buffer)
-{
-    GstMapInfo* mapInfo = g_slice_new(GstMapInfo);
-    if (!gst_buffer_map(buffer, mapInfo, GST_MAP_WRITE)) {
-        g_slice_free(GstMapInfo, mapInfo);
-        gst_buffer_unref(buffer);
-        return;
-    }
-
-    GstMiniObject* miniObject = reinterpret_cast<GstMiniObject*>(buffer);
-    gst_mini_object_set_qdata(miniObject, g_quark_from_static_string(webkitGstMapInfoQuarkString), mapInfo, 0);
-}
-
-void unmapGstBuffer(GstBuffer* buffer)
-{
-    GstMiniObject* miniObject = reinterpret_cast<GstMiniObject*>(buffer);
-    GstMapInfo* mapInfo = static_cast<GstMapInfo*>(gst_mini_object_steal_qdata(miniObject, g_quark_from_static_string(webkitGstMapInfoQuarkString)));
-
-    if (!mapInfo)
-        return;
-
-    gst_buffer_unmap(buffer, mapInfo);
-    g_slice_free(GstMapInfo, mapInfo);
-}
-#endif
-
 void setGstElementClassMetadata(GstElementClass* elementClass, const char* name, const char* longName, const char* description, const char* author)
 {
 #ifdef GST_API_VERSION_1
index 4f43e67..23c3467 100644 (file)
@@ -36,14 +36,6 @@ GRefPtr<GstCaps> webkitGstGetPadCaps(GstPad*);
 bool getVideoSizeAndFormatFromCaps(GstCaps*, WebCore::IntSize&, GstVideoFormat&, int& pixelAspectRatioNumerator, int& pixelAspectRatioDenominator, int& stride);
 #endif
 GstBuffer* createGstBuffer(GstBuffer*);
-GstBuffer* createGstBufferForData(const char* data, int length);
-int getGstBufferSize(GstBuffer*);
-void setGstBufferSize(GstBuffer*, int newSize);
-char* getGstBufferDataPointer(GstBuffer*);
-#ifdef GST_API_VERSION_1
-void mapGstBuffer(GstBuffer*);
-void unmapGstBuffer(GstBuffer*);
-#endif
 void setGstElementClassMetadata(GstElementClass*, const char* name, const char* longName, const char* description, const char* author);
 bool gstObjectIsFloating(GstObject*);
 void notifyGstTagsOnPad(GstElement*, GstPad*, GstTagList*);
index 52b0e72..f804d1f 100644 (file)
@@ -1,6 +1,5 @@
 /*
  *  Copyright (C) 2009, 2010 Sebastian Dröge <sebastian.droege@collabora.co.uk>
- *  Copyright (C) 2013 Collabora Ltd.
  *
  *  This library is free software; you can redistribute it and/or
  *  modify it under the terms of the GNU Lesser General Public
 #include "ResourceHandleInternal.h"
 #include "ResourceRequest.h"
 #include "ResourceResponse.h"
 #include <gst/app/gstappsrc.h>
-#include <gst/gst.h>
 #include <gst/pbutils/missing-plugins.h>
+
 #include <wtf/Noncopyable.h>
 #include <wtf/gobject/GOwnPtr.h>
 #include <wtf/gobject/GRefPtr.h>
@@ -51,9 +51,6 @@ class StreamingClient : public ResourceHandleClient {
 
         virtual void willSendRequest(ResourceHandle*, ResourceRequest&, const ResourceResponse&);
         virtual void didReceiveResponse(ResourceHandle*, const ResourceResponse&);
-
-        virtual char* getBuffer(int, int*);
-
         virtual void didReceiveData(ResourceHandle*, const char*, int, int);
         virtual void didFinishLoading(ResourceHandle*, double /*finishTime*/);
         virtual void didFail(ResourceHandle*, const ResourceError&);
@@ -87,8 +84,6 @@ struct _WebKitWebSrcPrivate {
     guint enoughDataID;
     guint seekID;
 
-    GRefPtr<GstBuffer> buffer;
-
     // icecast stuff
     gboolean iradioMode;
     gchar* iradioName;
@@ -120,7 +115,6 @@ GST_DEBUG_CATEGORY_STATIC(webkit_web_src_debug);
 
 static void webKitWebSrcUriHandlerInit(gpointer gIface, gpointer ifaceData);
 
-static void webKitWebSrcDispose(GObject*);
 static void webKitWebSrcFinalize(GObject*);
 static void webKitWebSrcSetProperty(GObject*, guint propertyID, const GValue*, GParamSpec*);
 static void webKitWebSrcGetProperty(GObject*, guint propertyID, GValue*, GParamSpec*);
@@ -156,7 +150,6 @@ static void webkit_web_src_class_init(WebKitWebSrcClass* klass)
     GObjectClass* oklass = G_OBJECT_CLASS(klass);
     GstElementClass* eklass = GST_ELEMENT_CLASS(klass);
 
-    oklass->dispose = webKitWebSrcDispose;
     oklass->finalize = webKitWebSrcFinalize;
     oklass->set_property = webKitWebSrcSetProperty;
     oklass->get_property = webKitWebSrcGetProperty;
@@ -281,21 +274,6 @@ static void webkit_web_src_init(WebKitWebSrc* src)
     webKitWebSrcStop(src, false);
 }
 
-static void webKitWebSrcDispose(GObject* object)
-{
-    WebKitWebSrc* src = WEBKIT_WEB_SRC(object);
-    WebKitWebSrcPrivate* priv = src->priv;
-
-    if (priv->buffer) {
-#ifdef GST_API_VERSION_1
-        unmapGstBuffer(priv->buffer.get());
-#endif
-        priv->buffer.clear();
-    }
-
-    GST_CALL_PARENT(G_OBJECT_CLASS, dispose, (object));
-}
-
 static void webKitWebSrcFinalize(GObject* object)
 {
     WebKitWebSrc* src = WEBKIT_WEB_SRC(object);
@@ -305,7 +283,7 @@ static void webKitWebSrcFinalize(GObject* object)
 
     g_free(priv->uri);
 
-    GST_CALL_PARENT(G_OBJECT_CLASS, finalize, (object));
+    GST_CALL_PARENT(G_OBJECT_CLASS, finalize, ((GObject* )(src)));
 }
 
 static void webKitWebSrcSetProperty(GObject* object, guint propID, const GValue* value, GParamSpec* pspec)
@@ -376,13 +354,6 @@ static void webKitWebSrcStop(WebKitWebSrc* src, bool seeking)
 
     priv->player = 0;
 
-    if (priv->buffer) {
-#ifdef GST_API_VERSION_1
-        unmapGstBuffer(priv->buffer.get());
-#endif
-        priv->buffer.clear();
-    }
-
     GST_OBJECT_LOCK(src);
     if (priv->needDataID)
         g_source_remove(priv->needDataID);
@@ -885,33 +856,25 @@ void StreamingClient::didReceiveData(ResourceHandle* handle, const char* data, i
 {
     WebKitWebSrcPrivate* priv = m_src->priv;
 
-    GST_LOG_OBJECT(m_src, "Have %d bytes of data", priv->buffer ? getGstBufferSize(priv->buffer.get()) : length);
-
-#ifdef GST_API_VERSION_1
-    if (priv->buffer)
-        unmapGstBuffer(priv->buffer.get());
-#endif
+    GST_LOG_OBJECT(m_src, "Have %d bytes of data", length);
 
     if (priv->seekID || handle != priv->resourceHandle) {
         GST_DEBUG_OBJECT(m_src, "Seek in progress, ignoring data");
-        priv->buffer.clear();
         return;
     }
 
-    ASSERT(!priv->buffer || data == getGstBufferDataPointer(priv->buffer.get()));
+    GstBuffer* buffer = gst_buffer_new_and_alloc(length);
 
-    // Ports using the GStreamer backend but not the soup implementation of ResourceHandle
-    // won't be using buffers provided by this client, the buffer is created here in that case.
-    if (!priv->buffer)
-        priv->buffer = adoptGRef(createGstBufferForData(data, length));
-    else
-        setGstBufferSize(priv->buffer.get(), length);
-
-    GST_BUFFER_OFFSET(priv->buffer.get()) = priv->offset;
+#ifdef GST_API_VERSION_1
+    gst_buffer_fill(buffer, 0, data, length);
+#else
+    memcpy(GST_BUFFER_DATA(buffer), data, length);
+#endif
+    GST_BUFFER_OFFSET(buffer) = priv->offset;
     priv->offset += length;
-    GST_BUFFER_OFFSET_END(priv->buffer.get()) = priv->offset;
+    GST_BUFFER_OFFSET_END(buffer) = priv->offset;
 
-    GstFlowReturn ret = gst_app_src_push_buffer(priv->appsrc, priv->buffer.leakRef());
+    GstFlowReturn ret = gst_app_src_push_buffer(priv->appsrc, buffer);
 #ifdef GST_API_VERSION_1
     if (ret != GST_FLOW_OK && ret != GST_FLOW_EOS)
 #else
@@ -920,24 +883,6 @@ void StreamingClient::didReceiveData(ResourceHandle* handle, const char* data, i
         GST_ELEMENT_ERROR(m_src, CORE, FAILED, (0), (0));
 }
 
-char* StreamingClient::getBuffer(int requestedSize, int* actualSize)
-{
-    WebKitWebSrcPrivate* priv = m_src->priv;
-
-    ASSERT(!priv->buffer);
-
-    GstBuffer* buffer = gst_buffer_new_and_alloc(requestedSize);
-
-#ifdef GST_API_VERSION_1
-    mapGstBuffer(buffer);
-#endif
-
-    priv->buffer = adoptGRef(buffer);
-
-    *actualSize = getGstBufferSize(buffer);
-    return getGstBufferDataPointer(buffer);
-}
-
 void StreamingClient::didFinishLoading(ResourceHandle*, double)
 {
     WebKitWebSrcPrivate* priv = m_src->priv;
index 90e631e..3d55d86 100644 (file)
 #include <CFNetwork/CFURLResponsePriv.h>
 #endif
 
-#if USE(SOUP)
-#include <glib.h>
-#endif
-
 #if PLATFORM(WIN) && USE(CFNETWORK)
 #include <ConditionalMacros.h>
 #endif
@@ -67,19 +63,7 @@ namespace WebCore {
     
     class ResourceHandleClient {
     public:
-#if USE(SOUP)
-        ResourceHandleClient(): m_buffer(0) { }
-
-        virtual ~ResourceHandleClient()
-        {
-            if (m_buffer) {
-                g_free(m_buffer);
-                m_buffer = 0;
-            }
-        }
-#else
         virtual ~ResourceHandleClient() { }
-#endif
 
         // request may be modified
         virtual void willSendRequest(ResourceHandle*, ResourceRequest&, const ResourceResponse& /*redirectResponse*/) { }
@@ -98,18 +82,6 @@ namespace WebCore {
         virtual void didReceiveDataArray(ResourceHandle*, CFArrayRef) { }
 #endif
 
-#if USE(SOUP)
-        virtual char* getBuffer(int requestedLength, int* actualLength)
-        {
-            *actualLength = requestedLength;
-
-            if (!m_buffer)
-                m_buffer = static_cast<char*>(g_malloc(requestedLength));
-
-            return m_buffer;
-        }
-#endif
-
         virtual bool shouldUseCredentialStorage(ResourceHandle*) { return false; }
         virtual void didReceiveAuthenticationChallenge(ResourceHandle*, const AuthenticationChallenge&) { }
         virtual void didCancelAuthenticationChallenge(ResourceHandle*, const AuthenticationChallenge&) { }
@@ -135,11 +107,6 @@ namespace WebCore {
 #if ENABLE(BLOB)
         virtual AsyncFileStream* createAsyncFileStream(FileStreamClient*) { return 0; }
 #endif
-
-#if USE(SOUP)
-private:
-        char* m_buffer;
-#endif
     };
 
 }
index a43afd7..b84956b 100644 (file)
@@ -113,7 +113,6 @@ namespace WebCore {
 #if USE(SOUP)
             , m_cancelled(false)
             , m_buffer(0)
-            , m_bufferSize(0)
             , m_bodySize(0)
             , m_bodyDataSent(0)
             , m_redirectCount(0)
@@ -201,7 +200,6 @@ namespace WebCore {
         GRefPtr<GAsyncResult> m_deferredResult;
         GRefPtr<GSource> m_timeoutSource;
         char* m_buffer;
-        int m_bufferSize;
         unsigned long m_bodySize;
         unsigned long m_bodyDataSent;
         RefPtr<NetworkingContext> m_context;
index be06848..7130946 100644 (file)
@@ -565,8 +565,8 @@ static void cleanupSoupRequestOperation(ResourceHandle* handle, bool isDestroyin
     }
 
     if (d->m_buffer) {
+        g_slice_free1(READ_BUFFER_SIZE, d->m_buffer);
         d->m_buffer = 0;
-        d->m_bufferSize = 0;
     }
 
     if (d->m_timeoutSource) {
@@ -633,17 +633,12 @@ static void nextMultipartResponsePartCallback(GObject* /*source*/, GAsyncResult*
 
     client->didReceiveResponse(handle.get(), d->m_response);
 
-    // didReceiveResponse may cause the client to be changed.
-    client = d->client();
-
     if (d->m_cancelled || !client) {
         cleanupSoupRequestOperation(handle.get());
         return;
     }
 
-    d->m_buffer = client->getBuffer(READ_BUFFER_SIZE, &d->m_bufferSize);
-
-    g_input_stream_read_async(d->m_inputStream.get(), d->m_buffer, d->m_bufferSize,
+    g_input_stream_read_async(d->m_inputStream.get(), d->m_buffer, READ_BUFFER_SIZE,
         G_PRIORITY_DEFAULT, d->m_cancellable.get(), readCallback, handle.get());
 }
 
@@ -673,9 +668,7 @@ static void sendRequestCallback(GObject*, GAsyncResult* result, gpointer data)
         return;
     }
 
-    ASSERT(!d->m_buffer);
-
-    d->m_buffer = client->getBuffer(READ_BUFFER_SIZE, &d->m_bufferSize);
+    d->m_buffer = static_cast<char*>(g_slice_alloc(READ_BUFFER_SIZE));
 
     if (soupMessage) {
         if (SOUP_STATUS_IS_REDIRECTION(soupMessage->status_code) && shouldRedirect(handle.get())) {
@@ -709,10 +702,7 @@ static void sendRequestCallback(GObject*, GAsyncResult* result, gpointer data)
 
     client->didReceiveResponse(handle.get(), d->m_response);
 
-    // didReceiveResponse may cause the client to be changed.
-    client = d->client();
-
-    if (d->m_cancelled || !client) {
+    if (d->m_cancelled) {
         cleanupSoupRequestOperation(handle.get());
         return;
     }
@@ -725,8 +715,7 @@ static void sendRequestCallback(GObject*, GAsyncResult* result, gpointer data)
     }
 
     d->m_inputStream = inputStream;
-
-    g_input_stream_read_async(d->m_inputStream.get(), d->m_buffer, d->m_bufferSize,
+    g_input_stream_read_async(d->m_inputStream.get(), d->m_buffer, READ_BUFFER_SIZE,
                               G_PRIORITY_DEFAULT, d->m_cancellable.get(), readCallback, handle.get());
 }
 
@@ -1379,14 +1368,12 @@ static void readCallback(GObject*, GAsyncResult* asyncResult, gpointer data)
     client->didReceiveData(handle.get(), d->m_buffer, bytesRead, bytesRead);
 
     // didReceiveData may cancel the load, which may release the last reference.
-    if (d->m_cancelled || !handle->client()) {
+    if (d->m_cancelled || !client) {
         cleanupSoupRequestOperation(handle.get());
         return;
     }
 
-    d->m_buffer = client->getBuffer(READ_BUFFER_SIZE, &d->m_bufferSize);
-
-    g_input_stream_read_async(d->m_inputStream.get(), d->m_buffer, d->m_bufferSize, G_PRIORITY_DEFAULT,
+    g_input_stream_read_async(d->m_inputStream.get(), d->m_buffer, READ_BUFFER_SIZE, G_PRIORITY_DEFAULT,
                               d->m_cancellable.get(), readCallback, handle.get());
 }