From ad17a75f284ca504235692703d3fe1d7fae707ca Mon Sep 17 00:00:00 2001 From: levlam Date: Wed, 7 Apr 2021 23:35:09 +0300 Subject: [PATCH] Add source to add_new_dialog. --- td/telegram/MessagesManager.cpp | 27 ++++++++++++++------------- td/telegram/MessagesManager.h | 4 ++-- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/td/telegram/MessagesManager.cpp b/td/telegram/MessagesManager.cpp index e09b82a24..2497479ee 100644 --- a/td/telegram/MessagesManager.cpp +++ b/td/telegram/MessagesManager.cpp @@ -6776,7 +6776,7 @@ void MessagesManager::on_update_channel_too_long(tl_object_ptr 0) { - d = add_dialog(dialog_id); + d = add_dialog(dialog_id, "on_update_channel_too_long"); CHECK(d != nullptr); CHECK(d->pts == pts); update_dialog_pos(d, "on_update_channel_too_long"); @@ -7402,7 +7402,7 @@ void MessagesManager::add_pending_channel_update(DialogId dialog_id, tl_object_p return; } - d = add_dialog(dialog_id); + d = add_dialog(dialog_id, "add_pending_channel_update"); CHECK(d != nullptr); CHECK(d->pts == pts); update_dialog_pos(d, "add_pending_channel_update"); @@ -14451,7 +14451,7 @@ void MessagesManager::on_get_dialogs(FolderId folder_id, vectorpts == 0) { d->pts = 1; if (is_debug_message_op_enabled()) { @@ -31943,7 +31943,7 @@ MessagesManager::Message *MessagesManager::add_message_to_dialog(DialogId dialog Dialog *d = get_dialog_force(dialog_id); if (d == nullptr) { - d = add_dialog(dialog_id); + d = add_dialog(dialog_id, "add_message_to_dialog"); *need_update_dialog_pos = true; } else { CHECK(d->dialog_id == dialog_id); @@ -33795,7 +33795,7 @@ void MessagesManager::force_create_dialog(DialogId dialog_id, const char *source return; } - d = add_dialog(dialog_id); + d = add_dialog(dialog_id, "force_create_dialog"); update_dialog_pos(d, "force_create_dialog"); if (dialog_id.get_type() == DialogType::SecretChat && !d->notification_settings.is_synchronized && @@ -33855,7 +33855,7 @@ void MessagesManager::force_create_dialog(DialogId dialog_id, const char *source } } -MessagesManager::Dialog *MessagesManager::add_dialog(DialogId dialog_id) { +MessagesManager::Dialog *MessagesManager::add_dialog(DialogId dialog_id, const char *source) { LOG(DEBUG) << "Creating " << dialog_id; CHECK(!have_dialog(dialog_id)); @@ -33864,7 +33864,7 @@ MessagesManager::Dialog *MessagesManager::add_dialog(DialogId dialog_id) { auto r_value = G()->td_db()->get_dialog_db_sync()->get_dialog(dialog_id); if (r_value.is_ok()) { LOG(INFO) << "Synchronously loaded " << dialog_id << " from database"; - return add_new_dialog(parse_dialog(dialog_id, r_value.ok()), true); + return add_new_dialog(parse_dialog(dialog_id, r_value.ok()), true, source); } } @@ -33872,10 +33872,11 @@ MessagesManager::Dialog *MessagesManager::add_dialog(DialogId dialog_id) { d->dialog_id = dialog_id; invalidate_message_indexes(d.get()); - return add_new_dialog(std::move(d), false); + return add_new_dialog(std::move(d), false, source); } -MessagesManager::Dialog *MessagesManager::add_new_dialog(unique_ptr &&d, bool is_loaded_from_database) { +MessagesManager::Dialog *MessagesManager::add_new_dialog(unique_ptr &&d, bool is_loaded_from_database, + const char *source) { auto dialog_id = d->dialog_id; LOG_CHECK(is_inited_) << dialog_id << ' ' << is_loaded_from_database; switch (dialog_id.get_type()) { @@ -35054,7 +35055,7 @@ MessagesManager::Dialog *MessagesManager::on_load_dialog_from_database(DialogId } LOG(INFO) << "Add new " << dialog_id << " from database"; - return add_new_dialog(parse_dialog(dialog_id, value), true); + return add_new_dialog(parse_dialog(dialog_id, value), true, "on_load_dialog_from_database"); } const DialogFilter *MessagesManager::get_server_dialog_filter(DialogFilterId dialog_filter_id) const { @@ -35779,7 +35780,7 @@ void MessagesManager::on_get_channel_difference( bool need_update_dialog_pos = false; if (d == nullptr) { - d = add_dialog(dialog_id); + d = add_dialog(dialog_id, "on_get_channel_difference"); need_update_dialog_pos = true; } diff --git a/td/telegram/MessagesManager.h b/td/telegram/MessagesManager.h index 24ca71aac..3503529e1 100644 --- a/td/telegram/MessagesManager.h +++ b/td/telegram/MessagesManager.h @@ -2404,9 +2404,9 @@ class MessagesManager : public Actor { MessageId get_message_id_by_random_id(Dialog *d, int64 random_id, const char *source); - Dialog *add_dialog(DialogId dialog_id); + Dialog *add_dialog(DialogId dialog_id, const char *source); - Dialog *add_new_dialog(unique_ptr &&d, bool is_loaded_from_database); + Dialog *add_new_dialog(unique_ptr &&d, bool is_loaded_from_database, const char *source); void fix_new_dialog(Dialog *d, unique_ptr &&last_database_message, MessageId last_database_message_id, int64 order, int32 last_clear_history_date, MessageId last_clear_history_message_id,