Bug 97583

Summary: [GTK][EFL] Disk cache is never dumped to disk in WebKit2
Product: WebKit Reporter: Carlos Garcia Campos <cgarcia>
Component: WebKit2Assignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: cdumez, danw, gyuyoung.kim, mrobinson, rakuco, svillar, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: PC   
OS: Linux   
Bug Depends on: 97580    
Bug Blocks:    
Attachments:
Description Flags
Patch mrobinson: review+

Description Carlos Garcia Campos 2012-09-25 11:27:09 PDT
The problem is that WebProcess::platformTerminate(), where the cache is currently dumped, is not always called for the reasons explained here https://bugs.webkit.org/show_bug.cgi?id=94783. The cache is created and loaded in the main() so it can also be flushed and dumped there, so that we also make sure it's always called when the process finishes normally when the mina loop quits.
Comment 1 Carlos Garcia Campos 2012-09-25 11:30:29 PDT
Created attachment 165647 [details]
Patch
Comment 2 Martin Robinson 2012-09-25 11:35:04 PDT
Comment on attachment 165647 [details]
Patch

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

> Source/WebKit2/WebProcess/efl/WebProcessMainEfl.cpp:107
> +    soup_cache_flush(soupCache);
> +    soup_cache_dump(soupCache);
> +    g_object_unref(soupCache);
> +

I'm surprised that g_object_unref doesn't flush and dump the cache as a side-effect. Maybe Dan or Sergio can comment on that? If that's the case, we can just call g_object_unref here.

> Source/WebKit2/WebProcess/gtk/WebProcessMainGtk.cpp:90
> +    soup_cache_flush(soupCache.get());
> +    soup_cache_dump(soupCache.get());
> +

Assuming that the soup cache destructor takes care of this, this could just become:

soupCache = nullptr;

And with a comment explaining why it's important to do that.
Comment 3 Carlos Garcia Campos 2012-09-25 11:39:48 PDT
(In reply to comment #2)
> (From update of attachment 165647 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=165647&action=review
> 
> > Source/WebKit2/WebProcess/efl/WebProcessMainEfl.cpp:107
> > +    soup_cache_flush(soupCache);
> > +    soup_cache_dump(soupCache);
> > +    g_object_unref(soupCache);
> > +
> 
> I'm surprised that g_object_unref doesn't flush and dump the cache as a side-effect. Maybe Dan or Sergio can comment on that? If that's the case, we can just call g_object_unref here.

No, finalize() only frees the internal hash table, but the cache needs to be flushed and dumped manually. Serio told me it's expected to be done when the process finishes and the cache is not going to be used more, because there isn't a way to block the cache while flush/dump.
Comment 4 Carlos Garcia Campos 2012-09-25 12:30:09 PDT
Committed r129541: <http://trac.webkit.org/changeset/129541>