Bug 98532 - [Soup] Simplify the way that requests are started
Summary: [Soup] Simplify the way that requests are started
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Platform (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Martin Robinson
URL:
Keywords:
Depends on: 98521
Blocks:
  Show dependency treegraph
 
Reported: 2012-10-05 10:26 PDT by Martin Robinson
Modified: 2012-10-08 17:03 PDT (History)
5 users (show)

See Also:


Attachments
Patch (18.52 KB, patch)
2012-10-06 23:59 PDT, Martin Robinson
no flags Details | Formatted Diff | Diff
Patch (18.52 KB, patch)
2012-10-08 00:01 PDT, Martin Robinson
gustavo: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Robinson 2012-10-05 10:26:44 PDT
Right now there's a bit of duplicated code in the Soup backend that could be eliminated through abstraction. This is part of a larger effort to make the soup backend more hackable.
Comment 1 Martin Robinson 2012-10-06 23:59:24 PDT
Created attachment 167472 [details]
Patch
Comment 2 Martin Robinson 2012-10-08 00:01:56 PDT
Created attachment 167512 [details]
Patch
Comment 3 Gustavo Noronha (kov) 2012-10-08 12:09:51 PDT
Comment on attachment 167512 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=167512&action=review

Looks good, just concerned about the change in behaviour for the ref/deref, and wondering about isDestroying, which seems to always be false.

> Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp:823
> +        d->m_timeoutSource = soup_add_timeout(g_main_context_get_thread_default(),
> +            d->m_firstRequest.timeoutInterval() * 1000, requestTimeoutCallback, this);

This indentation looks correct, but we have some broken-up parameters in this file that align with the first argument (so just after the open paren). The coding style doesn't seem to say anything explicitly, but the one example it has goes with your way here, something to keep in mind for the future I guess.

> Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp:827
> +    // balanced by a deref() in cleanupSoupRequestOperation, which should always run
> +    ref();

This has changed - it will now only ref for requests which are effectively sent, but cleanupSoupRequestOperation calls deref if isDestroying is false, which it seems to always be, from the looks of it?
Comment 4 Martin Robinson 2012-10-08 16:03:15 PDT
(In reply to comment #3)
> (From update of attachment 167512 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=167512&action=review
> 
> Looks good, just concerned about the change in behaviour for the ref/deref, and wondering about isDestroying, which seems to always be false.
> 
> > Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp:823
> > +        d->m_timeoutSource = soup_add_timeout(g_main_context_get_thread_default(),
> > +            d->m_firstRequest.timeoutInterval() * 1000, requestTimeoutCallback, this);
> 
> This indentation looks correct, but we have some broken-up parameters in this file that align with the first argument (so just after the open paren). The coding style doesn't seem to say anything explicitly, but the one example it has goes with your way here, something to keep in mind for the future I guess.

The style bot recently started complaining about indentation that aligns with the parenthesis. This is because Darin Adler said this style isn't acceptable. I find the change to be pretty odd, considering there is so much code where we align the argument, but I'm trying to roll with it. :)

> > Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp:827
> > +    // balanced by a deref() in cleanupSoupRequestOperation, which should always run
> > +    ref();
> 
> This has changed - it will now only ref for requests which are effectively sent, but cleanupSoupRequestOperation calls deref if isDestroying is false, which it seems to always be, from the looks of it?

So cleanupSoupRequestOperation is called with isDestroying == true in ~ResourceHandle. It makes sense that it shouldn't unref the handle when called from the destructor, since the destructor should only be called when the reference count is already zero. From what I can tell, my change shouldn't cause a problem because cleanupSoupRequestOperation should only called if the request is actually sent.
Comment 5 Martin Robinson 2012-10-08 16:12:22 PDT
Committed r130699: <http://trac.webkit.org/changeset/130699>
Comment 6 Laszlo Gombos 2012-10-08 16:52:07 PDT
Debug build fails with the following error:

Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp: In function ‘bool WebCore::createSoupMessageForHandleAndRequest(WebCore::ResourceHandle*, const WebCore::ResourceRequest&)’:

Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp:690:8: error: ‘d’ was not declared in this scope
Comment 7 Martin Robinson 2012-10-08 17:03:34 PDT
Landed a fix here: http://trac.webkit.org/changeset/130704