Commit f878cfce authored by philn@webkit.org's avatar philn@webkit.org

2010-11-23 Philippe Normand <pnormand@igalia.com>

        Reviewed by Martin Robinson.

        [soup] implement ResourceHandle::platformSetDefersLoading
        https://bugs.webkit.org/show_bug.cgi?id=44158

        * platform/network/soup/ResourceHandleSoup.cpp:
        (WebCore::ResourceHandle::platformSetDefersLoading): Implemented
        using the soup_session_{,un}pause_message APIs.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@72647 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent b39daa91
2010-11-23 Philippe Normand <pnormand@igalia.com>
Reviewed by Martin Robinson.
[soup] implement ResourceHandle::platformSetDefersLoading
https://bugs.webkit.org/show_bug.cgi?id=44158
* platform/network/soup/ResourceHandleSoup.cpp:
(WebCore::ResourceHandle::platformSetDefersLoading): Implemented
using the soup_session_{,un}pause_message APIs.
2010-11-22 Abhishek Arya <inferno@chromium.org>
Reviewed by Adam Barth.
......@@ -545,6 +545,9 @@ static void sendRequestCallback(GObject* source, GAsyncResult* res, gpointer use
}
}
if (d->m_defersLoading)
soup_session_pause_message(handle->defaultSession(), d->m_soupMessage.get());
g_input_stream_read_async(d->m_inputStream.get(), d->m_buffer, READ_BUFFER_SIZE,
G_PRIORITY_DEFAULT, d->m_cancellable.get(), readCallback, 0);
}
......@@ -654,8 +657,11 @@ static bool startHttp(ResourceHandle* handle)
if (!soup_message_headers_get_one(soupMessage->request_headers, "Accept"))
soup_message_headers_append(soupMessage->request_headers, "Accept", "*/*");
d->m_cancellable = adoptPlatformRef(g_cancellable_new());
webkit_soup_request_send_async(d->m_soupRequest.get(), d->m_cancellable.get(), sendRequestCallback, 0);
// Send the request only if it's not been explicitely deferred.
if (!d->m_defersLoading) {
d->m_cancellable = adoptPlatformRef(g_cancellable_new());
webkit_soup_request_send_async(d->m_soupRequest.get(), d->m_cancellable.get(), sendRequestCallback, 0);
}
return true;
}
......@@ -728,9 +734,28 @@ bool ResourceHandle::supportsBufferedData()
return false;
}
void ResourceHandle::platformSetDefersLoading(bool)
void ResourceHandle::platformSetDefersLoading(bool defersLoading)
{
notImplemented();
// Initial implementation of this method was required for bug #44157.
if (d->m_cancelled)
return;
if (!defersLoading && !d->m_cancellable && d->m_soupRequest.get()) {
d->m_cancellable = adoptPlatformRef(g_cancellable_new());
webkit_soup_request_send_async(d->m_soupRequest.get(), d->m_cancellable.get(), sendRequestCallback, 0);
return;
}
// Only supported for http(s) transfers. Something similar would
// probably be needed for data transfers done with GIO.
if (!d->m_soupMessage)
return;
if (defersLoading)
soup_session_pause_message(defaultSession(), d->m_soupMessage.get());
else
soup_session_unpause_message(defaultSession(), d->m_soupMessage.get());
}
bool ResourceHandle::loadsBlocked()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment