hard fuck file reference
This commit is contained in:
parent
9b6b31ba1f
commit
1a11f96126
@ -364,4 +364,11 @@ void FileReferenceManager::reload_photo(PhotoSizeSource source, Promise<Unit> pr
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FileReferenceManager::memory_cleanup(FileId file_id) {
|
||||||
|
auto &node = nodes_[file_id];
|
||||||
|
node.query.reset();
|
||||||
|
node.file_source_ids.reset_position();
|
||||||
|
nodes_.erase(file_id);
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace td
|
} // namespace td
|
||||||
|
@ -38,6 +38,8 @@ class FileReferenceManager : public Actor {
|
|||||||
static bool is_file_reference_error(const Status &error);
|
static bool is_file_reference_error(const Status &error);
|
||||||
static size_t get_file_reference_error_pos(const Status &error);
|
static size_t get_file_reference_error_pos(const Status &error);
|
||||||
|
|
||||||
|
void memory_cleanup(FileId file_id);
|
||||||
|
|
||||||
FileSourceId create_message_file_source(FullMessageId full_message_id);
|
FileSourceId create_message_file_source(FullMessageId full_message_id);
|
||||||
FileSourceId create_user_photo_file_source(UserId user_id, int64 photo_id);
|
FileSourceId create_user_photo_file_source(UserId user_id, int64 photo_id);
|
||||||
FileSourceId create_chat_photo_file_source(ChatId chat_id);
|
FileSourceId create_chat_photo_file_source(ChatId chat_id);
|
||||||
|
@ -4313,6 +4313,10 @@ void Td::init_file_manager() {
|
|||||||
send_closure(G()->storage_manager(), &StorageManager::on_new_file, size, real_size, cnt);
|
send_closure(G()->storage_manager(), &StorageManager::on_new_file, size, real_size, cnt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void destroy_file_source(FileId file_id) final {
|
||||||
|
td_->file_reference_manager_->memory_cleanup(file_id);
|
||||||
|
}
|
||||||
|
|
||||||
void on_file_updated(FileId file_id) final {
|
void on_file_updated(FileId file_id) final {
|
||||||
send_closure(G()->td(), &Td::send_update,
|
send_closure(G()->td(), &Td::send_update,
|
||||||
make_tl_object<td_api::updateFile>(td_->file_manager_->get_file_object(file_id)));
|
make_tl_object<td_api::updateFile>(td_->file_manager_->get_file_object(file_id)));
|
||||||
|
@ -3495,6 +3495,9 @@ void FileManager::memory_cleanup() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* DESTROY FILE REFERENCE */
|
||||||
|
context_->destroy_file_source(node->main_file_id_);
|
||||||
|
|
||||||
/* DESTROY MAIN FILE */
|
/* DESTROY MAIN FILE */
|
||||||
empty_file_ids_.push_back(i);
|
empty_file_ids_.push_back(i);
|
||||||
file_id_info_[i] = FileIdInfo();
|
file_id_info_[i] = FileIdInfo();
|
||||||
|
@ -369,6 +369,8 @@ class FileManager : public FileLoadManager::Callback {
|
|||||||
|
|
||||||
virtual void on_file_updated(FileId size) = 0;
|
virtual void on_file_updated(FileId size) = 0;
|
||||||
|
|
||||||
|
virtual void destroy_file_source(FileId file_id) = 0;
|
||||||
|
|
||||||
virtual bool add_file_source(FileId file_id, FileSourceId file_source_id) = 0;
|
virtual bool add_file_source(FileId file_id, FileSourceId file_source_id) = 0;
|
||||||
|
|
||||||
virtual bool remove_file_source(FileId file_id, FileSourceId file_source_id) = 0;
|
virtual bool remove_file_source(FileId file_id, FileSourceId file_source_id) = 0;
|
||||||
|
Reference in New Issue
Block a user