2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Optimize and rename base::weak_unique_ptr.

Rename base::enable_weak_from_this -> base::has_weak_ptr.
Rename base::weak_unique_ptr -> base::weak_ptr.
Rename base::make_weak_unique -> base::make_weak.
Rename base/weak_unique_ptr.h -> base/weak_ptr.h
This commit is contained in:
John Preston
2017-11-30 21:33:27 +04:00
parent 0bf854bf18
commit 2432845df2
26 changed files with 388 additions and 230 deletions

View File

@@ -134,7 +134,11 @@ void Instance::createCall(not_null<UserData*> user, Call::Type type) {
void Instance::refreshDhConfig() {
Expects(_currentCall != nullptr);
request(MTPmessages_GetDhConfig(MTP_int(_dhConfig.version), MTP_int(Call::kRandomPowerSize))).done([this, call = base::make_weak_unique(_currentCall)](const MTPmessages_DhConfig &result) {
request(MTPmessages_GetDhConfig(
MTP_int(_dhConfig.version),
MTP_int(Call::kRandomPowerSize)
)).done([this, call = base::make_weak(_currentCall)](
const MTPmessages_DhConfig &result) {
auto random = base::const_byte_span();
switch (result.type()) {
case mtpc_messages_dhConfig: {
@@ -170,7 +174,8 @@ void Instance::refreshDhConfig() {
if (call) {
call->start(random);
}
}).fail([this, call = base::make_weak_unique(_currentCall)](const RPCError &error) {
}).fail([this, call = base::make_weak(_currentCall)](
const RPCError &error) {
if (!call) {
DEBUG_LOG(("API Warning: call was destroyed before got dhConfig."));
return;