Changeset 143329 in webkit


Ignore:
Timestamp:
Feb 19, 2013 7:16:07 AM (11 years ago)
Author:
sergio@webkit.org
Message:

[Soup] Use synchronous calls to close completely processed streams
https://bugs.webkit.org/show_bug.cgi?id=107432

Reviewed by Martin Robinson.

There is no need to close already processed streams in asynchronous
calls since they won't block. Using the synchronous call will save
us some code and unnecessary asynchronous burden. This is kind of
a code refactor so no new tests needed.

  • platform/network/soup/ResourceHandleSoup.cpp:

(WebCore):
(WebCore::redirectSkipCallback):
(WebCore::readCallback):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r143328 r143329  
     12013-02-19  Sergio Villar Senin  <svillar@igalia.com>
     2
     3        [Soup] Use synchronous calls to close completely processed streams
     4        https://bugs.webkit.org/show_bug.cgi?id=107432
     5
     6        Reviewed by Martin Robinson.
     7
     8        There is no need to close already processed streams in asynchronous
     9        calls since they won't block. Using the synchronous call will save
     10        us some code and unnecessary asynchronous burden. This is kind of
     11        a code refactor so no new tests needed.
     12
     13        * platform/network/soup/ResourceHandleSoup.cpp:
     14        (WebCore):
     15        (WebCore::redirectSkipCallback):
     16        (WebCore::readCallback):
     17
    1182013-02-19  Andrey Adaikin  <aandrey@chromium.org>
    219
  • trunk/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp

    r141981 r143329  
    232232static void sendRequestCallback(GObject*, GAsyncResult*, gpointer);
    233233static void readCallback(GObject*, GAsyncResult*, gpointer);
    234 static void closeCallback(GObject*, GAsyncResult*, gpointer);
    235234static gboolean requestTimeoutCallback(void*);
    236235#if ENABLE(WEB_TIMING)
     
    500499}
    501500
    502 static void redirectCloseCallback(GObject*, GAsyncResult* result, gpointer data)
    503 {
    504     RefPtr<ResourceHandle> handle = static_cast<ResourceHandle*>(data);
    505 
    506     if (handle->cancelledOrClientless()) {
    507         cleanupSoupRequestOperation(handle.get());
    508         return;
    509     }
    510 
    511     ResourceHandleInternal* d = handle->getInternal();
    512     g_input_stream_close_finish(d->m_inputStream.get(), result, 0);
    513     doRedirect(handle.get());
    514 }
    515 
    516501static void redirectSkipCallback(GObject*, GAsyncResult* asyncResult, gpointer data)
    517502{
     
    539524    }
    540525
    541     g_input_stream_close_async(d->m_inputStream.get(), G_PRIORITY_DEFAULT, 0, redirectCloseCallback, handle.get());
     526    g_input_stream_close(d->m_inputStream.get(), 0, 0);
     527    doRedirect(handle.get());
    542528}
    543529
     
    13061292}
    13071293
    1308 static void closeCallback(GObject*, GAsyncResult* res, gpointer data)
    1309 {
    1310     RefPtr<ResourceHandle> handle = static_cast<ResourceHandle*>(data);
    1311     ResourceHandleInternal* d = handle->getInternal();
    1312 
    1313     g_input_stream_close_finish(d->m_inputStream.get(), res, 0);
    1314 
    1315     if (handle->client() && loadingSynchronousRequest)
    1316         handle->client()->didFinishLoading(handle.get(), 0);
    1317 
    1318     cleanupSoupRequestOperation(handle.get());
    1319 }
    1320 
    13211294static void readCallback(GObject*, GAsyncResult* asyncResult, gpointer data)
    13221295{
     
    13521325        }
    13531326
    1354         // We inform WebCore of load completion now instead of waiting for the input
    1355         // stream to close because the input stream is closed asynchronously. If this
    1356         // is a synchronous request, we wait until the closeCallback, because we don't
    1357         // want to halt the internal main loop before the input stream closes.
    1358         if (handle->client() && !loadingSynchronousRequest) {
    1359             handle->client()->didFinishLoading(handle.get(), 0);
    1360             handle->setClient(0); // Unset the client so that we do not try to access th
    1361                                   // client in the closeCallback.
    1362         }
    1363         g_input_stream_close_async(d->m_inputStream.get(), G_PRIORITY_DEFAULT, 0, closeCallback, handle.get());
     1327        g_input_stream_close(d->m_inputStream.get(), 0, 0);
     1328
     1329        handle->client()->didFinishLoading(handle.get(), 0);
     1330        cleanupSoupRequestOperation(handle.get());
    13641331        return;
    13651332    }
Note: See TracChangeset for help on using the changeset viewer.