efl_js: Update after eo/efl api changes

This commit is contained in:
Lauro Moura 2016-08-15 12:31:05 -03:00 committed by Felipe Magno de Almeida
parent 4f52588b3c
commit 508edf78c6
10 changed files with 29 additions and 33 deletions

View File

@ -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

View File

@ -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(), '.', '_');

View File

@ -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());

View File

@ -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

View File

@ -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;
}

View File

@ -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

View File

@ -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, &current_index, &args})
, eina::_mpl::for_each(constructors, call{efl_self, &current_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

View File

@ -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

View File

@ -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") \

View File

@ -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;
}