Bug 111845

Summary: [SOUP] Soup disk cache should respect the diskCacheDirectory from the process initial parameters
Product: WebKit Reporter: Carlos Garcia Campos <cgarcia>
Component: WebKit2Assignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: andersca, ap, benjamin, cdumez, danw, gyuyoung.kim, rakuco, svillar, tmpsantos, webkit.review.bot, xan.lopez
Priority: P2 Keywords: Gtk, Soup
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 111848    
Attachments:
Description Flags
Patch
none
Updated patch andersca: review+

Description Carlos Garcia Campos 2013-03-08 04:28:25 PST
We currently set the disk cache directory in the web process unconditionally in both GTK and EFL.
Comment 1 Carlos Garcia Campos 2013-03-08 04:34:00 PST
Created attachment 192199 [details]
Patch
Comment 2 Carlos Garcia Campos 2013-03-08 04:34:23 PST
Adding WebKit2 owners.
Comment 3 Chris Dumez 2013-03-08 04:43:18 PST
Comment on attachment 192199 [details]
Patch

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

Looks good, thanks.

> Source/WebKit2/WebProcess/soup/WebProcessSoup.cpp:167
> +    ASSERT(!parameters.diskCacheDirectory.isEmpty() && !parameters.diskCacheDirectory.isNull());

The isNull() check is superfluous here as it is already checked inside isEmpty().
Comment 4 Xan Lopez 2013-03-08 04:43:52 PST
Comment on attachment 192199 [details]
Patch

Looks good to me.
Comment 5 Carlos Garcia Campos 2013-03-08 04:47:59 PST
Created attachment 192202 [details]
Updated patch

Removed the redundant isNull from assert and added a check before flushing the cache for the case when the web process finishes too early before the platformInitializeWebProcess is called.
Comment 6 Thiago Marcos P. Santos 2013-03-08 06:30:11 PST
Comment on attachment 192202 [details]
Updated patch

LGTM, thanks!
Comment 7 Benjamin Poulain 2013-03-08 12:46:12 PST
Comment on attachment 192202 [details]
Updated patch

There are two ways to set this: WebContext::platformDefaultDiskCacheDirectory and WKContextSetDiskCacheDirectory.

From a quick look, it looks like we should get rid of platformDefaultDiskCacheDirectory and unify something around WKContextSetDiskCacheDirectory. It is silly to have two path. Any opinion?
Comment 8 Carlos Garcia Campos 2013-03-09 01:07:14 PST
(In reply to comment #7)
> (From update of attachment 192202 [details])
> There are two ways to set this: WebContext::platformDefaultDiskCacheDirectory and WKContextSetDiskCacheDirectory.
> 
> From a quick look, it looks like we should get rid of platformDefaultDiskCacheDirectory and unify something around WKContextSetDiskCacheDirectory. It is silly to have two path. Any opinion?

For me they are not two ways, platformDefaultDiskCacheDirectory() defines the default disk cache directory for the platform. WKContextSetDiskCacheDirectory overrides the default directory. The good thing of having a default disk cache directory defined in the WebContext is that you don't need to explicitly set a disk cache from the API or from apps, unless you want to override the default. Note that platformDefaultDiskCacheDirectory() is private, so it's not supposed to be a way for the API layer to set a disck cache directory, but to define an internal default. All other directories (database, local storage, cookie storage, etc.) use the same approach.
Comment 9 Carlos Garcia Campos 2013-04-11 23:35:47 PDT
ping owners
Comment 10 Carlos Garcia Campos 2013-04-22 08:56:25 PDT
Committed r148886: <http://trac.webkit.org/changeset/148886>