[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

commit-queue at webkit.org commit-queue at webkit.org
Wed Dec 22 15:22:03 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 1ebe1006c14d4bed966bb18e202fdfa6308fb101
Author: commit-queue at webkit.org <commit-queue at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Nov 2 01:40:12 2010 +0000

    2010-11-01  Sheriff Bot  <webkit.review.bot at gmail.com>
    
            Unreviewed, rolling out r71080.
            http://trac.webkit.org/changeset/71080
            https://bugs.webkit.org/show_bug.cgi?id=48815
    
            This change caused many crashes on the debug bot. (Requested
            by mrobinson on #webkit).
    
            * platform/network/soup/SocketStreamHandle.h:
            * platform/network/soup/SocketStreamHandleSoup.cpp:
            (WebCore::isActiveHandle):
            (WebCore::deactivateHandle):
            (WebCore::SocketStreamHandle::SocketStreamHandle):
            (WebCore::SocketStreamHandle::connected):
            (WebCore::SocketStreamHandle::readBytes):
            (WebCore::SocketStreamHandle::beginWaitingForSocketWritability):
            (WebCore::connectedCallback):
            (WebCore::readReadyCallback):
            (WebCore::writeReadyCallback):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@71091 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 978095e..c2ab813 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,24 @@
+2010-11-01  Sheriff Bot  <webkit.review.bot at gmail.com>
+
+        Unreviewed, rolling out r71080.
+        http://trac.webkit.org/changeset/71080
+        https://bugs.webkit.org/show_bug.cgi?id=48815
+
+        This change caused many crashes on the debug bot. (Requested
+        by mrobinson on #webkit).
+
+        * platform/network/soup/SocketStreamHandle.h:
+        * platform/network/soup/SocketStreamHandleSoup.cpp:
+        (WebCore::isActiveHandle):
+        (WebCore::deactivateHandle):
+        (WebCore::SocketStreamHandle::SocketStreamHandle):
+        (WebCore::SocketStreamHandle::connected):
+        (WebCore::SocketStreamHandle::readBytes):
+        (WebCore::SocketStreamHandle::beginWaitingForSocketWritability):
+        (WebCore::connectedCallback):
+        (WebCore::readReadyCallback):
+        (WebCore::writeReadyCallback):
+
 2010-11-01  Martin Robinson  <mrobinson at igalia.com>
 
         Reviewed by Xan Lopez.
diff --git a/WebCore/platform/network/soup/SocketStreamHandle.h b/WebCore/platform/network/soup/SocketStreamHandle.h
index 08d2d94..2ba4504 100644
--- a/WebCore/platform/network/soup/SocketStreamHandle.h
+++ b/WebCore/platform/network/soup/SocketStreamHandle.h
@@ -51,7 +51,6 @@ namespace WebCore {
         void connected(GSocketConnection*, GError*);
         void readBytes(signed long, GError*);
         void writeReady();
-        void* id() { return m_id; }
 
     protected:
         virtual int platformSend(const char* data, int length);
@@ -63,7 +62,6 @@ namespace WebCore {
         PlatformRefPtr<GOutputStream> m_outputStream;
         PlatformRefPtr<GSource> m_writeReadySource;
         char* m_readBuffer;
-        void* m_id;
 
         SocketStreamHandle(const KURL&, SocketStreamHandleClient*);
 
diff --git a/WebCore/platform/network/soup/SocketStreamHandleSoup.cpp b/WebCore/platform/network/soup/SocketStreamHandleSoup.cpp
index 2520610..d73b499 100644
--- a/WebCore/platform/network/soup/SocketStreamHandleSoup.cpp
+++ b/WebCore/platform/network/soup/SocketStreamHandleSoup.cpp
@@ -48,33 +48,25 @@
 namespace WebCore {
 
 // These functions immediately call the similarly named SocketStreamHandle methods.
-static void connectedCallback(GSocketClient*, GAsyncResult*, void*);
-static void readReadyCallback(GInputStream*, GAsyncResult*, void*);
-static gboolean writeReadyCallback(GSocket*, GIOCondition, void*);
+static void connectedCallback(GSocketClient*, GAsyncResult*, SocketStreamHandle*);
+static void readReadyCallback(GInputStream*, GAsyncResult*, SocketStreamHandle*);
+static gboolean writeReadyCallback(GSocket*, GIOCondition, SocketStreamHandle*);
 
 // Having a list of active handles means that we do not have to worry about WebCore
 // reference counting in GLib callbacks. Once the handle is off the active handles list
 // we just ignore it in the callback. We avoid a lot of extra checks and tricky
 // situations this way.
-static HashMap<void*, SocketStreamHandle*> gActiveHandles;
-static SocketStreamHandle* getHandleFromId(void* id)
+static Vector<SocketStreamHandle*> gActiveHandles;
+bool isActiveHandle(SocketStreamHandle* handle)
 {
-    if (!gActiveHandles.contains(id))
-        return 0;
-    return gActiveHandles.get(id);
+    return gActiveHandles.find(handle) != notFound;
 }
 
-static void deactivateHandle(SocketStreamHandle* handle)
+void deactivateHandle(SocketStreamHandle* handle)
 {
-    gActiveHandles.remove(handle->id());
-}
-
-static void* activateHandle(SocketStreamHandle* handle)
-{
-    static gint currentHandleId = 0;
-    void* id = GINT_TO_POINTER(currentHandleId++);
-    gActiveHandles.set(id, handle);
-    return id;
+    size_t handleIndex = gActiveHandles.find(handle);
+    if (handleIndex != notFound)
+        gActiveHandles.remove(handleIndex);
 }
 
 SocketStreamHandle::SocketStreamHandle(const KURL& url, SocketStreamHandleClient* client)
@@ -86,10 +78,10 @@ SocketStreamHandle::SocketStreamHandle(const KURL& url, SocketStreamHandleClient
         return;
     unsigned int port = url.hasPort() ? url.port() : 80;
 
-    m_id = activateHandle(this);
+    gActiveHandles.append(this);
     PlatformRefPtr<GSocketClient> socketClient = adoptPlatformRef(g_socket_client_new());
     g_socket_client_connect_to_host_async(socketClient.get(), url.host().utf8().data(), port, 0,
-        reinterpret_cast<GAsyncReadyCallback>(connectedCallback), m_id);
+        reinterpret_cast<GAsyncReadyCallback>(connectedCallback), this);
 }
 
 SocketStreamHandle::~SocketStreamHandle()
@@ -112,7 +104,7 @@ void SocketStreamHandle::connected(GSocketConnection* socketConnection, GError*
 
     m_readBuffer = new char[READ_BUFFER_SIZE];
     g_input_stream_read_async(m_inputStream.get(), m_readBuffer, READ_BUFFER_SIZE, G_PRIORITY_DEFAULT, 0,
-        reinterpret_cast<GAsyncReadyCallback>(readReadyCallback), m_id);
+        reinterpret_cast<GAsyncReadyCallback>(readReadyCallback), this);
 
     // The client can close the handle, potentially removing the last reference.
     RefPtr<SocketStreamHandle> protect(this); 
@@ -139,7 +131,7 @@ void SocketStreamHandle::readBytes(signed long bytesRead, GError* error)
     m_client->didReceiveData(this, m_readBuffer, bytesRead);
     if (m_inputStream) // The client may have closed the connection.
         g_input_stream_read_async(m_inputStream.get(), m_readBuffer, READ_BUFFER_SIZE, G_PRIORITY_DEFAULT, 0,
-            reinterpret_cast<GAsyncReadyCallback>(readReadyCallback), m_id);
+            reinterpret_cast<GAsyncReadyCallback>(readReadyCallback), this);
 }
 
 void SocketStreamHandle::writeReady()
@@ -223,7 +215,7 @@ void SocketStreamHandle::beginWaitingForSocketWritability()
 
     m_writeReadySource = adoptPlatformRef(g_socket_create_source(
         g_socket_connection_get_socket(m_socketConnection.get()), static_cast<GIOCondition>(G_IO_OUT), 0));
-    g_source_set_callback(m_writeReadySource.get(), reinterpret_cast<GSourceFunc>(writeReadyCallback), m_id, 0);
+    g_source_set_callback(m_writeReadySource.get(), reinterpret_cast<GSourceFunc>(writeReadyCallback), this, 0);
     g_source_attach(m_writeReadySource.get(), 0);
 }
 
@@ -236,15 +228,14 @@ void SocketStreamHandle::stopWaitingForSocketWritability()
     m_writeReadySource = 0;
 }
 
-static void connectedCallback(GSocketClient* client, GAsyncResult* result, void* id)
+static void connectedCallback(GSocketClient* client, GAsyncResult* result, SocketStreamHandle* handle)
 {
     // Always finish the connection, even if this SocketStreamHandle was deactivated earlier.
     GOwnPtr<GError> error;
     GSocketConnection* socketConnection = g_socket_client_connect_to_host_finish(client, result, &error.outPtr());
 
     // The SocketStreamHandle has been deactivated, so just close the connection, ignoring errors.
-    SocketStreamHandle* handle = getHandleFromId(id);
-    if (!handle) {
+    if (!isActiveHandle(handle)) {
         g_io_stream_close(G_IO_STREAM(socketConnection), 0, &error.outPtr());
         return;
     }
@@ -252,23 +243,20 @@ static void connectedCallback(GSocketClient* client, GAsyncResult* result, void*
     handle->connected(socketConnection, error.get());
 }
 
-static void readReadyCallback(GInputStream* stream, GAsyncResult* result, void* id)
+static void readReadyCallback(GInputStream* stream, GAsyncResult* result, SocketStreamHandle* handle)
 {
     // Always finish the read, even if this SocketStreamHandle was deactivated earlier.
     GOwnPtr<GError> error;
     gssize bytesRead = g_input_stream_read_finish(stream, result, &error.outPtr());
 
-    SocketStreamHandle* handle = getHandleFromId(id);
-    if (!handle)
+    if (!isActiveHandle(handle))
         return;
-
     handle->readBytes(bytesRead, error.get());
 }
 
-static gboolean writeReadyCallback(GSocket*, GIOCondition condition, void* id)
+static gboolean writeReadyCallback(GSocket*, GIOCondition condition, SocketStreamHandle* handle)
 {
-    SocketStreamHandle* handle = getHandleFromId(id);
-    if (!handle)
+    if (!isActiveHandle(handle))
         return FALSE;
 
     // G_IO_HUP and G_IO_ERR are are always active. See:

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list