Bug 109931

Summary: [Soup] Leverage new soup_cookie_jar_get_cookie_list() API
Product: WebKit Reporter: Chris Dumez <cdumez>
Component: WebCore Misc.Assignee: Chris Dumez <cdumez>
Severity: Normal CC: gustavo, laszlo.gombos, mrobinson, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
URL: http://developer.gnome.org/libsoup/stable/SoupCookieJar.html#soup-cookie-jar-get-cookie-list
Description Flags
Patch none

Description Chris Dumez 2013-02-15 05:49:38 PST
In several cases, the CookieJarSoup implementation retrieves / copies ALL the cookies using soup_cookie_jar_all_cookies() and then uses soup_cookie_applies_to_uri() to filter out cookies it is not interested in. This is inefficient.

In libsoup 2.40, soup_cookie_jar_get_cookie_list(SoupCookieJar *jar, SoupURI *uri, gboolean for_http) was introduced to retrieve only the cookies that apply to a given URI. We should leverage this new API as it would be much more efficient.

libsoup internally stores cookies in a hash table using the host name as key. Therefore, it can retrieve the cookies for a given hostname in O(1). It still iterates over the list of cookies and calls soup_cookie_applies_to_uri() to do further filtering. However, it will iterate over a lot less cookies and it will NOT copy cookies we are not interested in.
Comment 1 Chris Dumez 2013-02-15 05:55:58 PST
Created attachment 188548 [details]
Comment 2 Kenneth Rohde Christiansen 2013-02-15 06:00:57 PST
Comment on attachment 188548 [details]

Comment 3 Chris Dumez 2013-02-15 06:13:33 PST
Martin, kov, could one of you please take a quick look before we land?
Comment 4 WebKit Review Bot 2013-02-15 09:11:28 PST
Comment on attachment 188548 [details]

Clearing flags on attachment: 188548

Committed r143009: <http://trac.webkit.org/changeset/143009>
Comment 5 WebKit Review Bot 2013-02-15 09:11:32 PST
All reviewed patches have been landed.  Closing bug.