You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-04 12:00:25 +00:00
Optimize StringName usage
* Added a new macro SNAME() that constructs and caches a local stringname. * Subsequent usages use the cached version. * Since these use a global static variable, a second refcounter of static usages need to be kept for cleanup time. * Replaced all theme usages by this new macro. * Replace all signal emission usages by this new macro. * Replace all call_deferred usages by this new macro. This is part of ongoing work to optimize GUI and the editor.
This commit is contained in:
@@ -86,7 +86,7 @@ void WebSocketClient::_on_peer_packet() {
|
||||
if (_is_multiplayer) {
|
||||
_process_multiplayer(get_peer(1), 1);
|
||||
} else {
|
||||
emit_signal("data_received");
|
||||
emit_signal(SNAME("data_received"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,27 +94,27 @@ void WebSocketClient::_on_connect(String p_protocol) {
|
||||
if (_is_multiplayer) {
|
||||
// need to wait for ID confirmation...
|
||||
} else {
|
||||
emit_signal("connection_established", p_protocol);
|
||||
emit_signal(SNAME("connection_established"), p_protocol);
|
||||
}
|
||||
}
|
||||
|
||||
void WebSocketClient::_on_close_request(int p_code, String p_reason) {
|
||||
emit_signal("server_close_request", p_code, p_reason);
|
||||
emit_signal(SNAME("server_close_request"), p_code, p_reason);
|
||||
}
|
||||
|
||||
void WebSocketClient::_on_disconnect(bool p_was_clean) {
|
||||
if (_is_multiplayer) {
|
||||
emit_signal("connection_failed");
|
||||
emit_signal(SNAME("connection_failed"));
|
||||
} else {
|
||||
emit_signal("connection_closed", p_was_clean);
|
||||
emit_signal(SNAME("connection_closed"), p_was_clean);
|
||||
}
|
||||
}
|
||||
|
||||
void WebSocketClient::_on_error() {
|
||||
if (_is_multiplayer) {
|
||||
emit_signal("connection_failed");
|
||||
emit_signal(SNAME("connection_failed"));
|
||||
} else {
|
||||
emit_signal("connection_error");
|
||||
emit_signal(SNAME("connection_error"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user