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.
Created attachment 188548 [details] Patch
Comment on attachment 188548 [details] Patch LGTM
Martin, kov, could one of you please take a quick look before we land?
Comment on attachment 188548 [details] Patch Clearing flags on attachment: 188548 Committed r143009: <http://trac.webkit.org/changeset/143009>
All reviewed patches have been landed. Closing bug.