Changeset 71091 in webkit


Ignore:
Timestamp:
Nov 1, 2010 6:40:12 PM (13 years ago)
Author:
commit-queue@webkit.org
Message:

2010-11-01 Sheriff Bot <webkit.review.bot@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):
Location:
trunk/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r71080 r71091  
     12010-11-01  Sheriff Bot  <webkit.review.bot@gmail.com>
     2
     3        Unreviewed, rolling out r71080.
     4        http://trac.webkit.org/changeset/71080
     5        https://bugs.webkit.org/show_bug.cgi?id=48815
     6
     7        This change caused many crashes on the debug bot. (Requested
     8        by mrobinson on #webkit).
     9
     10        * platform/network/soup/SocketStreamHandle.h:
     11        * platform/network/soup/SocketStreamHandleSoup.cpp:
     12        (WebCore::isActiveHandle):
     13        (WebCore::deactivateHandle):
     14        (WebCore::SocketStreamHandle::SocketStreamHandle):
     15        (WebCore::SocketStreamHandle::connected):
     16        (WebCore::SocketStreamHandle::readBytes):
     17        (WebCore::SocketStreamHandle::beginWaitingForSocketWritability):
     18        (WebCore::connectedCallback):
     19        (WebCore::readReadyCallback):
     20        (WebCore::writeReadyCallback):
     21
    1222010-11-01  Martin Robinson  <mrobinson@igalia.com>
    223
  • trunk/WebCore/platform/network/soup/SocketStreamHandle.h

    r71080 r71091  
    5252        void readBytes(signed long, GError*);
    5353        void writeReady();
    54         void* id() { return m_id; }
    5554
    5655    protected:
     
    6463        PlatformRefPtr<GSource> m_writeReadySource;
    6564        char* m_readBuffer;
    66         void* m_id;
    6765
    6866        SocketStreamHandle(const KURL&, SocketStreamHandleClient*);
  • trunk/WebCore/platform/network/soup/SocketStreamHandleSoup.cpp

    r71080 r71091  
    4949
    5050// These functions immediately call the similarly named SocketStreamHandle methods.
    51 static void connectedCallback(GSocketClient*, GAsyncResult*, void*);
    52 static void readReadyCallback(GInputStream*, GAsyncResult*, void*);
    53 static gboolean writeReadyCallback(GSocket*, GIOCondition, void*);
     51static void connectedCallback(GSocketClient*, GAsyncResult*, SocketStreamHandle*);
     52static void readReadyCallback(GInputStream*, GAsyncResult*, SocketStreamHandle*);
     53static gboolean writeReadyCallback(GSocket*, GIOCondition, SocketStreamHandle*);
    5454
    5555// Having a list of active handles means that we do not have to worry about WebCore
     
    5757// we just ignore it in the callback. We avoid a lot of extra checks and tricky
    5858// situations this way.
    59 static HashMap<void*, SocketStreamHandle*> gActiveHandles;
    60 static SocketStreamHandle* getHandleFromId(void* id)
    61 {
    62     if (!gActiveHandles.contains(id))
    63         return 0;
    64     return gActiveHandles.get(id);
    65 }
    66 
    67 static void deactivateHandle(SocketStreamHandle* handle)
    68 {
    69     gActiveHandles.remove(handle->id());
    70 }
    71 
    72 static void* activateHandle(SocketStreamHandle* handle)
    73 {
    74     static gint currentHandleId = 0;
    75     void* id = GINT_TO_POINTER(currentHandleId++);
    76     gActiveHandles.set(id, handle);
    77     return id;
     59static Vector<SocketStreamHandle*> gActiveHandles;
     60bool isActiveHandle(SocketStreamHandle* handle)
     61{
     62    return gActiveHandles.find(handle) != notFound;
     63}
     64
     65void deactivateHandle(SocketStreamHandle* handle)
     66{
     67    size_t handleIndex = gActiveHandles.find(handle);
     68    if (handleIndex != notFound)
     69        gActiveHandles.remove(handleIndex);
    7870}
    7971
     
    8779    unsigned int port = url.hasPort() ? url.port() : 80;
    8880
    89     m_id = activateHandle(this);
     81    gActiveHandles.append(this);
    9082    PlatformRefPtr<GSocketClient> socketClient = adoptPlatformRef(g_socket_client_new());
    9183    g_socket_client_connect_to_host_async(socketClient.get(), url.host().utf8().data(), port, 0,
    92         reinterpret_cast<GAsyncReadyCallback>(connectedCallback), m_id);
     84        reinterpret_cast<GAsyncReadyCallback>(connectedCallback), this);
    9385}
    9486
     
    113105    m_readBuffer = new char[READ_BUFFER_SIZE];
    114106    g_input_stream_read_async(m_inputStream.get(), m_readBuffer, READ_BUFFER_SIZE, G_PRIORITY_DEFAULT, 0,
    115         reinterpret_cast<GAsyncReadyCallback>(readReadyCallback), m_id);
     107        reinterpret_cast<GAsyncReadyCallback>(readReadyCallback), this);
    116108
    117109    // The client can close the handle, potentially removing the last reference.
     
    140132    if (m_inputStream) // The client may have closed the connection.
    141133        g_input_stream_read_async(m_inputStream.get(), m_readBuffer, READ_BUFFER_SIZE, G_PRIORITY_DEFAULT, 0,
    142             reinterpret_cast<GAsyncReadyCallback>(readReadyCallback), m_id);
     134            reinterpret_cast<GAsyncReadyCallback>(readReadyCallback), this);
    143135}
    144136
     
    224216    m_writeReadySource = adoptPlatformRef(g_socket_create_source(
    225217        g_socket_connection_get_socket(m_socketConnection.get()), static_cast<GIOCondition>(G_IO_OUT), 0));
    226     g_source_set_callback(m_writeReadySource.get(), reinterpret_cast<GSourceFunc>(writeReadyCallback), m_id, 0);
     218    g_source_set_callback(m_writeReadySource.get(), reinterpret_cast<GSourceFunc>(writeReadyCallback), this, 0);
    227219    g_source_attach(m_writeReadySource.get(), 0);
    228220}
     
    237229}
    238230
    239 static void connectedCallback(GSocketClient* client, GAsyncResult* result, void* id)
     231static void connectedCallback(GSocketClient* client, GAsyncResult* result, SocketStreamHandle* handle)
    240232{
    241233    // Always finish the connection, even if this SocketStreamHandle was deactivated earlier.
     
    244236
    245237    // The SocketStreamHandle has been deactivated, so just close the connection, ignoring errors.
    246     SocketStreamHandle* handle = getHandleFromId(id);
    247     if (!handle) {
     238    if (!isActiveHandle(handle)) {
    248239        g_io_stream_close(G_IO_STREAM(socketConnection), 0, &error.outPtr());
    249240        return;
     
    253244}
    254245
    255 static void readReadyCallback(GInputStream* stream, GAsyncResult* result, void* id)
     246static void readReadyCallback(GInputStream* stream, GAsyncResult* result, SocketStreamHandle* handle)
    256247{
    257248    // Always finish the read, even if this SocketStreamHandle was deactivated earlier.
     
    259250    gssize bytesRead = g_input_stream_read_finish(stream, result, &error.outPtr());
    260251
    261     SocketStreamHandle* handle = getHandleFromId(id);
    262     if (!handle)
    263         return;
    264 
     252    if (!isActiveHandle(handle))
     253        return;
    265254    handle->readBytes(bytesRead, error.get());
    266255}
    267256
    268 static gboolean writeReadyCallback(GSocket*, GIOCondition condition, void* id)
    269 {
    270     SocketStreamHandle* handle = getHandleFromId(id);
    271     if (!handle)
     257static gboolean writeReadyCallback(GSocket*, GIOCondition condition, SocketStreamHandle* handle)
     258{
     259    if (!isActiveHandle(handle))
    272260        return FALSE;
    273261
Note: See TracChangeset for help on using the changeset viewer.