Title: [143329] trunk/Source/WebCore
Revision
143329
Author
ser...@webkit.org
Date
2013-02-19 07:16:07 -0800 (Tue, 19 Feb 2013)

Log 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):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (143328 => 143329)


--- trunk/Source/WebCore/ChangeLog	2013-02-19 15:13:42 UTC (rev 143328)
+++ trunk/Source/WebCore/ChangeLog	2013-02-19 15:16:07 UTC (rev 143329)
@@ -1,3 +1,20 @@
+2013-02-19  Sergio Villar Senin  <svil...@igalia.com>
+
+        [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):
+
 2013-02-19  Andrey Adaikin  <aand...@chromium.org>
 
         Web Inspector: [Canvas] use timeline's didBeginFrame for marking frame end calls

Modified: trunk/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp (143328 => 143329)


--- trunk/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp	2013-02-19 15:13:42 UTC (rev 143328)
+++ trunk/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp	2013-02-19 15:16:07 UTC (rev 143329)
@@ -231,7 +231,6 @@
 static void cleanupSoupRequestOperation(ResourceHandle*, bool isDestroying = false);
 static void sendRequestCallback(GObject*, GAsyncResult*, gpointer);
 static void readCallback(GObject*, GAsyncResult*, gpointer);
-static void closeCallback(GObject*, GAsyncResult*, gpointer);
 static gboolean requestTimeoutCallback(void*);
 #if ENABLE(WEB_TIMING)
 static int  milisecondsSinceRequest(double requestTime);
@@ -499,20 +498,6 @@
     handle->sendPendingRequest();
 }
 
-static void redirectCloseCallback(GObject*, GAsyncResult* result, gpointer data)
-{
-    RefPtr<ResourceHandle> handle = static_cast<ResourceHandle*>(data);
-
-    if (handle->cancelledOrClientless()) {
-        cleanupSoupRequestOperation(handle.get());
-        return;
-    }
-
-    ResourceHandleInternal* d = handle->getInternal();
-    g_input_stream_close_finish(d->m_inputStream.get(), result, 0);
-    doRedirect(handle.get());
-}
-
 static void redirectSkipCallback(GObject*, GAsyncResult* asyncResult, gpointer data)
 {
     RefPtr<ResourceHandle> handle = static_cast<ResourceHandle*>(data);
@@ -538,7 +523,8 @@
         return;
     }
 
-    g_input_stream_close_async(d->m_inputStream.get(), G_PRIORITY_DEFAULT, 0, redirectCloseCallback, handle.get());
+    g_input_stream_close(d->m_inputStream.get(), 0, 0);
+    doRedirect(handle.get());
 }
 
 static void wroteBodyDataCallback(SoupMessage*, SoupBuffer* buffer, gpointer data)
@@ -1305,19 +1291,6 @@
     syncLoader.run();
 }
 
-static void closeCallback(GObject*, GAsyncResult* res, gpointer data)
-{
-    RefPtr<ResourceHandle> handle = static_cast<ResourceHandle*>(data);
-    ResourceHandleInternal* d = handle->getInternal();
-
-    g_input_stream_close_finish(d->m_inputStream.get(), res, 0);
-
-    if (handle->client() && loadingSynchronousRequest)
-        handle->client()->didFinishLoading(handle.get(), 0);
-
-    cleanupSoupRequestOperation(handle.get());
-}
-
 static void readCallback(GObject*, GAsyncResult* asyncResult, gpointer data)
 {
     RefPtr<ResourceHandle> handle = static_cast<ResourceHandle*>(data);
@@ -1351,16 +1324,10 @@
             return;
         }
 
-        // We inform WebCore of load completion now instead of waiting for the input
-        // stream to close because the input stream is closed asynchronously. If this
-        // is a synchronous request, we wait until the closeCallback, because we don't
-        // want to halt the internal main loop before the input stream closes.
-        if (handle->client() && !loadingSynchronousRequest) {
-            handle->client()->didFinishLoading(handle.get(), 0);
-            handle->setClient(0); // Unset the client so that we do not try to access th
-                                  // client in the closeCallback.
-        }
-        g_input_stream_close_async(d->m_inputStream.get(), G_PRIORITY_DEFAULT, 0, closeCallback, handle.get());
+        g_input_stream_close(d->m_inputStream.get(), 0, 0);
+
+        handle->client()->didFinishLoading(handle.get(), 0);
+        cleanupSoupRequestOperation(handle.get());
         return;
     }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to