Bug 58016

Summary: [EFL] Memory cache API
Product: WebKit Reporter: Grzegorz Czajkowski <g.czajkowski>
Component: WebKit EFLAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, gyuyoung.kim, kenneth, l.slachciak, lucas.de.marchi, tonikitoo
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: PC   
OS: Linux   
Attachments:
Description Flags
patch
none
patch
none
reverse logic
tonikitoo: review+
updated patch regarding to Lucas' suggestions
none
updated changelog none

Description Grzegorz Czajkowski 2011-04-07 00:28:32 PDT
Functions are added to public API. They allow:
1) to disable/enable memory cache,
2) to check status of memory cache.
Comment 1 Grzegorz Czajkowski 2011-04-07 00:33:11 PDT
Created attachment 88586 [details]
patch
Comment 2 Grzegorz Czajkowski 2011-04-07 03:29:42 PDT
Created attachment 88604 [details]
patch

ewk_setting_cache_capacity_set is added
Comment 3 Gyuyoung Kim 2011-04-07 23:16:16 PDT
Comment on attachment 88604 [details]
patch

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

> Source/WebKit/efl/ewk/ewk_settings.cpp:352
> +Eina_Bool ewk_settings_cache_disable_set(Eina_Bool set)

I am not sure, but, it seems to me it is clear to use ewk_settings_cache_enable_set() instead of ewk_settings_cache_disable_set()
Comment 4 Grzegorz Czajkowski 2011-04-12 02:40:21 PDT
Created attachment 89181 [details]
reverse logic
Comment 5 Antonio Gomes 2011-04-12 08:38:15 PDT
Comment on attachment 89181 [details]
reverse logic

Please set cq+ when it passes any API review you guys have.
Comment 6 Lucas De Marchi 2011-04-12 12:43:06 PDT
Comment on attachment 89181 [details]
reverse logic

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

> Source/WebKit/efl/ewk/ewk_settings.cpp:349
> + * @param @c EINA_TRUE to enable cache of WebCore , @c EINA_FALSE to disable

@param set...

> Source/WebKit/efl/ewk/ewk_settings.cpp:355
> +    EINA_SAFETY_ON_NULL_RETURN_VAL(cache, EINA_FALSE);

don't bother checking by NULL here. If it was NULL, it would not get to this point.

> Source/WebKit/efl/ewk/ewk_settings.cpp:375
> +    WebCore::MemoryCache* cache = WebCore::memoryCache();
> +    EINA_SAFETY_ON_NULL_RETURN_VAL(cache, EINA_FALSE);

same here
Comment 7 Grzegorz Czajkowski 2011-04-12 23:56:13 PDT
Comment on attachment 89181 [details]
reverse logic

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

>> Source/WebKit/efl/ewk/ewk_settings.cpp:355
>> +    EINA_SAFETY_ON_NULL_RETURN_VAL(cache, EINA_FALSE);
> 
> don't bother checking by NULL here. If it was NULL, it would not get to this point.

Could explain why we don't need to check NULL here, please?
Method memoryCache() is a singleton. It returns a pointer to the instance of WebCore's cache.
We can't trust what a pointer this method will return.
Comment 8 Lucas De Marchi 2011-04-13 05:52:42 PDT
(In reply to comment #7)
> (From update of attachment 89181 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=89181&action=review
> 
> >> Source/WebKit/efl/ewk/ewk_settings.cpp:355
> >> +    EINA_SAFETY_ON_NULL_RETURN_VAL(cache, EINA_FALSE);
> > 
> > don't bother checking by NULL here. If it was NULL, it would not get to this point.
> 
> Could explain why we don't need to check NULL here, please?
> Method memoryCache() is a singleton. It returns a pointer to the instance of WebCore's cache.
> We can't trust what a pointer this method will return.

I'm saying that the only reason this pointer could be NULL is if there was an out-of-memory condition. In that scenario, WebCore would failed to load before this function could ever be called.

But I'm really nitpicking here and this is not so important.
Comment 9 Grzegorz Czajkowski 2011-04-13 06:24:33 PDT
(In reply to comment #8)
> (In reply to comment #7)
> > (From update of attachment 89181 [details] [details])
> > View in context: https://bugs.webkit.org/attachment.cgi?id=89181&action=review
> > 
> > >> Source/WebKit/efl/ewk/ewk_settings.cpp:355
> > >> +    EINA_SAFETY_ON_NULL_RETURN_VAL(cache, EINA_FALSE);
> > > 
> > > don't bother checking by NULL here. If it was NULL, it would not get to this point.
> > 
> > Could explain why we don't need to check NULL here, please?
> > Method memoryCache() is a singleton. It returns a pointer to the instance of WebCore's cache.
> > We can't trust what a pointer this method will return.
> 
> I'm saying that the only reason this pointer could be NULL is if there was an out-of-memory condition. In that scenario, WebCore would failed to load before this function could ever be called.
> 
Yes, I agree with you. But there is possibility to get the cache for instance in ewk function and to set the pointer on NULL, right? I know it's stupid but we can't exclude that case.
> But I'm really nitpicking here and this is not so important.
It's ok :)
Comment 10 Lucas De Marchi 2011-04-13 06:58:08 PDT
(In reply to comment #9)
> > I'm saying that the only reason this pointer could be NULL is if there was an out-of-memory condition. In that scenario, WebCore would failed to load before this function could ever be called.
> > 
> Yes, I agree with you. But there is possibility to get the cache for instance in ewk function and to set the pointer on NULL, right? I know it's stupid but we can't exclude that case.

Wooww... how would that function do that? We are returning a pointer not a pointer to pointer... Even if the stupid ewk function called delete on that pointer, subsequent calls to MemoryCache::memoryCache() would not return NULL.
Comment 11 Grzegorz Czajkowski 2011-04-13 07:16:43 PDT
(In reply to comment #10)
> (In reply to comment #9)
> > > I'm saying that the only reason this pointer could be NULL is if there was an out-of-memory condition. In that scenario, WebCore would failed to load before this function could ever be called.
> > > 
> > Yes, I agree with you. But there is possibility to get the cache for instance in ewk function and to set the pointer on NULL, right? I know it's stupid but we can't exclude that case.
> 
> Wooww... how would that function do that? We are returning a pointer not a pointer to pointer... Even if the stupid ewk function called delete on that pointer, subsequent calls to MemoryCache::memoryCache() would not return NULL.
Ok, I won't say anything about pointers from now ;)
I will remove checking NULL.
Comment 12 Grzegorz Czajkowski 2011-04-13 23:48:51 PDT
Created attachment 89539 [details]
updated patch regarding to Lucas' suggestions

Removed checking NULL in:
 - ewk_settings_cache_enable_get
 - ewk_settings_cache_enable_set
 - ewk_settings_cache_capacity_set

Removed returned Eina_Bool value because it's useless in:
 - ewk_settings_cache_enable_set
 - ewk_settings_cache_capacity_set

Added "set" to doxygen documentation
Comment 13 Gyuyoung Kim 2011-04-13 23:56:55 PDT
I think Antonio already review this patch. If you add Antonio Gomes to reviewer field, demarchi can decide if cq is + or -. Anyway, looks good to me.
Comment 14 Grzegorz Czajkowski 2011-04-14 00:20:39 PDT
Created attachment 89543 [details]
updated changelog

Adder Antonio Gomes to a reviewer list in ChangeLog
Comment 15 Gyuyoung Kim 2011-04-14 00:22:49 PDT
(In reply to comment #13)
> I think Antonio already review this patch. If you add Antonio Gomes to reviewer field, demarchi can decide if cq is + or -. Anyway, looks good to me.

However, your patch is changed considerably. You should request review again.(In reply to comment #13)
> I think Antonio already review this patch. If you add Antonio Gomes to reviewer field, demarchi can decide if cq is + or -. Anyway, looks good to me.

However, if your patch is changed considerably, you MUST request review again. :-)
Comment 16 WebKit Commit Bot 2011-04-14 19:09:30 PDT
The commit-queue encountered the following flaky tests while processing attachment 89543 [details]:

http/tests/xmlhttprequest/basic-auth.html bug 51613 (author: ap@webkit.org)
The commit-queue is continuing to process your patch.
Comment 17 WebKit Commit Bot 2011-04-14 19:12:20 PDT
Comment on attachment 89543 [details]
updated changelog

Clearing flags on attachment: 89543

Committed r83931: <http://trac.webkit.org/changeset/83931>
Comment 18 WebKit Commit Bot 2011-04-14 19:12:26 PDT
All reviewed patches have been landed.  Closing bug.