Add empty StatisticsManager.

This commit is contained in:
levlam 2023-09-19 21:24:19 +03:00
parent 0e56b7e527
commit d1dae35b85
6 changed files with 59 additions and 0 deletions

View File

@ -469,6 +469,7 @@ set(TDLIB_SOURCE
td/telegram/SpecialStickerSetType.cpp td/telegram/SpecialStickerSetType.cpp
td/telegram/SponsoredMessageManager.cpp td/telegram/SponsoredMessageManager.cpp
td/telegram/StateManager.cpp td/telegram/StateManager.cpp
td/telegram/StatisticsManager.cpp
td/telegram/StickerFormat.cpp td/telegram/StickerFormat.cpp
td/telegram/StickerMaskPosition.cpp td/telegram/StickerMaskPosition.cpp
td/telegram/StickerPhotoSize.cpp td/telegram/StickerPhotoSize.cpp
@ -777,6 +778,7 @@ set(TDLIB_SOURCE
td/telegram/SpecialStickerSetType.h td/telegram/SpecialStickerSetType.h
td/telegram/SponsoredMessageManager.h td/telegram/SponsoredMessageManager.h
td/telegram/StateManager.h td/telegram/StateManager.h
td/telegram/StatisticsManager.h
td/telegram/StickerFormat.h td/telegram/StickerFormat.h
td/telegram/StickerMaskPosition.h td/telegram/StickerMaskPosition.h
td/telegram/StickerPhotoSize.h td/telegram/StickerPhotoSize.h

View File

@ -313,6 +313,7 @@ function split_file($file, $chunks, $undo) {
'SecretChatActor' => 'SecretChatActor', 'SecretChatActor' => 'SecretChatActor',
'secret_chats_manager[_(-]|SecretChatsManager' => 'SecretChatsManager', 'secret_chats_manager[_(-]|SecretChatsManager' => 'SecretChatsManager',
'sponsored_message_manager[_(-][^.]|SponsoredMessageManager' => 'SponsoredMessageManager', 'sponsored_message_manager[_(-][^.]|SponsoredMessageManager' => 'SponsoredMessageManager',
'statistics_manager[_(-][^.]|StatisticsManager' => 'StatisticsManager',
'stickers_manager[_(-][^.]|StickersManager' => 'StickersManager', 'stickers_manager[_(-][^.]|StickersManager' => 'StickersManager',
'story_manager[_(-][^.]|StoryManager' => 'StoryManager', 'story_manager[_(-][^.]|StoryManager' => 'StoryManager',
'[>](td_db[(][)]|get_td_db_impl[(])|TdDb[^A-Za-z]' => 'TdDb', '[>](td_db[(][)]|get_td_db_impl[(])|TdDb[^A-Za-z]' => 'TdDb',

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/StatisticsManager.h"
namespace td {
StatisticsManager::StatisticsManager(Td *td, ActorShared<> parent) : td_(td), parent_(std::move(parent)) {
}
void StatisticsManager::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 StatisticsManager final : public Actor {
public:
StatisticsManager(Td *td, ActorShared<> parent);
private:
void tear_down() final;
Td *td_;
ActorShared<> parent_;
};
} // namespace td

View File

@ -121,6 +121,7 @@
#include "td/telegram/SentEmailCode.h" #include "td/telegram/SentEmailCode.h"
#include "td/telegram/SponsoredMessageManager.h" #include "td/telegram/SponsoredMessageManager.h"
#include "td/telegram/StateManager.h" #include "td/telegram/StateManager.h"
#include "td/telegram/StatisticsManager.h"
#include "td/telegram/StickerFormat.h" #include "td/telegram/StickerFormat.h"
#include "td/telegram/StickerSetId.h" #include "td/telegram/StickerSetId.h"
#include "td/telegram/StickersManager.h" #include "td/telegram/StickersManager.h"
@ -3312,6 +3313,8 @@ void Td::dec_actor_refcnt() {
LOG(DEBUG) << "ReactionManager was cleared" << timer; LOG(DEBUG) << "ReactionManager was cleared" << timer;
sponsored_message_manager_.reset(); sponsored_message_manager_.reset();
LOG(DEBUG) << "SponsoredMessageManager was cleared" << timer; LOG(DEBUG) << "SponsoredMessageManager was cleared" << timer;
statistics_manager_.reset();
LOG(DEBUG) << "StatisticsManager was cleared" << timer;
stickers_manager_.reset(); stickers_manager_.reset();
LOG(DEBUG) << "StickersManager was cleared" << timer; LOG(DEBUG) << "StickersManager was cleared" << timer;
story_manager_.reset(); story_manager_.reset();
@ -3518,6 +3521,8 @@ void Td::clear() {
LOG(DEBUG) << "ReactionManager actor was cleared" << timer; LOG(DEBUG) << "ReactionManager actor was cleared" << timer;
sponsored_message_manager_actor_.reset(); sponsored_message_manager_actor_.reset();
LOG(DEBUG) << "SponsoredMessageManager actor was cleared" << timer; LOG(DEBUG) << "SponsoredMessageManager actor was cleared" << timer;
statistics_manager_actor_.reset();
LOG(DEBUG) << "StatisticsManager actor was cleared" << timer;
stickers_manager_actor_.reset(); stickers_manager_actor_.reset();
LOG(DEBUG) << "StickersManager actor was cleared" << timer; LOG(DEBUG) << "StickersManager actor was cleared" << timer;
story_manager_actor_.reset(); story_manager_actor_.reset();
@ -4008,6 +4013,8 @@ void Td::init_managers() {
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());
statistics_manager_ = make_unique<StatisticsManager>(this, create_reference());
statistics_manager_actor_ = register_actor("StatisticsManager", statistics_manager_.get());
stickers_manager_ = make_unique<StickersManager>(this, create_reference()); stickers_manager_ = make_unique<StickersManager>(this, create_reference());
stickers_manager_actor_ = register_actor("StickersManager", stickers_manager_.get()); stickers_manager_actor_ = register_actor("StickersManager", stickers_manager_.get());
G()->set_stickers_manager(stickers_manager_actor_.get()); G()->set_stickers_manager(stickers_manager_actor_.get());

View File

@ -77,6 +77,7 @@ class SecureManager;
class SecretChatsManager; class SecretChatsManager;
class SponsoredMessageManager; class SponsoredMessageManager;
class StateManager; class StateManager;
class StatisticsManager;
class StickersManager; class StickersManager;
class StorageManager; class StorageManager;
class StoryManager; class StoryManager;
@ -199,6 +200,8 @@ class Td final : public Actor {
ActorOwn<ReactionManager> reaction_manager_actor_; ActorOwn<ReactionManager> reaction_manager_actor_;
unique_ptr<SponsoredMessageManager> sponsored_message_manager_; unique_ptr<SponsoredMessageManager> sponsored_message_manager_;
ActorOwn<SponsoredMessageManager> sponsored_message_manager_actor_; ActorOwn<SponsoredMessageManager> sponsored_message_manager_actor_;
unique_ptr<StatisticsManager> statistics_manager_;
ActorOwn<StatisticsManager> statistics_manager_actor_;
unique_ptr<StickersManager> stickers_manager_; unique_ptr<StickersManager> stickers_manager_;
ActorOwn<StickersManager> stickers_manager_actor_; ActorOwn<StickersManager> stickers_manager_actor_;
unique_ptr<StoryManager> story_manager_; unique_ptr<StoryManager> story_manager_;