Use separate initialization functions for different Manager types.

This commit is contained in:
levlam 2024-01-13 00:59:17 +03:00
parent 8b97d2e8e4
commit 96fee82699
3 changed files with 14 additions and 2 deletions

View File

@ -170,7 +170,7 @@ function split_file($file, $chunks, $undo) {
'(CREATE_REQUEST|CREATE_NO_ARGS_REQUEST)[(](?<name>[A-Z][A-Za-z]*)|'. '(CREATE_REQUEST|CREATE_NO_ARGS_REQUEST)[(](?<name>[A-Z][A-Za-z]*)|'.
'(?<name>complete_pending_preauthentication_requests)|'. '(?<name>complete_pending_preauthentication_requests)|'.
'(?<name>get_message_history_slice)|'. '(?<name>get_message_history_slice)|'.
'(Up|Down)load[a-zA-Z]*C(?<name>allback)|(up|down)load_[a-z_]*_c(?<name>allback)_|'. '(Up|Down)load(?!ManagerCallback)[a-zA-Z]+C(?<name>allback)|(up|down)load_[a-z_]*_c(?<name>allback)_|'.
'(?<name>lazy_to_json)|'. '(?<name>lazy_to_json)|'.
'(?<name>LogEvent)[^sA]|'. '(?<name>LogEvent)[^sA]|'.
'(?<name>parse)[(]|'. '(?<name>parse)[(]|'.

View File

@ -3641,8 +3641,12 @@ void Td::init(Parameters parameters, Result<TdDb::OpenedDatabase> r_opened_datab
init_file_manager(); init_file_manager();
init_non_actor_managers();
init_managers(); init_managers();
init_pure_actor_managers();
secret_chats_manager_ = secret_chats_manager_ =
create_actor<SecretChatsManager>("SecretChatsManager", create_reference(), parameters.use_secret_chats_); create_actor<SecretChatsManager>("SecretChatsManager", create_reference(), parameters.use_secret_chats_);
G()->set_secret_chats_manager(secret_chats_manager_.get()); G()->set_secret_chats_manager(secret_chats_manager_.get());
@ -3865,13 +3869,15 @@ void Td::init_file_manager() {
G()->set_file_reference_manager(file_reference_manager_actor_.get()); G()->set_file_reference_manager(file_reference_manager_actor_.get());
} }
void Td::init_managers() { void Td::init_non_actor_managers() {
VLOG(td_init) << "Create Managers"; VLOG(td_init) << "Create Managers";
audios_manager_ = make_unique<AudiosManager>(this); audios_manager_ = make_unique<AudiosManager>(this);
callback_queries_manager_ = make_unique<CallbackQueriesManager>(this); callback_queries_manager_ = make_unique<CallbackQueriesManager>(this);
documents_manager_ = make_unique<DocumentsManager>(this); documents_manager_ = make_unique<DocumentsManager>(this);
videos_manager_ = make_unique<VideosManager>(this); videos_manager_ = make_unique<VideosManager>(this);
}
void Td::init_managers() {
account_manager_ = make_unique<AccountManager>(this, create_reference()); account_manager_ = make_unique<AccountManager>(this, create_reference());
account_manager_actor_ = register_actor("AccountManager", account_manager_.get()); account_manager_actor_ = register_actor("AccountManager", account_manager_.get());
G()->set_account_manager(account_manager_actor_.get()); G()->set_account_manager(account_manager_actor_.get());
@ -3983,7 +3989,9 @@ void Td::init_managers() {
web_pages_manager_ = make_unique<WebPagesManager>(this, create_reference()); web_pages_manager_ = make_unique<WebPagesManager>(this, create_reference());
web_pages_manager_actor_ = register_actor("WebPagesManager", web_pages_manager_.get()); web_pages_manager_actor_ = register_actor("WebPagesManager", web_pages_manager_.get());
G()->set_web_pages_manager(web_pages_manager_actor_.get()); G()->set_web_pages_manager(web_pages_manager_actor_.get());
}
void Td::init_pure_actor_managers() {
call_manager_ = create_actor<CallManager>("CallManager", create_reference()); call_manager_ = create_actor<CallManager>("CallManager", create_reference());
G()->set_call_manager(call_manager_.get()); G()->set_call_manager(call_manager_.get());
change_phone_number_manager_ = create_actor<PhoneNumberManager>( change_phone_number_manager_ = create_actor<PhoneNumberManager>(

View File

@ -1833,8 +1833,12 @@ class Td final : public Actor {
void init_file_manager(); void init_file_manager();
void init_non_actor_managers();
void init_managers(); void init_managers();
void init_pure_actor_managers();
void process_binlog_events(TdDb::OpenedDatabase &&events); void process_binlog_events(TdDb::OpenedDatabase &&events);
void clear(); void clear();