Add empty OptionManager.

This commit is contained in:
levlam 2021-12-16 01:09:59 +03:00
parent 83bd3e33d0
commit 191b4ee5d5
6 changed files with 68 additions and 1 deletions

View File

@ -385,6 +385,7 @@ set(TDLIB_SOURCE
td/telegram/NotificationManager.cpp td/telegram/NotificationManager.cpp
td/telegram/NotificationSettings.cpp td/telegram/NotificationSettings.cpp
td/telegram/NotificationType.cpp td/telegram/NotificationType.cpp
td/telegram/OptionManager.cpp
td/telegram/Payments.cpp td/telegram/Payments.cpp
td/telegram/PasswordManager.cpp td/telegram/PasswordManager.cpp
td/telegram/PhoneNumberManager.cpp td/telegram/PhoneNumberManager.cpp
@ -599,6 +600,7 @@ set(TDLIB_SOURCE
td/telegram/NotificationManager.h td/telegram/NotificationManager.h
td/telegram/NotificationSettings.h td/telegram/NotificationSettings.h
td/telegram/NotificationType.h td/telegram/NotificationType.h
td/telegram/OptionManager.h
td/telegram/PasswordManager.h td/telegram/PasswordManager.h
td/telegram/Payments.h td/telegram/Payments.h
td/telegram/PhoneNumberManager.h td/telegram/PhoneNumberManager.h

View File

@ -297,6 +297,7 @@ function split_file($file, $chunks, $undo) {
'MessageCopyOptions' => 'MessageCopyOptions', 'MessageCopyOptions' => 'MessageCopyOptions',
'messages_manager[_(-][^.]|MessagesManager' => 'MessagesManager', 'messages_manager[_(-][^.]|MessagesManager' => 'MessagesManager',
'notification_manager[_(-][^.]|NotificationManager|notifications[)]' => 'NotificationManager', 'notification_manager[_(-][^.]|NotificationManager|notifications[)]' => 'NotificationManager',
'option_manager[_(-][^.]|OptionManager' => "OptionManager",
'phone_number_manager[_(-][^.]|PhoneNumberManager' => "PhoneNumberManager", 'phone_number_manager[_(-][^.]|PhoneNumberManager' => "PhoneNumberManager",
'poll_manager[_(-][^.]|PollManager' => "PollManager", 'poll_manager[_(-][^.]|PollManager' => "PollManager",
'PublicDialogType|get_public_dialog_type' => 'PublicDialogType', 'PublicDialogType|get_public_dialog_type' => 'PublicDialogType',

View File

@ -0,0 +1,20 @@
//
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2021
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
#include "td/telegram/OptionManager.h"
namespace td {
OptionManager::OptionManager(Td *td, ActorShared<> parent) : td_(td), parent_(std::move(parent)) {
}
void OptionManager::tear_down() {
parent_.reset();
}
OptionManager::~OptionManager() = default;
} // namespace td

View File

@ -0,0 +1,34 @@
//
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2021
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
#pragma once
#include "td/actor/actor.h"
#include "td/utils/common.h"
namespace td {
class Td;
class OptionManager final : public Actor {
public:
OptionManager(Td *td, ActorShared<> parent);
OptionManager(const OptionManager &) = delete;
OptionManager &operator=(const OptionManager &) = delete;
OptionManager(OptionManager &&) = delete;
OptionManager &operator=(OptionManager &&) = delete;
~OptionManager() final;
private:
void tear_down() final;
Td *td_;
ActorShared<> parent_;
};
} // namespace td

View File

@ -80,6 +80,7 @@
#include "td/telegram/NotificationId.h" #include "td/telegram/NotificationId.h"
#include "td/telegram/NotificationManager.h" #include "td/telegram/NotificationManager.h"
#include "td/telegram/NotificationSettings.h" #include "td/telegram/NotificationSettings.h"
#include "td/telegram/OptionManager.h"
#include "td/telegram/PasswordManager.h" #include "td/telegram/PasswordManager.h"
#include "td/telegram/Payments.h" #include "td/telegram/Payments.h"
#include "td/telegram/PhoneNumberManager.h" #include "td/telegram/PhoneNumberManager.h"
@ -3556,6 +3557,8 @@ void Td::dec_actor_refcnt() {
LOG(DEBUG) << "MessagesManager was cleared" << timer; LOG(DEBUG) << "MessagesManager was cleared" << timer;
notification_manager_.reset(); notification_manager_.reset();
LOG(DEBUG) << "NotificationManager was cleared" << timer; LOG(DEBUG) << "NotificationManager was cleared" << timer;
option_manager_.reset();
LOG(DEBUG) << "OptionManager was cleared" << timer;
poll_manager_.reset(); poll_manager_.reset();
LOG(DEBUG) << "PollManager was cleared" << timer; LOG(DEBUG) << "PollManager was cleared" << timer;
sponsored_message_manager_.reset(); sponsored_message_manager_.reset();
@ -3746,6 +3749,8 @@ void Td::clear() {
LOG(DEBUG) << "MessagesManager actor was cleared" << timer; LOG(DEBUG) << "MessagesManager actor was cleared" << timer;
notification_manager_actor_.reset(); notification_manager_actor_.reset();
LOG(DEBUG) << "NotificationManager actor was cleared" << timer; LOG(DEBUG) << "NotificationManager actor was cleared" << timer;
option_manager_actor_.reset();
LOG(DEBUG) << "OptionManager actor was cleared" << timer;
poll_manager_actor_.reset(); poll_manager_actor_.reset();
LOG(DEBUG) << "PollManager actor was cleared" << timer; LOG(DEBUG) << "PollManager actor was cleared" << timer;
sponsored_message_manager_actor_.reset(); sponsored_message_manager_actor_.reset();
@ -4209,9 +4214,11 @@ void Td::init_managers() {
G()->set_messages_manager(messages_manager_actor_.get()); G()->set_messages_manager(messages_manager_actor_.get());
notification_manager_ = make_unique<NotificationManager>(this, create_reference()); notification_manager_ = make_unique<NotificationManager>(this, create_reference());
notification_manager_actor_ = register_actor("NotificationManager", notification_manager_.get()); notification_manager_actor_ = register_actor("NotificationManager", notification_manager_.get());
G()->set_notification_manager(notification_manager_actor_.get());
option_manager_ = make_unique<OptionManager>(this, create_reference());
option_manager_actor_ = register_actor("OptionManager", option_manager_.get());
poll_manager_ = make_unique<PollManager>(this, create_reference()); poll_manager_ = make_unique<PollManager>(this, create_reference());
poll_manager_actor_ = register_actor("PollManager", poll_manager_.get()); poll_manager_actor_ = register_actor("PollManager", poll_manager_.get());
G()->set_notification_manager(notification_manager_actor_.get());
sponsored_message_manager_ = make_unique<SponsoredMessageManager>(this, create_reference()); sponsored_message_manager_ = make_unique<SponsoredMessageManager>(this, create_reference());
sponsored_message_manager_actor_ = register_actor("SponsoredMessageManager", sponsored_message_manager_.get()); sponsored_message_manager_actor_ = register_actor("SponsoredMessageManager", sponsored_message_manager_.get());
G()->set_sponsored_message_manager(sponsored_message_manager_actor_.get()); G()->set_sponsored_message_manager(sponsored_message_manager_actor_.get());

View File

@ -59,6 +59,7 @@ class LinkManager;
class MessagesManager; class MessagesManager;
class NetStatsManager; class NetStatsManager;
class NotificationManager; class NotificationManager;
class OptionManager;
class PasswordManager; class PasswordManager;
class PhoneNumberManager; class PhoneNumberManager;
class PollManager; class PollManager;
@ -175,6 +176,8 @@ class Td final : public Actor {
ActorOwn<MessagesManager> messages_manager_actor_; ActorOwn<MessagesManager> messages_manager_actor_;
unique_ptr<NotificationManager> notification_manager_; unique_ptr<NotificationManager> notification_manager_;
ActorOwn<NotificationManager> notification_manager_actor_; ActorOwn<NotificationManager> notification_manager_actor_;
unique_ptr<OptionManager> option_manager_;
ActorOwn<OptionManager> option_manager_actor_;
unique_ptr<PollManager> poll_manager_; unique_ptr<PollManager> poll_manager_;
ActorOwn<PollManager> poll_manager_actor_; ActorOwn<PollManager> poll_manager_actor_;
unique_ptr<SponsoredMessageManager> sponsored_message_manager_; unique_ptr<SponsoredMessageManager> sponsored_message_manager_;