Diff
Modified: trunk/Source/WebCore/ChangeLog (139883 => 139884)
--- trunk/Source/WebCore/ChangeLog 2013-01-16 16:00:38 UTC (rev 139883)
+++ trunk/Source/WebCore/ChangeLog 2013-01-16 16:26:10 UTC (rev 139884)
@@ -1,3 +1,29 @@
+2013-01-16 Gustavo Noronha Silva <[email protected]>
+
+ [GStreamer][Soup] Let GStreamer provide the buffer data is downloaded to, to avoid copying
+ https://bugs.webkit.org/show_bug.cgi?id=105552
+
+ Reverting 139877. It made a couple of API tests fail.
+
+ * 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-16 Andrey Kosyakov <[email protected]>
Web Inspector: cookies with empty value are parsed incorrectly
Modified: trunk/Source/WebCore/platform/graphics/gstreamer/GStreamerVersioning.cpp (139883 => 139884)
--- trunk/Source/WebCore/platform/graphics/gstreamer/GStreamerVersioning.cpp 2013-01-16 16:00:38 UTC (rev 139883)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/GStreamerVersioning.cpp 2013-01-16 16:26:10 UTC (rev 139884)
@@ -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
@@ -32,10 +31,6 @@
#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,63 +121,6 @@
return newBuffer;
}
-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
- static const char* webkitGstMapInfoQuarkString = "webkit-gst-map-info";
- 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("webkit-gst-map-info"), 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("webkit-gst-map-info")));
-
- 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
Modified: trunk/Source/WebCore/platform/graphics/gstreamer/GStreamerVersioning.h (139883 => 139884)
--- trunk/Source/WebCore/platform/graphics/gstreamer/GStreamerVersioning.h 2013-01-16 16:00:38 UTC (rev 139883)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/GStreamerVersioning.h 2013-01-16 16:26:10 UTC (rev 139884)
@@ -36,13 +36,6 @@
bool getVideoSizeAndFormatFromCaps(GstCaps*, WebCore::IntSize&, GstVideoFormat&, int& pixelAspectRatioNumerator, int& pixelAspectRatioDenominator, int& stride);
#endif
GstBuffer* createGstBuffer(GstBuffer*);
-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*);
Modified: trunk/Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp (139883 => 139884)
--- trunk/Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp 2013-01-16 16:00:38 UTC (rev 139883)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp 2013-01-16 16:26:10 UTC (rev 139884)
@@ -1,6 +1,5 @@
/*
* Copyright (C) 2009, 2010 Sebastian Dröge <[email protected]>
- * 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
@@ -33,9 +32,10 @@
#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 @@
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 @@
guint enoughDataID;
guint seekID;
- GstBuffer* buffer;
-
// icecast stuff
gboolean iradioMode;
gchar* iradioName;
@@ -120,7 +115,6 @@
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 @@
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,22 +274,6 @@
webKitWebSrcStop(src, false);
}
-static void webKitWebSrcDispose(GObject* object)
-{
- WebKitWebSrc* src = ""
- WebKitWebSrcPrivate* priv = src->priv;
-
- if (priv->buffer) {
-#ifdef GST_API_VERSION_1
- unmapGstBuffer(priv->buffer);
-#endif
- gst_object_unref(priv->buffer);
- priv->buffer = 0;
- }
-
- GST_CALL_PARENT(G_OBJECT_CLASS, dispose, (object));
-}
-
static void webKitWebSrcFinalize(GObject* object)
{
WebKitWebSrc* src = ""
@@ -306,7 +283,7 @@
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)
@@ -377,14 +354,6 @@
priv->player = 0;
- if (priv->buffer) {
-#ifdef GST_API_VERSION_1
- unmapGstBuffer(priv->buffer);
-#endif
- gst_object_unref(priv->buffer);
- priv->buffer = 0;
- }
-
GST_OBJECT_LOCK(src);
if (priv->needDataID)
g_source_remove(priv->needDataID);
@@ -887,58 +856,33 @@
{
WebKitWebSrcPrivate* priv = m_src->priv;
- ASSERT(priv->buffer);
- ASSERT(data == getGstBufferDataPointer(priv->buffer));
+ GST_LOG_OBJECT(m_src, "Have %d bytes of data", length);
- GST_LOG_OBJECT(m_src, "Have %d bytes of data", getGstBufferSize(priv->buffer));
-
-#ifdef GST_API_VERSION_1
- unmapGstBuffer(priv->buffer);
-#endif
-
if (priv->seekID || handle != priv->resourceHandle) {
GST_DEBUG_OBJECT(m_src, "Seek in progress, ignoring data");
- gst_buffer_unref(priv->buffer);
- priv->buffer = 0;
return;
}
- // We need to update the buffer's knowledge of how much data it carries.
- setGstBufferSize(priv->buffer, length);
+ GstBuffer* buffer = gst_buffer_new_and_alloc(length);
- GST_BUFFER_OFFSET(priv->buffer) = 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) = priv->offset;
+ GST_BUFFER_OFFSET_END(buffer) = priv->offset;
- GstFlowReturn ret = gst_app_src_push_buffer(priv->appsrc, priv->buffer);
+ 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
if (ret != GST_FLOW_OK && ret != GST_FLOW_UNEXPECTED)
#endif
GST_ELEMENT_ERROR(m_src, CORE, FAILED, (0), (0));
-
- priv->buffer = 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 = buffer;
-
- *actualSize = getGstBufferSize(buffer);
- return getGstBufferDataPointer(buffer);
-}
-
void StreamingClient::didFinishLoading(ResourceHandle*, double)
{
WebKitWebSrcPrivate* priv = m_src->priv;
Modified: trunk/Source/WebCore/platform/network/ResourceHandleClient.h (139883 => 139884)
--- trunk/Source/WebCore/platform/network/ResourceHandleClient.h 2013-01-16 16:00:38 UTC (rev 139883)
+++ trunk/Source/WebCore/platform/network/ResourceHandleClient.h 2013-01-16 16:26:10 UTC (rev 139884)
@@ -35,10 +35,6 @@
#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 @@
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 @@
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 @@
#if ENABLE(BLOB)
virtual AsyncFileStream* createAsyncFileStream(FileStreamClient*) { return 0; }
#endif
-
-#if USE(SOUP)
-private:
- char* m_buffer;
-#endif
};
}
Modified: trunk/Source/WebCore/platform/network/ResourceHandleInternal.h (139883 => 139884)
--- trunk/Source/WebCore/platform/network/ResourceHandleInternal.h 2013-01-16 16:00:38 UTC (rev 139883)
+++ trunk/Source/WebCore/platform/network/ResourceHandleInternal.h 2013-01-16 16:26:10 UTC (rev 139884)
@@ -113,7 +113,6 @@
#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 @@
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;
Modified: trunk/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp (139883 => 139884)
--- trunk/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp 2013-01-16 16:00:38 UTC (rev 139883)
+++ trunk/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp 2013-01-16 16:26:10 UTC (rev 139884)
@@ -560,8 +560,8 @@
}
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,9 +633,7 @@
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());
}
@@ -699,6 +697,8 @@
return;
}
+ d->m_buffer = static_cast<char*>(g_slice_alloc(READ_BUFFER_SIZE));
+
if (soupMessage && d->m_response.isMultipart()) {
d->m_multipartInputStream = adoptGRef(soup_multipart_input_stream_new(soupMessage, inputStream.get()));
soup_multipart_input_stream_next_part_async(d->m_multipartInputStream.get(), G_PRIORITY_DEFAULT,
@@ -707,12 +707,7 @@
}
d->m_inputStream = inputStream;
-
- ASSERT(!d->m_buffer);
-
- 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());
}
@@ -1367,9 +1362,7 @@
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());
}