Add empty GameManager.

This commit is contained in:
levlam 2021-09-07 10:02:44 +03:00
parent 41ca7fdedb
commit d395c2496e
7 changed files with 74 additions and 0 deletions

View File

@ -331,6 +331,7 @@ set(TDLIB_SOURCE
td/telegram/files/PartsManager.cpp
td/telegram/files/ResourceManager.cpp
td/telegram/Game.cpp
td/telegram/GameManager.cpp
td/telegram/Global.cpp
td/telegram/GroupCallManager.cpp
td/telegram/GroupCallParticipant.cpp
@ -519,6 +520,7 @@ set(TDLIB_SOURCE
td/telegram/FolderId.h
td/telegram/FullMessageId.h
td/telegram/Game.h
td/telegram/GameManager.h
td/telegram/Global.h
td/telegram/GroupCallId.h
td/telegram/GroupCallManager.h

View File

@ -286,6 +286,7 @@ function split_file($file, $chunks, $undo) {
'file_reference_manager[_(-][^.]|FileReferenceManager|file_references[)]' => 'FileReferenceManager',
'file_manager[_(-][^.]|FileManager([^ ;.]| [^*])|update_file[)]' => 'files/FileManager',
'G[(][)]|Global[^A-Za-z]' => 'Global',
'game_manager[_(-][^.]|GameManager' => 'GameManager',
'group_call_manager[_(-][^.]|GroupCallManager' => 'GroupCallManager',
'HashtagHints' => 'HashtagHints',
'inline_queries_manager[_(-][^.]|InlineQueriesManager' => 'InlineQueriesManager',

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/GameManager.h"
namespace td {
GameManager::GameManager(Td *td, ActorShared<> parent) : td_(td), parent_(std::move(parent)) {
}
GameManager::~GameManager() = default;
void GameManager::tear_down() {
parent_.reset();
}
} // namespace td

31
td/telegram/GameManager.h Normal file
View File

@ -0,0 +1,31 @@
//
// 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"
namespace td {
class Td;
class GameManager final : public Actor {
public:
GameManager(Td *td, ActorShared<> parent);
GameManager(const GameManager &) = delete;
GameManager &operator=(const GameManager &) = delete;
GameManager(GameManager &&) = delete;
GameManager &operator=(GameManager &&) = delete;
~GameManager() final;
private:
void tear_down() final;
Td *td_;
ActorShared<> parent_;
};
} // namespace td

View File

@ -38,6 +38,7 @@ class ConnectionCreator;
class ContactsManager;
class FileManager;
class FileReferenceManager;
class GameManager;
class GroupCallManager;
class LanguagePackManager;
class LinkManager;
@ -218,6 +219,13 @@ class Global final : public ActorContext {
file_reference_manager_ = std::move(file_reference_manager);
}
ActorId<GameManager> game_manager() const {
return game_manager_;
}
void set_game_manager(ActorId<GameManager> game_manager) {
game_manager_ = game_manager;
}
ActorId<GroupCallManager> group_call_manager() const {
return group_call_manager_;
}
@ -409,6 +417,7 @@ class Global final : public ActorContext {
ActorId<ContactsManager> contacts_manager_;
ActorId<FileManager> file_manager_;
ActorId<FileReferenceManager> file_reference_manager_;
ActorId<GameManager> game_manager_;
ActorId<GroupCallManager> group_call_manager_;
ActorId<LanguagePackManager> language_pack_manager_;
ActorId<LinkManager> link_manager_;

View File

@ -43,6 +43,7 @@
#include "td/telegram/files/FileType.h"
#include "td/telegram/FolderId.h"
#include "td/telegram/FullMessageId.h"
#include "td/telegram/GameManager.h"
#include "td/telegram/Global.h"
#include "td/telegram/GroupCallId.h"
#include "td/telegram/GroupCallManager.h"
@ -3652,6 +3653,8 @@ void Td::dec_actor_refcnt() {
LOG(DEBUG) << "FileManager was cleared" << timer;
file_reference_manager_.reset();
LOG(DEBUG) << "FileReferenceManager was cleared" << timer;
game_manager_.reset();
LOG(DEBUG) << "GameManager was cleared" << timer;
group_call_manager_.reset();
LOG(DEBUG) << "GroupCallManager was cleared" << timer;
inline_queries_manager_.reset();
@ -3842,6 +3845,8 @@ void Td::clear() {
LOG(DEBUG) << "FileManager actor was cleared" << timer;
file_reference_manager_actor_.reset();
LOG(DEBUG) << "FileReferenceManager actor was cleared" << timer;
game_manager_actor_.reset();
LOG(DEBUG) << "GameManager actor was cleared" << timer;
group_call_manager_actor_.reset();
LOG(DEBUG) << "GroupCallManager actor was cleared" << timer;
inline_queries_manager_actor_.reset();
@ -4291,6 +4296,9 @@ void Td::init_managers() {
G()->set_contacts_manager(contacts_manager_actor_.get());
country_info_manager_ = make_unique<CountryInfoManager>(this, create_reference());
country_info_manager_actor_ = register_actor("CountryInfoManager", country_info_manager_.get());
game_manager_ = make_unique<GameManager>(this, create_reference());
game_manager_actor_ = register_actor("GameManager", game_manager_.get());
G()->set_game_manager(game_manager_actor_.get());
group_call_manager_ = make_unique<GroupCallManager>(this, create_reference());
group_call_manager_actor_ = register_actor("GroupCallManager", group_call_manager_.get());
G()->set_group_call_manager(group_call_manager_actor_.get());

View File

@ -51,6 +51,7 @@ class DeviceTokenManager;
class DocumentsManager;
class FileManager;
class FileReferenceManager;
class GameManager;
class GroupCallManager;
class InlineQueriesManager;
class HashtagHints;
@ -158,6 +159,8 @@ class Td final : public NetQueryCallback {
ActorOwn<FileManager> file_manager_actor_;
unique_ptr<FileReferenceManager> file_reference_manager_;
ActorOwn<FileReferenceManager> file_reference_manager_actor_;
unique_ptr<GameManager> game_manager_;
ActorOwn<GameManager> game_manager_actor_;
unique_ptr<GroupCallManager> group_call_manager_;
ActorOwn<GroupCallManager> group_call_manager_actor_;
unique_ptr<InlineQueriesManager> inline_queries_manager_;