[Webkit-unassigned] [Bug 77337] [EFL] Refactor ewk_js files.

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Feb 9 06:37:22 PST 2012


https://bugs.webkit.org/show_bug.cgi?id=77337





--- Comment #9 from Tomasz Morawski <t.morawski at samsung.com>  2012-02-09 06:37:22 PST ---
(In reply to comment #8)
> (In reply to comment #7)
> > I started to make complex refactor of js files with mentioned architecture changes, general clean up and partial reimplementation of internal functions. Manual memory managment will be also removed. I will also try to make some comments inside code and prepare complex code including related html page. I think I will able to show a first version of patch soon.
> 
> By the way, one of the first things which should be included in this revamp is the use of the recently-introduced Eina_Model stuff which should help _a lot_ with reducing the necessary code on the ewk_js side. There's very little documentation on it yet, but it is most likely the way to go.

Maybe it will better if I write something about my plan.

1) From API point of view:
It is only a plan that could be changed :) I would like to remove almost all structures form ewk_js.h file and put them into new ewk_js_private.h file. These private files are very often uses in gtk and qt port to store internal object definitions. BTW I don't know why EFL port don't follow this rule and put every thing into ewk_private.h file? These structures except js_variant object definition are not very useful and should not be in public API. 

a) For example instead of direct creating and managing of js meta class object I am suggesting to add few new API functions to manage it indirectly. I would like to introduce these function:

ewk_js_meta_class_new()
ewk_js_meta_class_free(Ewk_JS_Class_Meta *meta_cls)
ewk_js_meta_class_method_add(Ewk_JS_Class_Meta *meta_cls, const char *name, Ewk_JS_Invoke_Cb);
ewk_js_meta_class_property_add(Ewk_JS_Class_Meta *meta_cls, const char *name, Ewk_JS_Variant *variant);
ewk_js_meta_class_property_default_cb_set(Ewk_JS_Class_Meta *meta_cls, const char* name, Ewk_JS_Set_Cb set, Ewk_JS_Get_Cb get, Ewk_JS_Del_Cb del)
ewk_js_meta_class_properties_default_cb_set(Ewk_JS_Class_Meta *meta_cls, Ewk_JS_Set_Cb set, Ewk_JS_Get_Cb get, Ewk_JS_Del_Cb del);

b) Adding a new function to create a Ewk_JS_Variant object. This function will initialize it to an empty value. 

c) Adding a new function to get value of property form object like this:
Ewk_JS_Property *ewk_js_object_property_value_get(Ewk_JS_Object *object, const char *name)

d) Remove:
EAPI Eina_Hash *ewk_js_object_properties_get(const Ewk_JS_Object *obj);
EAPI void ewk_js_variant_array_free(Ewk_JS_Variant *var, int count);

2) From cpp point of view:
After removing c memory management, renaming internal function, simplify some internal implementations the code looks much better. But it could be better if it is possible to use for example WTF:: containers or c++ struct with methods and inheritance for internal objects. :) Currently I am not sure about using Eina_Model. The Eina_Model looks to heavy for this simple purpose.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list