Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace .bind(...).call_deferred() with .call_deferred(...) #92427

Merged
merged 1 commit into from
May 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions core/io/resource_loader.h
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ class ResourceLoader {
// 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) {
Expand All @@ -239,7 +239,7 @@ class ResourceLoader {
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);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion editor/editor_help.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
2 changes: 1 addition & 1 deletion editor/editor_log.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
4 changes: 2 additions & 2 deletions editor/editor_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion editor/editor_properties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down
2 changes: 1 addition & 1 deletion editor/gui/editor_toaster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion editor/import/resource_importer_shader_file.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
}

Expand Down
2 changes: 1 addition & 1 deletion editor/plugins/animation_player_editor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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++;
Expand Down
2 changes: 1 addition & 1 deletion editor/plugins/canvas_item_editor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
28 changes: 14 additions & 14 deletions platform/web/display_server_web.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -927,7 +927,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
Expand All @@ -953,7 +953,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
Expand Down
2 changes: 1 addition & 1 deletion platform/web/javascript_bridge_singleton.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading