Add empty BoostManager.

This commit is contained in:
levlam 2023-10-19 16:25:51 +03:00
parent 5def3f2c88
commit cbfdf3c9a9
7 changed files with 69 additions and 0 deletions

View File

@ -296,6 +296,7 @@ set(TDLIB_SOURCE
td/telegram/BackgroundInfo.cpp td/telegram/BackgroundInfo.cpp
td/telegram/BackgroundManager.cpp td/telegram/BackgroundManager.cpp
td/telegram/BackgroundType.cpp td/telegram/BackgroundType.cpp
td/telegram/BoostManager.cpp
td/telegram/BotCommand.cpp td/telegram/BotCommand.cpp
td/telegram/BotCommandScope.cpp td/telegram/BotCommandScope.cpp
td/telegram/BotInfoManager.cpp td/telegram/BotInfoManager.cpp
@ -555,6 +556,7 @@ set(TDLIB_SOURCE
td/telegram/BackgroundManager.h td/telegram/BackgroundManager.h
td/telegram/BackgroundType.h td/telegram/BackgroundType.h
td/telegram/BlockListId.h td/telegram/BlockListId.h
td/telegram/BoostManager.h
td/telegram/BotCommand.h td/telegram/BotCommand.h
td/telegram/BotCommandScope.h td/telegram/BotCommandScope.h
td/telegram/BotInfoManager.h td/telegram/BotInfoManager.h

View File

@ -283,6 +283,7 @@ function split_file($file, $chunks, $undo) {
'auth_manager[_(-][^.]|AuthManager' => 'AuthManager', 'auth_manager[_(-][^.]|AuthManager' => 'AuthManager',
'autosave_manager[_(-][^.]|AutosaveManager' => 'AutosaveManager', 'autosave_manager[_(-][^.]|AutosaveManager' => 'AutosaveManager',
'background_manager[_(-][^.]|BackgroundManager' => "BackgroundManager", 'background_manager[_(-][^.]|BackgroundManager' => "BackgroundManager",
'boost_manager[_(-][^.]|BoostManager' => "BoostManager",
'bot_info_manager[_(-][^.]|BotInfoManager' => "BotInfoManager", 'bot_info_manager[_(-][^.]|BotInfoManager' => "BotInfoManager",
'contacts_manager[_(-][^.]|ContactsManager([^ ;.]| [^*])' => 'ContactsManager', 'contacts_manager[_(-][^.]|ContactsManager([^ ;.]| [^*])' => 'ContactsManager',
'country_info_manager[_(-][^.]|CountryInfoManager' => 'CountryInfoManager', 'country_info_manager[_(-][^.]|CountryInfoManager' => 'CountryInfoManager',

View File

@ -0,0 +1,18 @@
//
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2023
//
// 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/BoostManager.h"
namespace td {
BoostManager::BoostManager(Td *td, ActorShared<> parent) : td_(td), parent_(std::move(parent)) {
}
void BoostManager::tear_down() {
parent_.reset();
}
} // namespace td

View File

@ -0,0 +1,28 @@
//
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2023
//
// 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 BoostManager final : public Actor {
public:
BoostManager(Td *td, ActorShared<> parent);
private:
void tear_down() final;
Td *td_;
ActorShared<> parent_;
};
} // namespace td

View File

@ -36,6 +36,7 @@ class AttachMenuManager;
class AuthManager; class AuthManager;
class AutosaveManager; class AutosaveManager;
class BackgroundManager; class BackgroundManager;
class BoostManager;
class CallManager; class CallManager;
class ConfigManager; class ConfigManager;
class ConnectionCreator; class ConnectionCreator;
@ -214,6 +215,13 @@ class Global final : public ActorContext {
background_manager_ = background_manager; background_manager_ = background_manager;
} }
ActorId<BoostManager> boost_manager() const {
return boost_manager_;
}
void set_boost_manager(ActorId<BoostManager> boost_manager) {
boost_manager_ = boost_manager;
}
ActorId<CallManager> call_manager() const { ActorId<CallManager> call_manager() const {
return call_manager_; return call_manager_;
} }
@ -521,6 +529,7 @@ class Global final : public ActorContext {
ActorId<AuthManager> auth_manager_; ActorId<AuthManager> auth_manager_;
ActorId<AutosaveManager> autosave_manager_; ActorId<AutosaveManager> autosave_manager_;
ActorId<BackgroundManager> background_manager_; ActorId<BackgroundManager> background_manager_;
ActorId<BoostManager> boost_manager_;
ActorId<CallManager> call_manager_; ActorId<CallManager> call_manager_;
ActorId<ConfigManager> config_manager_; ActorId<ConfigManager> config_manager_;
ActorId<ContactsManager> contacts_manager_; ActorId<ContactsManager> contacts_manager_;

View File

@ -17,6 +17,7 @@
#include "td/telegram/BackgroundId.h" #include "td/telegram/BackgroundId.h"
#include "td/telegram/BackgroundManager.h" #include "td/telegram/BackgroundManager.h"
#include "td/telegram/BackgroundType.h" #include "td/telegram/BackgroundType.h"
#include "td/telegram/BoostManager.h"
#include "td/telegram/BotCommand.h" #include "td/telegram/BotCommand.h"
#include "td/telegram/BotInfoManager.h" #include "td/telegram/BotInfoManager.h"
#include "td/telegram/BotMenuButton.h" #include "td/telegram/BotMenuButton.h"
@ -3272,6 +3273,8 @@ void Td::dec_actor_refcnt() {
LOG(DEBUG) << "AutosaveManager was cleared" << timer; LOG(DEBUG) << "AutosaveManager was cleared" << timer;
background_manager_.reset(); background_manager_.reset();
LOG(DEBUG) << "BackgroundManager was cleared" << timer; LOG(DEBUG) << "BackgroundManager was cleared" << timer;
boost_manager_.reset();
LOG(DEBUG) << "BoostManager was cleared" << timer;
bot_info_manager_.reset(); bot_info_manager_.reset();
LOG(DEBUG) << "BotInfoManager was cleared" << timer; LOG(DEBUG) << "BotInfoManager was cleared" << timer;
callback_queries_manager_.reset(); callback_queries_manager_.reset();
@ -3481,6 +3484,8 @@ void Td::clear() {
LOG(DEBUG) << "AutosaveManager actor was cleared" << timer; LOG(DEBUG) << "AutosaveManager actor was cleared" << timer;
background_manager_actor_.reset(); background_manager_actor_.reset();
LOG(DEBUG) << "BackgroundManager actor was cleared" << timer; LOG(DEBUG) << "BackgroundManager actor was cleared" << timer;
boost_manager_actor_.reset();
LOG(DEBUG) << "BoostManager actor was cleared" << timer;
bot_info_manager_actor_.reset(); bot_info_manager_actor_.reset();
LOG(DEBUG) << "BotInfoManager actor was cleared" << timer; LOG(DEBUG) << "BotInfoManager actor was cleared" << timer;
contacts_manager_actor_.reset(); contacts_manager_actor_.reset();
@ -3966,6 +3971,9 @@ void Td::init_managers() {
background_manager_ = make_unique<BackgroundManager>(this, create_reference()); background_manager_ = make_unique<BackgroundManager>(this, create_reference());
background_manager_actor_ = register_actor("BackgroundManager", background_manager_.get()); background_manager_actor_ = register_actor("BackgroundManager", background_manager_.get());
G()->set_background_manager(background_manager_actor_.get()); G()->set_background_manager(background_manager_actor_.get());
boost_manager_ = make_unique<BoostManager>(this, create_reference());
boost_manager_actor_ = register_actor("BoostManager", boost_manager_.get());
G()->set_boost_manager(boost_manager_actor_.get());
bot_info_manager_ = make_unique<BotInfoManager>(this, create_reference()); bot_info_manager_ = make_unique<BotInfoManager>(this, create_reference());
bot_info_manager_actor_ = register_actor("BotInfoManager", bot_info_manager_.get()); bot_info_manager_actor_ = register_actor("BotInfoManager", bot_info_manager_.get());
contacts_manager_ = make_unique<ContactsManager>(this, create_reference()); contacts_manager_ = make_unique<ContactsManager>(this, create_reference());

View File

@ -44,6 +44,7 @@ class AudiosManager;
class AuthManager; class AuthManager;
class AutosaveManager; class AutosaveManager;
class BackgroundManager; class BackgroundManager;
class BoostManager;
class BotInfoManager; class BotInfoManager;
class CallManager; class CallManager;
class CallbackQueriesManager; class CallbackQueriesManager;
@ -162,6 +163,8 @@ class Td final : public Actor {
ActorOwn<AutosaveManager> autosave_manager_actor_; ActorOwn<AutosaveManager> autosave_manager_actor_;
unique_ptr<BackgroundManager> background_manager_; unique_ptr<BackgroundManager> background_manager_;
ActorOwn<BackgroundManager> background_manager_actor_; ActorOwn<BackgroundManager> background_manager_actor_;
unique_ptr<BoostManager> boost_manager_;
ActorOwn<BoostManager> boost_manager_actor_;
unique_ptr<BotInfoManager> bot_info_manager_; unique_ptr<BotInfoManager> bot_info_manager_;
ActorOwn<BotInfoManager> bot_info_manager_actor_; ActorOwn<BotInfoManager> bot_info_manager_actor_;
unique_ptr<ContactsManager> contacts_manager_; unique_ptr<ContactsManager> contacts_manager_;