felipealmeida pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=508edf78c6be3165ef56e968e41e1cc875471024
commit 508edf78c6be3165ef56e968e41e1cc875471024 Author: Lauro Moura <[email protected]> Date: Mon Aug 15 12:31:05 2016 -0300 efl_js: Update after eo/efl api changes --- src/Makefile_Efl_Js.am | 3 ++- src/bin/eolian_js/main.cc | 6 +++--- src/bindings/js/efl_js/efl_js.cc | 9 ++------- src/bindings/js/eina_js/eina_js_compatibility.hh | 8 ++++---- src/bindings/js/eina_js/eina_js_get_value_from_c.hh | 8 ++++---- src/bindings/js/eo_js/eo_js_construct_from_eo.hh | 4 ++-- src/bindings/js/eo_js/eo_js_constructor.hh | 14 +++++++------- src/bindings/js/eo_js/eo_js_event.hh | 2 +- src/tests/efl_js/benchmark_object_impl.cc | 6 +++--- src/tests/eolian_js/eolian_js_suite.cc | 2 +- 10 files changed, 29 insertions(+), 33 deletions(-) diff --git a/src/Makefile_Efl_Js.am b/src/Makefile_Efl_Js.am index 0bcb6bb..734c9ed 100644 --- a/src/Makefile_Efl_Js.am +++ b/src/Makefile_Efl_Js.am @@ -185,7 +185,8 @@ lib_efl_js_libefl_js_la_CPPFLAGS = -I$(top_builddir)/src/lib/efl \ @EIO_JS_CFLAGS@ \ @ETHUMB_JS_CFLAGS@ \ @EINA_CXX_CFLAGS@ \ -@ELEMENTARY_CFLAGS@ +@ELEMENTARY_CFLAGS@ \ +-D_EO_ADD_FALLBACK_FORCE=1 lib_efl_js_libefl_js_la_LIBADD = @EFL_JS_LIBS@ lib_efl_js_libefl_js_la_DEPENDENCIES = @EFL_JS_INTERNAL_LIBS@ lib_efl_js_libefl_js_la_LIBTOOLFLAGS = --tag=disable-static diff --git a/src/bin/eolian_js/main.cc b/src/bin/eolian_js/main.cc index 27ffe8a..d38700c 100644 --- a/src/bin/eolian_js/main.cc +++ b/src/bin/eolian_js/main.cc @@ -328,7 +328,7 @@ _function_is_generatable(const Eolian_Function *function, Eolian_Function_Type f if (!_type_is_generatable(tp, add_pointer)) return false; - if (eolian_type_is_ref(tp) && _function_belongs_to(function, "Eo.Base")) + if (eolian_type_is_ref(tp) && _function_belongs_to(function, "Efl.Object")) return false; } @@ -655,7 +655,7 @@ int main(int argc, char** argv) , last; first != last; ++first) { std::stringstream ss; - bool should_reject_ref = file_basename == "eo_base.eo"; + bool should_reject_ref = file_basename == "efl_object.eo"; bool has_ref_field = false; auto tpd = &*first; @@ -669,7 +669,7 @@ int main(int argc, char** argv) EINA_CXX_DOM_LOG_ERR(eolian::js::domain) << "Could not get struct type name"; continue; } - else if(strcmp(struct_type_full_name, "Eo.Callback_Array_Item") == 0) + else if(strcmp(struct_type_full_name, "Efl.Callback_Array_Item") == 0) continue; std::string struct_c_name = struct_type_full_name; std::replace(struct_c_name.begin(), struct_c_name.end(), '.', '_'); diff --git a/src/bindings/js/efl_js/efl_js.cc b/src/bindings/js/efl_js/efl_js.cc index a4b28d8..093380f 100644 --- a/src/bindings/js/efl_js/efl_js.cc +++ b/src/bindings/js/efl_js/efl_js.cc @@ -72,6 +72,7 @@ EAPI void register_ecore_audio_out_pulse(v8::Handle<v8::Object> global, v8::Isol EAPI void register_ecore_audio_out_sndfile(v8::Handle<v8::Object> global, v8::Isolate* isolate); namespace efl { +EAPI void register_object(v8::Handle<v8::Object> global, v8::Isolate* isolate); EAPI void register_animator(v8::Handle<v8::Object> global, v8::Isolate* isolate); EAPI void register_container(v8::Handle<v8::Object> global, v8::Isolate* isolate); EAPI void register_control(v8::Handle<v8::Object> global, v8::Isolate* isolate); @@ -95,11 +96,6 @@ namespace efl { namespace ui { namespace win { EAPI void register_standard(v8::Handle<v8::Object> global, v8::Isolate* isolate); }}} -namespace eo { -EAPI void register_abstract_class(v8::Handle<v8::Object> global, v8::Isolate* isolate); -EAPI void register_base(v8::Handle<v8::Object> global, v8::Isolate* isolate); -} - namespace efl { namespace canvas { EAPI void register_rectangle(v8::Handle<v8::Object> global, v8::Isolate* isolate); }} @@ -314,8 +310,7 @@ EAPI void init(v8::Handle<v8::Object> exports) efl::register_player(exports, v8::Isolate::GetCurrent()); efl::register_text(exports, v8::Isolate::GetCurrent()); // efl::register_text_properties(exports, v8::Isolate::GetCurrent()); - // eo::register_abstract_class(exports, v8::Isolate::GetCurrent()); - eo::register_base(exports, v8::Isolate::GetCurrent()); + efl::register_object(exports, v8::Isolate::GetCurrent()); #if 1 // evas::register_box(exports, v8::Isolate::GetCurrent()); // evas::register_canvas(exports, v8::Isolate::GetCurrent()); diff --git a/src/bindings/js/eina_js/eina_js_compatibility.hh b/src/bindings/js/eina_js/eina_js_compatibility.hh index 48cebc5..7b5c920 100644 --- a/src/bindings/js/eina_js/eina_js_compatibility.hh +++ b/src/bindings/js/eina_js/eina_js_compatibility.hh @@ -158,14 +158,14 @@ T container_wrap(T&& v) inline ::efl::eo::concrete container_wrap(Eo* v) { if(v) - eo_ref(v); + efl_ref(v); return ::efl::eo::concrete{v}; } inline ::efl::eo::concrete container_wrap(Eo const* v) { if (v) - eo_ref(v); + efl_ref(v); return ::efl::eo::concrete{const_cast<Eo*>(v)}; } @@ -929,8 +929,8 @@ compatibility_return_type cast_function(compatibility_callback_info_type args) char* class_name = *str; auto ctor = ::efl::eina::js::get_class_constructor(class_name); - auto obj = new_v8_external_instance(ctor, ::eo_ref(eo), isolate); - efl::eina::js::make_weak(isolate, obj, [eo]{ ::eo_unref(eo); }); + auto obj = new_v8_external_instance(ctor, ::efl_ref(eo), isolate); + efl::eina::js::make_weak(isolate, obj, [eo]{ ::efl_unref(eo); }); return compatibility_return(obj, args); } else diff --git a/src/bindings/js/eina_js/eina_js_get_value_from_c.hh b/src/bindings/js/eina_js/eina_js_get_value_from_c.hh index 4b1ad44..4d71229 100644 --- a/src/bindings/js/eina_js/eina_js_get_value_from_c.hh +++ b/src/bindings/js/eina_js/eina_js_get_value_from_c.hh @@ -143,8 +143,8 @@ inline v8::Local<v8::Value> get_value_from_c(Eo* v, v8::Isolate* isolate, const char* class_name) { auto ctor = ::efl::eina::js::get_class_constructor(class_name); - auto obj = new_v8_external_instance(ctor, ::eo_ref(v), isolate); - efl::eina::js::make_weak(isolate, obj, [v]{ ::eo_unref(v); }); + auto obj = new_v8_external_instance(ctor, ::efl_ref(v), isolate); + efl::eina::js::make_weak(isolate, obj, [v]{ ::efl_unref(v); }); return obj; } @@ -153,8 +153,8 @@ get_value_from_c(const Eo* v, v8::Isolate* isolate, const char* class_name) { // TODO: implement const objects? auto ctor = ::efl::eina::js::get_class_constructor(class_name); - auto obj = new_v8_external_instance(ctor, ::eo_ref(v), isolate); - efl::eina::js::make_weak(isolate, obj, [v]{ ::eo_unref(v); }); + auto obj = new_v8_external_instance(ctor, ::efl_ref(v), isolate); + efl::eina::js::make_weak(isolate, obj, [v]{ ::efl_unref(v); }); return obj; } diff --git a/src/bindings/js/eo_js/eo_js_construct_from_eo.hh b/src/bindings/js/eo_js/eo_js_construct_from_eo.hh index 8008d16..df3274e 100644 --- a/src/bindings/js/eo_js/eo_js_construct_from_eo.hh +++ b/src/bindings/js/eo_js/eo_js_construct_from_eo.hh @@ -20,8 +20,8 @@ inline eina::js::compatibility_return_type construct_from_eo(eina::js::compatibi { Eo* eo = static_cast<Eo*>(v8::External::Cast(*args[0])->Value()); args.This()->SetInternalField(0, args[0]); - ::eo_ref(eo); - efl::eina::js::make_weak(args.GetIsolate(), args.This(), [eo] { eo_unref(eo); }); + ::efl_ref(eo); + efl::eina::js::make_weak(args.GetIsolate(), args.This(), [eo] { efl_unref(eo); }); return eina::js::compatibility_return(); } else diff --git a/src/bindings/js/eo_js/eo_js_constructor.hh b/src/bindings/js/eo_js/eo_js_constructor.hh index 497f626..191eb9d 100644 --- a/src/bindings/js/eo_js/eo_js_constructor.hh +++ b/src/bindings/js/eo_js/eo_js_constructor.hh @@ -89,10 +89,10 @@ struct constructor_caller template <typename T, std::size_t... I> void aux(T function, eina::index_sequence<I...>) const { - function(obj_eo_self, get_value<T, I>((*args)[I + *current], args->GetIsolate())...); + function(obj_efl_self, get_value<T, I>((*args)[I + *current], args->GetIsolate())...); } - Eo* obj_eo_self; + Eo* obj_efl_self; int* current; eina::js::compatibility_callback_info_pointer args; }; @@ -106,10 +106,10 @@ struct constructor_caller { Eo* parent = eina::js::get_value_from_javascript (args[0], args.GetIsolate(), "", eina::js::value_tag<Eo*>()); - Eo* eo = eo_add + Eo* eo = efl_add (klass , parent - , eina::_mpl::for_each(constructors, call{eo_self, ¤t_index, &args}) + , eina::_mpl::for_each(constructors, call{efl_self, ¤t_index, &args}) ); if (!eo) throw std::logic_error("Failed to create object."); @@ -118,7 +118,7 @@ struct constructor_caller efl::eina::js::make_weak(args.GetIsolate(), self , [eo] { - eo_unref(eo); + efl_unref(eo); }); } catch(std::logic_error const& error) @@ -137,12 +137,12 @@ struct constructor_caller return eina::js::compatibility_return(); } - Eo_Class const* klass; + Efl_Class const* klass; std::tuple<F...> constructors; }; template <typename... F> -v8::Handle<v8::Value> constructor_data(v8::Isolate* isolate, Eo_Class const* klass, F... f) +v8::Handle<v8::Value> constructor_data(v8::Isolate* isolate, Efl_Class const* klass, F... f) { return eina::js::compatibility_new<v8::External> (isolate diff --git a/src/bindings/js/eo_js/eo_js_event.hh b/src/bindings/js/eo_js/eo_js_event.hh index 45d023e..2488125 100644 --- a/src/bindings/js/eo_js/eo_js_event.hh +++ b/src/bindings/js/eo_js/eo_js_event.hh @@ -97,7 +97,7 @@ inline eina::js::compatibility_return_type on_event(eina::js::compatibility_call event_callback_information* i = new event_callback_information {event, {isolate, eina::js::compatibility_cast<v8::Function>(f)}}; - eo_event_callback_add(eo, event->event, event->event_callback, i); + efl_event_callback_add(eo, event->event, event->event_callback, i); efl::eina::js::make_weak(isolate, self, [i]{ delete i; }); } else diff --git a/src/tests/efl_js/benchmark_object_impl.cc b/src/tests/efl_js/benchmark_object_impl.cc index ab7aa2b..39e84ef 100644 --- a/src/tests/efl_js/benchmark_object_impl.cc +++ b/src/tests/efl_js/benchmark_object_impl.cc @@ -49,7 +49,7 @@ using efl::eina::js::compatibility_new; compatibility_return_type js_benchmark_object_##name##arg(compatibility_callback_info_type) \ { \ Eina_Counter* counter = eina_counter_new("counter"); \ - Eo* object = eo_add(BENCHMARK_OBJECT_CLASS, NULL); \ + Eo* object = efl_add(BENCHMARK_OBJECT_CLASS, NULL); \ Eina_List* l = NULL; \ (void)l; \ /* Warm */ \ @@ -65,7 +65,7 @@ using efl::eina::js::compatibility_new; } \ eina_counter_stop(counter, 20000); \ fprintf(stderr, "%s", eina_counter_dump(counter)); \ - eo_unref(object); \ + efl_unref(object); \ return compatibility_return(); \ } @@ -83,7 +83,7 @@ void benchmark_object_module_init(v8::Handle<v8::Object> exports) try { eina_init(); - eo_init(); + efl_object_init(); register_benchmark_object(exports, v8::Isolate::GetCurrent()); #define JS_BENCHMARK_EXPORT(name) \ exports->Set(compatibility_new<v8::String>(nullptr, "benchmark_" #name "arg") \ diff --git a/src/tests/eolian_js/eolian_js_suite.cc b/src/tests/eolian_js/eolian_js_suite.cc index cea5d19..a2bb7f9 100644 --- a/src/tests/eolian_js/eolian_js_suite.cc +++ b/src/tests/eolian_js/eolian_js_suite.cc @@ -43,7 +43,7 @@ void eolian_js_module_init(v8::Handle<v8::Object> exports) try { eina_init(); - eo_init(); + efl_object_init(); eolian_js_test_register_eolian_js_binding(exports); std::cerr << "registered" << std::endl; } --
