RESOLVED FIXED 44158
[soup] implement ResourceHandle::platformSetDefersLoading
https://bugs.webkit.org/show_bug.cgi?id=44158
Summary [soup] implement ResourceHandle::platformSetDefersLoading
Philippe Normand
Reported 2010-08-18 02:14:59 PDT
as in subject, using soup_session_pause_message and soup_session_unpause_message
Attachments
proposed patch (1.71 KB, patch)
2010-08-18 03:19 PDT, Philippe Normand
gustavo: review-
proposed patch (2.07 KB, patch)
2010-08-23 05:08 PDT, Philippe Normand
no flags
proposed patch (2.24 KB, patch)
2010-08-30 08:38 PDT, Philippe Normand
no flags
updated patch (3.04 KB, patch)
2010-10-19 09:01 PDT, Philippe Normand
no flags
updated patch (3.00 KB, patch)
2010-10-19 09:07 PDT, Philippe Normand
mrobinson: review-
updated patch (3.41 KB, patch)
2010-11-23 08:17 PST, Philippe Normand
mrobinson: review+
updated patch (4.00 KB, patch)
2010-12-06 03:38 PST, Philippe Normand
mrobinson: review+
Philippe Normand
Comment 1 2010-08-18 03:19:25 PDT
Created attachment 64680 [details] proposed patch
Gustavo Noronha (kov)
Comment 2 2010-08-18 10:06:37 PDT
Comment on attachment 64680 [details] proposed patch I think this is a good thing to have, since other platforms support it, but do we have an idea of what this gains us? Is there a way to test it? It looks like we want to also check whether the message should start deferred: the constructor has a boolean: ResourceHandle(const ResourceRequest&, ResourceHandleClient*, bool defersLoading, bool shouldContentSniff);. Mac checks m_defersLoading when a new message is queued, and pauses it, it seems. I'll say r- for the lack of checking if we should start deferred, but it would be great if we could know why we are implementing this before we do.
Martin Robinson
Comment 3 2010-08-18 10:11:54 PDT
A quick grep shows that this is used throughout WebCore including extensively in PluginStream code to avoid bugs with plugins. It will also soon be used to pause/resume the download in WebKitWebSourceGStreamer.
Martin Robinson
Comment 4 2010-08-18 10:12:58 PDT
I should also mention that I originally suggested to pnormand that he use this instead of reimplementing the functionality behind #ifdefs in https://bugs.webkit.org/show_bug.cgi?id=41512 .
Philippe Normand
Comment 5 2010-08-20 04:48:18 PDT
Oh right, I forgot about this one. Not sure I have time today but monday for sure I will revise the patch. Thanks kov for this first look at the code.
Philippe Normand
Comment 6 2010-08-23 05:08:38 PDT
Created attachment 65105 [details] proposed patch About a test that would cover this I was thinking that maybe bug 42152 could be a good candidate but not sure yet. Opinions?
Martin Robinson
Comment 7 2010-08-23 08:39:36 PDT
Yes, that's an excellent idea. If you implement those things, pass the test and then add them to this patch I will r+ it. Thanks!
Philippe Normand
Comment 8 2010-08-25 23:41:49 PDT
(In reply to comment #7) > Yes, that's an excellent idea. If you implement those things, pass the test and then add them to this patch I will r+ it. Thanks! Filed a patch there but I only had to add the required DRT stuff to make the test pass, so not sure anymore it is a good test to test this patch ;)
Philippe Normand
Comment 9 2010-08-30 08:38:24 PDT
Created attachment 65917 [details] proposed patch Added a check for d->m_msg before using it and a note about GIO
Philippe Normand
Comment 10 2010-08-30 09:35:11 PDT
The WebCore/manual-tests/xhr-failure-behind-alert.html test triggers the platformSetDefersLoading() code path but in that case d->m_msg is NULL because no connection to the server was made (because none is running at 127.0.0.1:7 ...) ;)
Dan Winship
Comment 11 2010-08-30 11:35:23 PDT
Comment on attachment 65917 [details] proposed patch > soup_session_queue_message(session, d->m_msg, finishedCallback, handle); > > + if (d->m_defersLoading) > + soup_session_pause_message(session, d->m_msg); This won't work; pause/unpause are sort of lame, and only work once I/O has actually started (eg, after the message has been assigned to a connection). If you want the message to be deferred right away, you need to just not queue it.
Philippe Normand
Comment 12 2010-08-31 01:56:21 PDT
Comment on attachment 65917 [details] proposed patch Unmarking for review, I think it'd be better to wait the patch from bug 44261 to land so we can implement a better patch for this bug.
Philippe Normand
Comment 13 2010-10-19 09:01:56 PDT
Created attachment 71174 [details] updated patch As Dan suggested, in startHttp I avoid sending the requested if it's initially deferred.
Philippe Normand
Comment 14 2010-10-19 09:07:59 PDT
Created attachment 71176 [details] updated patch
Martin Robinson
Comment 15 2010-10-19 09:48:32 PDT
Comment on attachment 71176 [details] updated patch View in context: https://bugs.webkit.org/attachment.cgi?id=71176&action=review > WebCore/platform/network/soup/ResourceHandleSoup.cpp:739 > + // Only supported for http(s) transfers. Something similar would > + // probably be needed for data transfers done with GIO. This comment is inaccurate now that data URLs are handled by soup, I think. :) > WebCore/platform/network/soup/ResourceHandleSoup.cpp:746 > + else > + soup_session_unpause_message(defaultSession(), d->m_soupMessage.get()); I think this presents a problem. The time between the creation of m_soupRequest and m_soupMessage is an asynchronous call. If setDefersLoading(...) was called while that call was in progress, the message would not be paused properly. Perhaps there should be a companion call to soup_session_pause_message if the message is m_defersLoading is true in sendRequestCallback.
Philippe Normand
Comment 16 2010-10-20 01:26:11 PDT
(In reply to comment #15) > (From update of attachment 71176 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=71176&action=review > > > WebCore/platform/network/soup/ResourceHandleSoup.cpp:739 > > + // Only supported for http(s) transfers. Something similar would > > + // probably be needed for data transfers done with GIO. > > This comment is inaccurate now that data URLs are handled by soup, I think. :) > Well I think it's still accurate ;) m_soupMessage is created only in startHttp(). startData and the data uri loading doesn't use it, afaics. > > WebCore/platform/network/soup/ResourceHandleSoup.cpp:746 > > + else > > + soup_session_unpause_message(defaultSession(), d->m_soupMessage.get()); > > I think this presents a problem. The time between the creation of m_soupRequest and m_soupMessage is an asynchronous call. If setDefersLoading(...) was called while that call was in progress, the message would not be paused properly. Perhaps there should be a companion call to soup_session_pause_message if the message is m_defersLoading is true in sendRequestCallback. Hum, that's right indeed. Will send a new patch, thanks for reviewing :)
Martin Robinson
Comment 17 2010-10-21 18:00:01 PDT
This should be fixed since r67722. Closing.
Philippe Normand
Comment 18 2010-10-21 23:42:54 PDT
How come a style bot commit have fixed this bug?
Martin Robinson
Comment 19 2010-10-22 08:54:50 PDT
(In reply to comment #18) > How come a style bot commit have fixed this bug? Sorry, wrong bug.
Philippe Normand
Comment 20 2010-11-23 08:17:09 PST
Created attachment 74669 [details] updated patch
Martin Robinson
Comment 21 2010-11-23 08:36:38 PST
Comment on attachment 74669 [details] updated patch Great.
Philippe Normand
Comment 22 2010-11-24 00:26:38 PST
Philippe Normand
Comment 23 2010-11-24 01:21:21 PST
This patch broke the build (yes I checked here before landing :/). Rollout is in progress, see bug 50009
WebKit Review Bot
Comment 24 2010-11-24 01:32:56 PST
http://trac.webkit.org/changeset/72647 might have broken GTK Linux 32-bit Release
Philippe Normand
Comment 25 2010-12-06 03:38:36 PST
Created attachment 75664 [details] updated patch The tests were failing because loadResourceSynchronously() was creating a deferred ResourceHandle.
Martin Robinson
Comment 26 2010-12-06 04:25:16 PST
Comment on attachment 75664 [details] updated patch Nice catch.
Philippe Normand
Comment 27 2010-12-06 04:32:06 PST
Note You need to log in before you can comment on or make changes to this bug.