Merge pull request #92427 from AThousandShips/bind_go_away

Replace `.bind(...).call_deferred()` with `.call_deferred(...)`
This commit is contained in:
Rémi Verschelde 2024-05-28 15:50:01 +02:00
commit b8f3c5e2ab
No known key found for this signature in database
GPG key ID: C3336907360768E1
11 changed files with 26 additions and 26 deletions

View file

@ -226,7 +226,7 @@ public:
// Loaders can safely use this regardless which thread they are running on.
static void notify_load_error(const String &p_err) {
if (err_notify) {
callable_mp_static(err_notify).bind(p_err).call_deferred();
callable_mp_static(err_notify).call_deferred(p_err);
}
}
static void set_error_notify_func(ResourceLoadErrorNotify p_err_notify) {
@ -239,7 +239,7 @@ public:
if (Thread::get_caller_id() == Thread::get_main_id()) {
dep_err_notify(p_path, p_dependency, p_type);
} else {
callable_mp_static(dep_err_notify).bind(p_path, p_dependency, p_type).call_deferred();
callable_mp_static(dep_err_notify).call_deferred(p_path, p_dependency, p_type);
}
}
}

View file

@ -2890,7 +2890,7 @@ void EditorHelp::_load_doc_thread(void *p_udata) {
callable_mp_static(&EditorHelp::_gen_extensions_docs).call_deferred();
} else {
// We have to go back to the main thread to start from scratch, bypassing any possibly existing cache.
callable_mp_static(&EditorHelp::generate_doc).bind(false).call_deferred();
callable_mp_static(&EditorHelp::generate_doc).call_deferred(false);
}
OS::get_singleton()->benchmark_end_measure("EditorHelp", vformat("Generate Documentation (Run %d)", doc_generation_count));

View file

@ -59,7 +59,7 @@ void EditorLog::_error_handler(void *p_self, const char *p_func, const char *p_f
MessageType message_type = p_type == ERR_HANDLER_WARNING ? MSG_TYPE_WARNING : MSG_TYPE_ERROR;
if (self->current != Thread::get_caller_id()) {
callable_mp(self, &EditorLog::add_message).bind(err_str, message_type).call_deferred();
callable_mp(self, &EditorLog::add_message).call_deferred(err_str, message_type);
} else {
self->add_message(err_str, message_type);
}

View file

@ -5541,7 +5541,7 @@ void EditorNode::_add_dropped_files_recursive(const Vector<String> &p_files, Str
}
void EditorNode::_file_access_close_error_notify(const String &p_str) {
callable_mp_static(&EditorNode::_file_access_close_error_notify_impl).bind(p_str).call_deferred();
callable_mp_static(&EditorNode::_file_access_close_error_notify_impl).call_deferred(p_str);
}
void EditorNode::_file_access_close_error_notify_impl(const String &p_str) {
@ -6163,7 +6163,7 @@ static Node *_resource_get_edited_scene() {
}
void EditorNode::_print_handler(void *p_this, const String &p_string, bool p_error, bool p_rich) {
callable_mp_static(&EditorNode::_print_handler_impl).bind(p_string, p_error, p_rich).call_deferred();
callable_mp_static(&EditorNode::_print_handler_impl).call_deferred(p_string, p_error, p_rich);
}
void EditorNode::_print_handler_impl(const String &p_string, bool p_error, bool p_rich) {

View file

@ -3218,7 +3218,7 @@ void EditorPropertyResource::_open_editor_pressed() {
Ref<Resource> res = get_edited_property_value();
if (res.is_valid()) {
// May clear the editor so do it deferred.
callable_mp(EditorNode::get_singleton(), &EditorNode::edit_item).bind(res.ptr(), this).call_deferred();
callable_mp(EditorNode::get_singleton(), &EditorNode::edit_item).call_deferred(res.ptr(), this);
}
}

View file

@ -149,7 +149,7 @@ void EditorToaster::_notification(int p_what) {
void EditorToaster::_error_handler(void *p_self, const char *p_func, const char *p_file, int p_line, const char *p_error, const char *p_errorexp, bool p_editor_notify, ErrorHandlerType p_type) {
// This may be called from a thread. Since we will deal with non-thread-safe elements,
// we have to put it in the queue for safety.
callable_mp_static(&EditorToaster::_error_handler_impl).bind(String::utf8(p_file), p_line, String::utf8(p_error), String::utf8(p_errorexp), p_editor_notify, p_type).call_deferred();
callable_mp_static(&EditorToaster::_error_handler_impl).call_deferred(String::utf8(p_file), p_line, String::utf8(p_error), String::utf8(p_errorexp), p_editor_notify, p_type);
}
void EditorToaster::_error_handler_impl(const String &p_file, int p_line, const String &p_error, const String &p_errorexp, bool p_editor_notify, int p_type) {

View file

@ -106,7 +106,7 @@ Error ResourceImporterShaderFile::import(const String &p_source_file, const Stri
if (err != OK) {
if (!ShaderFileEditor::singleton->is_visible_in_tree()) {
callable_mp_static(&EditorNode::add_io_error).bind(vformat(TTR("Error importing GLSL shader file: '%s'. Open the file in the filesystem dock in order to see the reason."), p_source_file)).call_deferred();
callable_mp_static(&EditorNode::add_io_error).call_deferred(vformat(TTR("Error importing GLSL shader file: '%s'. Open the file in the filesystem dock in order to see the reason."), p_source_file));
}
}

View file

@ -1711,7 +1711,7 @@ void AnimationPlayerEditor::_prepare_onion_layers_2_step_prepare(int p_step_offs
OS::get_singleton()->get_main_loop()->process(0);
// This is the key: process the frame and let all callbacks/updates/notifications happen
// so everything (transforms, skeletons, etc.) is up-to-date visually.
callable_mp(this, &AnimationPlayerEditor::_prepare_onion_layers_2_step_capture).bind(p_step_offset, p_capture_idx).call_deferred();
callable_mp(this, &AnimationPlayerEditor::_prepare_onion_layers_2_step_capture).call_deferred(p_step_offset, p_capture_idx);
return;
} else {
next_capture_idx++;

View file

@ -5638,7 +5638,7 @@ CanvasItemEditor::CanvasItemEditor() {
clear(); // Make sure values are initialized.
// Update the menus' checkboxes.
callable_mp(this, &CanvasItemEditor::set_state).bind(get_state()).call_deferred();
callable_mp(this, &CanvasItemEditor::set_state).call_deferred(get_state());
}
CanvasItemEditor *CanvasItemEditor::singleton = nullptr;

View file

@ -70,7 +70,7 @@ bool DisplayServerWeb::check_size_force_redraw() {
void DisplayServerWeb::fullscreen_change_callback(int p_fullscreen) {
#ifdef PROXY_TO_PTHREAD_ENABLED
if (!Thread::is_main_thread()) {
callable_mp_static(DisplayServerWeb::_fullscreen_change_callback).bind(p_fullscreen).call_deferred();
callable_mp_static(DisplayServerWeb::_fullscreen_change_callback).call_deferred(p_fullscreen);
return;
}
#endif
@ -96,7 +96,7 @@ void DisplayServerWeb::drop_files_js_callback(const char **p_filev, int p_filec)
#ifdef PROXY_TO_PTHREAD_ENABLED
if (!Thread::is_main_thread()) {
callable_mp_static(DisplayServerWeb::_drop_files_js_callback).bind(files).call_deferred();
callable_mp_static(DisplayServerWeb::_drop_files_js_callback).call_deferred(files);
return;
}
#endif
@ -161,7 +161,7 @@ void DisplayServerWeb::key_callback(int p_pressed, int p_repeat, int p_modifiers
#ifdef PROXY_TO_PTHREAD_ENABLED
if (!Thread::is_main_thread()) {
callable_mp_static(DisplayServerWeb::_key_callback).bind(code, key, p_pressed, p_repeat, p_modifiers).call_deferred();
callable_mp_static(DisplayServerWeb::_key_callback).call_deferred(code, key, p_pressed, p_repeat, p_modifiers);
return;
}
#endif
@ -214,7 +214,7 @@ void DisplayServerWeb::_key_callback(const String &p_key_event_code, const Strin
int DisplayServerWeb::mouse_button_callback(int p_pressed, int p_button, double p_x, double p_y, int p_modifiers) {
#ifdef PROXY_TO_PTHREAD_ENABLED
if (!Thread::is_main_thread()) {
callable_mp_static(DisplayServerWeb::_mouse_button_callback).bind(p_pressed, p_button, p_x, p_y, p_modifiers).call_deferred();
callable_mp_static(DisplayServerWeb::_mouse_button_callback).call_deferred(p_pressed, p_button, p_x, p_y, p_modifiers);
return true;
}
#endif
@ -301,7 +301,7 @@ int DisplayServerWeb::_mouse_button_callback(int p_pressed, int p_button, double
void DisplayServerWeb::mouse_move_callback(double p_x, double p_y, double p_rel_x, double p_rel_y, int p_modifiers) {
#ifdef PROXY_TO_PTHREAD_ENABLED
if (!Thread::is_main_thread()) {
callable_mp_static(DisplayServerWeb::_mouse_move_callback).bind(p_x, p_y, p_rel_x, p_rel_y, p_modifiers).call_deferred();
callable_mp_static(DisplayServerWeb::_mouse_move_callback).call_deferred(p_x, p_y, p_rel_x, p_rel_y, p_modifiers);
return;
}
#endif
@ -394,7 +394,7 @@ void DisplayServerWeb::update_voices_callback(int p_size, const char **p_voice)
#ifdef PROXY_TO_PTHREAD_ENABLED
if (!Thread::is_main_thread()) {
callable_mp_static(DisplayServerWeb::_update_voices_callback).bind(voices).call_deferred();
callable_mp_static(DisplayServerWeb::_update_voices_callback).call_deferred(voices);
return;
}
#endif
@ -461,7 +461,7 @@ void DisplayServerWeb::tts_stop() {
void DisplayServerWeb::js_utterance_callback(int p_event, int p_id, int p_pos) {
#ifdef PROXY_TO_PTHREAD_ENABLED
if (!Thread::is_main_thread()) {
callable_mp_static(DisplayServerWeb::_js_utterance_callback).bind(p_event, p_id, p_pos).call_deferred();
callable_mp_static(DisplayServerWeb::_js_utterance_callback).call_deferred(p_event, p_id, p_pos);
return;
}
#endif
@ -591,7 +591,7 @@ Point2i DisplayServerWeb::mouse_get_position() const {
int DisplayServerWeb::mouse_wheel_callback(double p_delta_x, double p_delta_y) {
#ifdef PROXY_TO_PTHREAD_ENABLED
if (!Thread::is_main_thread()) {
callable_mp_static(DisplayServerWeb::_mouse_wheel_callback).bind(p_delta_x, p_delta_y).call_deferred();
callable_mp_static(DisplayServerWeb::_mouse_wheel_callback).call_deferred(p_delta_x, p_delta_y);
return true;
}
#endif
@ -654,7 +654,7 @@ int DisplayServerWeb::_mouse_wheel_callback(double p_delta_x, double p_delta_y)
void DisplayServerWeb::touch_callback(int p_type, int p_count) {
#ifdef PROXY_TO_PTHREAD_ENABLED
if (!Thread::is_main_thread()) {
callable_mp_static(DisplayServerWeb::_touch_callback).bind(p_type, p_count).call_deferred();
callable_mp_static(DisplayServerWeb::_touch_callback).call_deferred(p_type, p_count);
return;
}
#endif
@ -712,7 +712,7 @@ void DisplayServerWeb::vk_input_text_callback(const char *p_text, int p_cursor)
#ifdef PROXY_TO_PTHREAD_ENABLED
if (!Thread::is_main_thread()) {
callable_mp_static(DisplayServerWeb::_vk_input_text_callback).bind(text, p_cursor).call_deferred();
callable_mp_static(DisplayServerWeb::_vk_input_text_callback).call_deferred(text, p_cursor);
return;
}
#endif
@ -774,7 +774,7 @@ void DisplayServerWeb::gamepad_callback(int p_index, int p_connected, const char
#ifdef PROXY_TO_PTHREAD_ENABLED
if (!Thread::is_main_thread()) {
callable_mp_static(DisplayServerWeb::_gamepad_callback).bind(p_index, p_connected, id, guid).call_deferred();
callable_mp_static(DisplayServerWeb::_gamepad_callback).call_deferred(p_index, p_connected, id, guid);
return;
}
#endif
@ -797,7 +797,7 @@ void DisplayServerWeb::ime_callback(int p_type, const char *p_text) {
#ifdef PROXY_TO_PTHREAD_ENABLED
if (!Thread::is_main_thread()) {
callable_mp_static(DisplayServerWeb::_ime_callback).bind(p_type, text).call_deferred();
callable_mp_static(DisplayServerWeb::_ime_callback).call_deferred(p_type, text);
return;
}
#endif
@ -930,7 +930,7 @@ void DisplayServerWeb::update_clipboard_callback(const char *p_text) {
#ifdef PROXY_TO_PTHREAD_ENABLED
if (!Thread::is_main_thread()) {
callable_mp_static(DisplayServerWeb::_update_clipboard_callback).bind(text).call_deferred();
callable_mp_static(DisplayServerWeb::_update_clipboard_callback).call_deferred(text);
return;
}
#endif
@ -956,7 +956,7 @@ String DisplayServerWeb::clipboard_get() const {
void DisplayServerWeb::send_window_event_callback(int p_notification) {
#ifdef PROXY_TO_PTHREAD_ENABLED
if (!Thread::is_main_thread()) {
callable_mp_static(DisplayServerWeb::_send_window_event_callback).bind(p_notification).call_deferred();
callable_mp_static(DisplayServerWeb::_send_window_event_callback).call_deferred(p_notification);
return;
}
#endif

View file

@ -262,7 +262,7 @@ void JavaScriptObjectImpl::callback(void *p_ref, int p_args_id, int p_argc) {
#ifdef PROXY_TO_PTHREAD_ENABLED
if (!Thread::is_main_thread()) {
callable_mp_static(JavaScriptObjectImpl::_callback).bind(obj, arg).call_deferred();
callable_mp_static(JavaScriptObjectImpl::_callback).call_deferred(obj, arg);
return;
}
#endif